2000-04-24 21:07:45 +00:00
|
|
|
#
|
1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1998-08-25 12:33:22 +00:00
|
|
|
#
|
2000-04-24 21:07:45 +00:00
|
|
|
# Automated test suite for libc_r (pthreads).
|
1998-08-25 12:33:22 +00:00
|
|
|
#
|
|
|
|
|
2000-04-24 21:07:45 +00:00
|
|
|
# File lists.
|
|
|
|
|
2001-05-20 23:11:54 +00:00
|
|
|
# Tests written in C.
|
|
|
|
CTESTS := hello_d.c hello_s.c join_leak_d.c mutex_d.c sem_d.c sigsuspend_d.c \
|
|
|
|
sigwait_d.c
|
2000-04-24 21:07:45 +00:00
|
|
|
|
2001-05-20 23:11:54 +00:00
|
|
|
# C programs that are used internally by the tests. The build system merely
|
|
|
|
# compiles these.
|
2001-07-20 04:23:11 +00:00
|
|
|
BTESTS := guard_b.c hello_b.c
|
2000-04-24 21:07:45 +00:00
|
|
|
|
2001-05-20 23:11:54 +00:00
|
|
|
# Tests written in perl.
|
2001-07-20 04:23:11 +00:00
|
|
|
PTESTS := guard_s.pl propagate_s.pl
|
2000-04-24 21:07:45 +00:00
|
|
|
|
|
|
|
# Munge the file lists to their final executable names (strip the .c).
|
2001-05-20 23:11:54 +00:00
|
|
|
CTESTS := $(CTESTS:R)
|
2000-04-24 21:07:45 +00:00
|
|
|
BTESTS := $(BTESTS:R)
|
|
|
|
|
2001-05-20 23:11:54 +00:00
|
|
|
CPPFLAGS := -D_LIBC_R_ -D_REENTRANT
|
2000-04-24 21:07:45 +00:00
|
|
|
CFLAGS := -Wall -pipe -g3
|
|
|
|
LDFLAGS_A := -static
|
|
|
|
LDFLAGS_P := -pg
|
|
|
|
LDFLAGS_S :=
|
2001-01-24 13:41:04 +00:00
|
|
|
LIBS := -lc_r
|
2000-04-24 21:07:45 +00:00
|
|
|
|
|
|
|
# Flags passed to verify. "-v" or "-u" may be useful.
|
|
|
|
VFLAGS :=
|
|
|
|
|
|
|
|
all : default
|
|
|
|
|
|
|
|
# Only use the following suffixes, in order to avoid any strange built-in rules.
|
|
|
|
.SUFFIXES :
|
|
|
|
.SUFFIXES : .c .o .d .pl
|
|
|
|
|
|
|
|
# Clear out all paths, then set just one (default path) for the main build
|
|
|
|
# directory.
|
|
|
|
.PATH :
|
|
|
|
.PATH : .
|
|
|
|
|
|
|
|
# Build the C programs.
|
2001-05-20 23:11:54 +00:00
|
|
|
.for bin in $(CTESTS) $(BTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
$(bin)_a : $(bin:S/$/&.c/)
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
|
|
|
|
$(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_A) $(LIBS)
|
|
|
|
@$(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/)"
|
|
|
|
|
|
|
|
$(bin)_p : $(bin:S/$/&.c/)
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
|
|
|
|
$(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_P) $(LIBS)
|
|
|
|
@$(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/)"
|
|
|
|
|
|
|
|
$(bin)_s : $(bin:S/$/&.c/)
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(bin:S/$/&.c/) -o $(@:S/$/&.o/)
|
|
|
|
$(CC) -o $@ $(@:S/$/&.o/) $(LDFLAGS_S) $(LIBS)
|
|
|
|
@$(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/)"
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
# Dependency file inclusion.
|
2001-05-20 23:11:54 +00:00
|
|
|
.for depfile in $(CTESTS:R:S/$/&_a.d/) $(BTESTS:R:S/$/&_a.d/) \
|
|
|
|
$(CTESTS:R:S/$/&_p.d/) $(BTESTS:R:S/$/&_p.d/) \
|
|
|
|
$(CTESTS:R:S/$/&_s.d/) $(BTESTS:R:S/$/&_s.d/)
|
2000-04-24 21:07:45 +00:00
|
|
|
.if exists($(depfile))
|
|
|
|
.include "$(depfile)"
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
default : check
|
|
|
|
|
2001-05-20 23:11:54 +00:00
|
|
|
tests_a : $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
|
|
|
|
tests_p : $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
|
|
|
|
tests_s : $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
|
2000-04-24 21:07:45 +00:00
|
|
|
|
|
|
|
tests : tests_a tests_p tests_s
|
|
|
|
|
|
|
|
check_a : tests_a
|
2001-05-20 23:11:54 +00:00
|
|
|
.for bin in $(CTESTS) $(BTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
@cp $(bin)_a $(bin)
|
|
|
|
.endfor
|
|
|
|
@echo "Test static library:"
|
2001-05-20 23:11:54 +00:00
|
|
|
@./verify $(VFLAGS) $(CTESTS) $(PTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
|
|
|
|
check_p : tests_p
|
2001-05-20 23:11:54 +00:00
|
|
|
.for bin in $(CTESTS) $(BTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
@cp $(bin)_p $(bin)
|
|
|
|
.endfor
|
|
|
|
@echo "Test profile library:"
|
2001-05-20 23:11:54 +00:00
|
|
|
@./verify $(VFLAGS) $(CTESTS) $(PTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
|
|
|
|
check_s : tests_s
|
2001-05-20 23:11:54 +00:00
|
|
|
.for bin in $(CTESTS) $(BTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
@cp $(bin)_s $(bin)
|
|
|
|
.endfor
|
|
|
|
@echo "Test shared library:"
|
2001-05-20 23:11:54 +00:00
|
|
|
@./verify $(VFLAGS) $(CTESTS) $(PTESTS)
|
2000-04-24 21:07:45 +00:00
|
|
|
|
|
|
|
check : check_a check_p check_s
|
1998-08-25 12:33:22 +00:00
|
|
|
|
2000-04-24 21:07:45 +00:00
|
|
|
clean :
|
|
|
|
rm -f *~
|
|
|
|
rm -f *.core
|
|
|
|
rm -f *.out
|
|
|
|
rm -f *.perf
|
|
|
|
rm -f *.diff
|
|
|
|
rm -f *.gmon
|
2001-05-20 23:11:54 +00:00
|
|
|
rm -f $(CTESTS) $(BTESTS)
|
|
|
|
rm -f $(CTESTS:S/$/&_a/) $(BTESTS:S/$/&_a/)
|
|
|
|
rm -f $(CTESTS:S/$/&_p/) $(BTESTS:S/$/&_p/)
|
|
|
|
rm -f $(CTESTS:S/$/&_s/) $(BTESTS:S/$/&_s/)
|
2000-04-24 21:07:45 +00:00
|
|
|
rm -f *.d
|
|
|
|
rm -f *.o
|