Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / lib / libc_r / test / Makefile
1 #
2 # $FreeBSD: src/lib/libc_r/test/Makefile,v 1.4.2.2 2001/06/22 21:44:27 jasone Exp $
3 # $DragonFly: src/lib/libc_r/test/Makefile,v 1.2 2003/06/17 04:26:48 dillon Exp $
4 #
5 # Automated test suite for libc_r (pthreads).
6 #
7
8 # File lists.
9
10 # Tests written in C.
11 CTESTS := hello_d.c hello_s.c join_leak_d.c mutex_d.c sem_d.c sigsuspend_d.c \
12         sigwait_d.c
13
14 # C programs that are used internally by the tests.  The build system merely
15 # compiles these.
16 BTESTS := hello_b.c
17
18 # Tests written in perl.
19 PTESTS := propagate_s.pl
20
21 # Munge the file lists to their final executable names (strip the .c).
22 CTESTS := $(CTESTS:R)
23 BTESTS := $(BTESTS:R)
24
25 CPPFLAGS := -D_LIBC_R_ -D_REENTRANT
26 CFLAGS := -Wall -pipe -g3
27 LDFLAGS_A := -static
28 LDFLAGS_P := -pg
29 LDFLAGS_S :=
30 LIBS := -lc_r
31
32 # Flags passed to verify.  "-v" or "-u" may be useful.
33 VFLAGS :=
34
35 all : default
36
37 # Only use the following suffixes, in order to avoid any strange built-in rules.
38 .SUFFIXES :
39 .SUFFIXES : .c .o .d .pl
40
41 # Clear out all paths, then set just one (default path) for the main build
42 # directory.
43 .PATH :
44 .PATH : .
45
46 # Build the C programs.
47 .for bin in $(CTESTS) $(BTESTS)
48 $(bin)_a : $(bin:S/$/&.c/)
49         $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
50         $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_A) $(LIBS)
51         @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_a.o \2/g\" > $(@:R:S/$/&.d/)"
52
53 $(bin)_p : $(bin:S/$/&.c/)
54         $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
55         $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_P) $(LIBS)
56         @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_p.o \2/g\" > $(@:R:S/$/&.d/)"
57
58 $(bin)_s : $(bin:S/$/&.c/)
59         $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
60         $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_S) $(LIBS)
61         @$(SHELL) -ec "$(CC) -M $(CPPFLAGS) $(bin:S/$/&.c/) | sed \"s/\($(bin:T)\)\.o\([ :]*\)/$(bin:H:S!/!\\/!g)\/\1_s.o \2/g\" > $(@:R:S/$/&.d/)"
62 .endfor
63
64 # Dependency file inclusion.
65 .for depfile in $(CTESTS:R:S/$/&_a.d/) $(BTESTS:R:S/$/&_a.d/) \
66                 $(CTESTS:R:S/$/&_p.d/) $(BTESTS:R:S/$/&_p.d/) \
67                 $(CTESTS:R:S/$/&_s.d/) $(BTESTS:R:S/$/&_s.d/)
68 .if exists($(depfile))
69 .include "$(depfile)"
70 .endif
71 .endfor
72
73 default : check
74
75 tests_a : $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
76 tests_p : $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
77 tests_s : $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
78
79 tests : tests_a tests_p tests_s
80
81 check_a : tests_a
82 .for bin in $(CTESTS) $(BTESTS)
83         @cp $(bin)_a $(bin)
84 .endfor
85         @echo "Test static library:"
86         @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
87
88 check_p : tests_p
89 .for bin in $(CTESTS) $(BTESTS)
90         @cp $(bin)_p $(bin)
91 .endfor
92         @echo "Test profile library:"
93         @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
94
95 check_s : tests_s
96 .for bin in $(CTESTS) $(BTESTS)
97         @cp $(bin)_s $(bin)
98 .endfor
99         @echo "Test shared library:"
100         @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
101
102 check : check_a check_p check_s
103
104 clean :
105         rm -f *~
106         rm -f *.core
107         rm -f *.out
108         rm -f *.perf
109         rm -f *.diff
110         rm -f *.gmon
111         rm -f $(CTESTS) $(BTESTS)
112         rm -f $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
113         rm -f $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
114         rm -f $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
115         rm -f *.d
116         rm -f *.o