Test.mak 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Common makefile rules for tests
  2. #
  3. # Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
  4. #
  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
  8. # later version.
  9. #
  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
  13. # details.
  14. #
  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
  18. include ../Rules.mak
  19. U_TARGETS := $(TESTS)
  20. G_TARGETS := $(patsubst %,%_glibc,$(U_TARGETS))
  21. U_TARGETS += $(U_TESTS)
  22. G_TARGETS += $(G_TESTS)
  23. TARGETS =
  24. ifeq ($(GLIBC_ONLY),)
  25. TARGETS += $(U_TARGETS)
  26. endif
  27. ifeq ($(UCLIBC_ONLY),)
  28. TARGETS += $(G_TARGETS)
  29. endif
  30. all: $(TARGETS)
  31. $(TARGETS): Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
  32. $(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
  33. $(G_TARGETS): $(patsubst %_glibc,%.c,$(G_TARGETS))
  34. $(U_TARGETS):
  35. -@ echo "----------------------------"
  36. -@ echo "Compiling $@ vs uClibc: "
  37. -@ echo " "
  38. $(CC) $(CFLAGS) -c $@.c -o $@.o
  39. $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  40. $$WRAPPER_$@ ./$@ $$OPTS_$@ ; \
  41. ret=$$? ; \
  42. test -z "$$RET_$@" && export RET_$@=0 ; \
  43. test $$ret -eq $$RET_$@
  44. -@ echo " "
  45. $(G_TARGETS):
  46. -@ echo "----------------------------"
  47. -@ echo "Compiling $@ vs glibc: "
  48. -@ echo " "
  49. $(HOSTCC) $(GLIBC_CFLAGS) -c $(patsubst %_glibc,%,$@).c -o $@.o
  50. $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
  51. $(STRIPTOOL) -x -R .note -R .comment $@
  52. $$WRAPPER_$(patsubst %_glibc,%,$@) ./$@ $$OPTS_$(patsubst %_glibc,%,$@) ; \
  53. ret=$$? ; \
  54. test -z "$$RET_$(patsubst %_glibc,%,$@)" && export RET_$(patsubst %_glibc,%,$@)=0 ; \
  55. test $$ret -eq $$RET_$(patsubst %_glibc,%,$@)
  56. -@ echo " "
  57. clean:
  58. $(RM) *.[oa] *~ core $(TARGETS)