File: Make_lib_test

package info (click to toggle)
libtsp 3r0-1
  • links: PTS
  • area: non-free
  • in suites: potato, woody
  • size: 5,096 kB
  • ctags: 1,798
  • sloc: ansic: 14,464; sh: 1,217; makefile: 182
file content (59 lines) | stat: -rw-r--r-- 1,368 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
50
51
52
53
54
55
56
57
58
59
#
#  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 1.24 1998/07/06 libtsp-v3r0 $

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))

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

# 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 -p $(BINDIR)
	$(CC) -I$(includedir) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
		$< $(LOADLIBES) -o $@

test:	$(BINS)
	@echo "$(TEST_SCRIPT) $(FILTER) > $(LOG_FILE)"
	@PATH=$(BINDIR):$$PATH \
		$(TEST_SCRIPT) $(FILTER) > $(LOG_FILE)
	diff $(LOG_FILE) $(REF_FILE)
	$(RM) $(LOG_FILE)

reference:
	$(CO) $(COFLAGS) -l $(REF_FILE)
	@echo "$(TEST_SCRIPT) $(FILTER) > $(LOG_FILE)"
	@PATH=$(BINDIR):$$PATH \
		$(TEST_SCRIPT) $(FILTER) > $(REF_FILE)
	$(CI) $(CIFLAGS) -u -m"- update" $(REF_FILE)

clean:
	$(RM) *.o