File: Make_lib_test

package info (click to toggle)
libtsp 2r8-1
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 4,908 kB
  • ctags: 1,409
  • sloc: ansic: 12,525; sh: 1,044; makefile: 164
file content (49 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
#  Generic make commands for C-language library module test programs
#  For GNU make; will not work with most other make programs
#
#	PROGRAMS = a b ...
#	FILTER = | filter_log  # optional
#	include ../../Make_lib_test
#


# $Id: Make_lib_test,v 1.17 1997/03/07 libtsp-V2R8 $

include Make_kernel

CI = ci

fdir := $(dir $(shell pwd))	# Lop off last directory component, i.e. test
DIR := $(notdir $(fdir:/=))	# Remove trailing /, pick off last component
DIR := $(strip $(DIR))

TEST_SCRIPT = ./t$(DIR)routines
LOG_FILE = t$(DIR).log
REF_FILE = t$(DIR).ref

# Put bins in the bin/ subdirectory
BINS = $(addprefix $(BINDIR)/, $(PROGRAMS))

.PHONY:	all test reference clean

all:	$(BINS)

# Static rules expand to one rule for each program
$(BINS): $(BINDIR)/%: %.c $(LIB)
	@-test -d $(BINDIR) || mkdir $(BINDIR)
	$(CC) -I$(includedir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
		$< $(LOADLIBES) -o $@

test:	$(BINS)
	BINDIR=$(BINDIR) $(TEST_SCRIPT) $(FILTER) > $(LOG_FILE)
	diff $(LOG_FILE) $(REF_FILE)
	$(RM) $(LOG_FILE)

reference:
	$(CO) -M -l $(REF_FILE)
	BINDIR=$(BINDIR) $(TEST_SCRIPT) $(FILTER) > $(REF_FILE)
	$(CI) -M -u -m"- update" $(REF_FILE)

clean:
	$(RM) *.o