1 # Common makefile rules for tests
3 # Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 G_TARGETS := $(patsubst %,%_glibc,$(U_TARGETS))
23 U_TARGETS += $(U_TESTS)
24 G_TARGETS += $(G_TESTS)
28 TARGETS += $(U_TARGETS)
30 ifeq ($(UCLIBC_ONLY),)
31 TARGETS += $(G_TARGETS)
34 test check all: $(TARGETS)
35 # dummy rule to prevent the "Nothing to be done for `all'." message
40 $(TARGETS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
41 $(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
42 $(G_TARGETS): $(patsubst %_glibc,%.c,$(G_TARGETS))
46 for x in "$@.out" "$(patsubst %_glibc,%,$@).out" ; do \
47 test -e "$$x.good" && $(do_showdiff) "$@.out" "$$x.good" && exec diff -u "$@.out" "$$x.good" ; \
51 define uclibc_glibc_diff_test
53 test -z "$(DODIFF_$(patsubst %_glibc,%,$@))" && exec true ; \
54 uclibc_out="$@.out" ; \
55 glibc_out="$(patsubst %_glibc,%,$@).out" ; \
56 $(do_showdiff) $$uclibc_out $$glibc_out ; \
57 exec diff -u "$$uclibc_out" "$$glibc_out"
61 $(WRAPPER) $(WRAPPER_$(patsubst %_glibc,%,$@)) \
62 ./$@ $(OPTS) $(OPTS_$(patsubst %_glibc,%,$@)) &> "$@.out" ; \
64 expected_ret="$(RET_$(patsubst %_glibc,%,$@))" ; \
65 test -z "$$expected_ret" && export expected_ret=0 ; \
66 if ! test $$ret -eq $$expected_ret ; then \
76 $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c $@.c -o $@.o
77 $(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@)
78 ifeq ($(COMPILE_ONLY),)
85 $(Q)$(HOSTCC) $(HOST_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) -c $(patsubst %_glibc,%,$@).c -o $@.o
86 $(Q)$(HOSTCC) $(HOST_LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
87 ifeq ($(COMPILE_ONLY),)
90 $(uclibc_glibc_diff_test)
96 $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) \
97 -fPIC -shared $< -o $@ -Wl,-soname,$@ \
98 $(LDFLAGS) $(EXTRA_LIBS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
102 $(Q)$(RM) *.a *.o *.so *~ core *.out $(TARGETS) $(EXTRA_CLEAN)