]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - lib/libkse/test/Makefile
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / lib / libkse / test / Makefile
1 #
2 # $FreeBSD$
3 #
4 # Automated test suite for libpthread (pthreads).
5 #
6
7 # File lists.
8
9 # Tests written in C.
10 CTESTS := hello_d.c hello_s.c join_leak_d.c mutex_d.c sem_d.c sigsuspend_d.c \
11         sigwait_d.c
12
13 # C programs that are used internally by the tests.  The build system merely
14 # compiles these.
15 BTESTS := guard_b.c hello_b.c
16
17 # Tests written in perl.
18 PTESTS := guard_s.pl propagate_s.pl
19
20 # Munge the file lists to their final executable names (strip the .c).
21 CTESTS := $(CTESTS:R)
22 BTESTS := $(BTESTS:R)
23
24 CPPFLAGS := -D_LIBC_R_ -D_REENTRANT
25 CFLAGS := -Wall -pipe -g3
26 LDFLAGS_A := -static
27 LDFLAGS_P := -pg
28 LDFLAGS_S :=
29 LIBS := -lpthread
30
31 # Flags passed to verify.  "-v" or "-u" may be useful.
32 VERIFY = perl verify
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