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 $
5 # Automated test suite for libc_r (pthreads).
11 CTESTS := hello_d.c hello_s.c join_leak_d.c mutex_d.c sem_d.c sigsuspend_d.c \
14 # C programs that are used internally by the tests. The build system merely
18 # Tests written in perl.
19 PTESTS := propagate_s.pl
21 # Munge the file lists to their final executable names (strip the .c).
25 CPPFLAGS := -D_LIBC_R_ -D_REENTRANT
26 CFLAGS := -Wall -pipe -g3
32 # Flags passed to verify. "-v" or "-u" may be useful.
37 # Only use the following suffixes, in order to avoid any strange built-in rules.
39 .SUFFIXES : .c .o .d .pl
41 # Clear out all paths, then set just one (default path) for the main build
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/)"
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/)"
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/)"
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))
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/)
79 tests : tests_a tests_p tests_s
82 .for bin in $(CTESTS) $(BTESTS)
85 @echo "Test static library:"
86 @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
89 .for bin in $(CTESTS) $(BTESTS)
92 @echo "Test profile library:"
93 @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
96 .for bin in $(CTESTS) $(BTESTS)
99 @echo "Test shared library:"
100 @./verify $(VFLAGS) $(CTESTS) $(PTESTS)
102 check : check_a check_p check_s
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/)