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