Makefile revision 64562
1132295Srwatson# 2132295Srwatson# $FreeBSD: head/lib/libkse/test/Makefile 59667 2000-04-26 23:25:58Z jasone $ 3132295Srwatson# 4132295Srwatson# Automated test suite for libc_r (pthreads). 5132295Srwatson# 6132295Srwatson 7132295Srwatson# File lists. 8132295Srwatson 9132295Srwatson# Diff mode tests written in C. 10132295SrwatsonCDTESTS := hello_d.c mutex_d.c sem_d.c sigsuspend_d.c sigwait_d.c 11132295Srwatson 12132295Srwatson# Sequence mode tests written in C. 13132295SrwatsonCSTESTS := hello_s.c 14132295Srwatson 15132295Srwatson# C programs that are used internally by the perl-based tests. The build 16132295Srwatson# system merely compiles these. 17132295SrwatsonBTESTS := hello_b.c 18132295Srwatson 19132295Srwatson# Diff mode tests written in perl. 20132295SrwatsonPDTESTS := 21132295Srwatson 22132295Srwatson# Sequence mode tests written in perl. 23132295SrwatsonPSTESTS := propagate_s.pl 24132295Srwatson 25132295Srwatson# Munge the file lists to their final executable names (strip the .c). 26132295SrwatsonCDTESTS := $(CDTESTS:R) 27132295SrwatsonCSTESTS := $(CSTESTS:R) 28132295SrwatsonBTESTS := $(BTESTS:R) 29132295Srwatson 30132295SrwatsonCPPFLAGS := -D_LIBC_R_ 31132295SrwatsonCFLAGS := -Wall -pipe -g3 32132295SrwatsonLDFLAGS_A := -static 33132295SrwatsonLDFLAGS_P := -pg 34136843SrwatsonLDFLAGS_S := 35132295SrwatsonLIBS := -pthread 36132295Srwatson 37132295Srwatson# Flags passed to verify. "-v" or "-u" may be useful. 38132295SrwatsonVFLAGS := 39132295Srwatson 40132295Srwatsonall : default 41132295Srwatson 42132295Srwatson# Only use the following suffixes, in order to avoid any strange built-in rules. 43132295Srwatson.SUFFIXES : 44132295Srwatson.SUFFIXES : .c .o .d .pl 45132295Srwatson 46132295Srwatson# Clear out all paths, then set just one (default path) for the main build 47132295Srwatson# directory. 48132295Srwatson.PATH : 49132295Srwatson.PATH : . 50132295Srwatson 51132295Srwatson# Build the C programs. 52132295Srwatson.for bin in $(CDTESTS) $(CSTESTS) $(BTESTS) 53132295Srwatson$(bin)_a : $(bin:S/$/&.c/) 54132295Srwatson $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/) 55132295Srwatson $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_A) $(LIBS) 56132295Srwatson @$(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/)" 57132295Srwatson 58137587Snik$(bin)_p : $(bin:S/$/&.c/) 59137587Snik $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/) 60132295Srwatson $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_P) $(LIBS) 61132295Srwatson @$(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/)" 62132295Srwatson 63132295Srwatson$(bin)_s : $(bin:S/$/&.c/) 64132295Srwatson $(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/) 65136843Srwatson $(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_S) $(LIBS) 66136843Srwatson @$(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/)" 67132295Srwatson.endfor 68132295Srwatson 69136843Srwatson# Dependency file inclusion. 70136843Srwatson.for depfile in $(CDTESTS:R:S/$/&_a.d/) $(CSTESTS:R:S/$/&_a.d/) \ 71132295Srwatson $(BTESTS:R:S/$/&_a.d/) $(CDTESTS:R:S/$/&_p.d/) \ 72132295Srwatson $(CSTESTS:R:S/$/&_p.d/) $(BTESTS:R:S/$/&_p.d/) \ 73132295Srwatson $(CDTESTS:R:S/$/&_s.d/) $(CSTESTS:R:S/$/&_s.d/) \ 74132295Srwatson $(BTESTS:R:S/$/&_s.d/) 75132295Srwatson.if exists($(depfile)) 76132295Srwatson.include "$(depfile)" 77132295Srwatson.endif 78136843Srwatson.endfor 79136843Srwatson 80132295Srwatsondefault : check 81136843Srwatson 82136843Srwatsontests_a : $(CDTESTS:S/$/&_a/) $(CSTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/) 83132295Srwatsontests_p : $(CDTESTS:S/$/&_p/) $(CSTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/) 84132295Srwatsontests_s : $(CDTESTS:S/$/&_s/) $(CSTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/) 85136843Srwatson 86136843Srwatsontests : tests_a tests_p tests_s 87132295Srwatson 88136843Srwatsoncheck_a : tests_a 89136843Srwatson.for bin in $(CDTESTS) $(CSTESTS) $(BTESTS) 90132295Srwatson @cp $(bin)_a $(bin) 91136843Srwatson.endfor 92136843Srwatson @echo "Test static library:" 93136843Srwatson @./verify $(VFLAGS) -- -d $(CDTESTS) $(PDTESTS) -s $(CSTESTS) $(PSTESTS) 94136843Srwatson 95132295Srwatsoncheck_p : tests_p 96132295Srwatson.for bin in $(CDTESTS) $(CSTESTS) $(BTESTS) 97134238Srwatson @cp $(bin)_p $(bin) 98136843Srwatson.endfor 99136843Srwatson @echo "Test profile library:" 100136843Srwatson @./verify $(VFLAGS) -- -d $(CDTESTS) $(PDTESTS) -s $(CSTESTS) $(PSTESTS) 101136843Srwatson 102132295Srwatsoncheck_s : tests_s 103132295Srwatson.for bin in $(CDTESTS) $(CSTESTS) $(BTESTS) 104132295Srwatson @cp $(bin)_s $(bin) 105132295Srwatson.endfor 106132295Srwatson @echo "Test shared library:" 107132295Srwatson @./verify $(VFLAGS) -- -d $(CDTESTS) $(PDTESTS) -s $(CSTESTS) $(PSTESTS) 108132295Srwatson 109136843Srwatsoncheck : check_a check_p check_s 110137587Snik 111136843Srwatsonclean : 112137587Snik rm -f *~ 113132295Srwatson rm -f *.core 114132295Srwatson rm -f *.out 115132295Srwatson rm -f *.perf 116 rm -f *.diff 117 rm -f *.gmon 118 rm -f $(CDTESTS) $(CSTESTS) $(BTESTS) 119 rm -f $(CDTESTS:S/$/&_a/) $(CSTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/) 120 rm -f $(CDTESTS:S/$/&_p/) $(CSTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/) 121 rm -f $(CDTESTS:S/$/&_s/) $(CSTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/) 122 rm -f *.d 123 rm -f *.o 124