Test.mak 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 = $(U_TARGETS) $(G_TARGETS)
  24. all: $(TARGETS)
  25. $(TARGETS): Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
  26. $(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
  27. $(G_TARGETS): $(patsubst %_glibc,%.c,$(G_TARGETS))
  28. $(U_TARGETS):
  29. -@ echo "----------------------------"
  30. -@ echo "Compiling $@ vs uClibc: "
  31. -@ echo " "
  32. $(CC) $(CFLAGS) -c $@.c -o $@.o
  33. $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
  34. $$WRAPPER_$@ ./$@ $$OPTS_$@ ; \
  35. ret=$$? ; \
  36. test -z "$$RET_$@" && export RET_$@=0 ; \
  37. test $$ret -eq $$RET_$@
  38. -@ echo " "
  39. $(G_TARGETS):
  40. -@ echo "----------------------------"
  41. -@ echo "Compiling $@ vs glibc: "
  42. -@ echo " "
  43. $(HOSTCC) $(GLIBC_CFLAGS) -c $(patsubst %_glibc,%,$@).c -o $@.o
  44. $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
  45. $(STRIPTOOL) -x -R .note -R .comment $@
  46. $$WRAPPER_$(patsubst %_glibc,%,$@) ./$@ $$OPTS_$(patsubst %_glibc,%,$@) ; \
  47. ret=$$? ; \
  48. test -z "$$RET_$(patsubst %_glibc,%,$@)" && export RET_$(patsubst %_glibc,%,$@)=0 ; \
  49. test $$ret -eq $$RET_$(patsubst %_glibc,%,$@)
  50. -@ echo " "
  51. clean:
  52. $(RM) *.[oa] *~ core $(TARGETS)