Rules.mak 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Rules.mak for uClibc-ng-test subdirs
  2. # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  3. .SUFFIXES:
  4. top_builddir ?= ../
  5. abs_top_builddir ?= $(shell cd $(top_builddir); pwd)/
  6. TESTDIR=$(top_builddir)test/
  7. include $(top_srcdir)Rules.mak
  8. #--------------------------------------------------------
  9. # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
  10. LC_ALL:= C
  11. export LC_ALL
  12. ifeq ($(strip $(TARGET_ARCH)),)
  13. TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
  14. -e 's/i.86/i386/' \
  15. -e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \
  16. -e 's/sa110/arm/' -e 's/arm.*/arm/g' \
  17. -e 's/m68k.*/m68k/' \
  18. -e 's/parisc.*/hppa/' \
  19. -e 's/ppc/powerpc/g' \
  20. -e 's/sh[234].*/sh/' \
  21. -e 's/microblaze.*/microblaze/' \
  22. -e 's/mips.*/mips/' \
  23. -e 's/cris.*/cris/' \
  24. -e 's/xtensa.*/xtensa/' \
  25. )
  26. endif
  27. export TARGET_ARCH
  28. RM_R = $(Q)$(RM) -r
  29. LN_S = $(Q)$(LN) -fs
  30. XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE
  31. XWARNINGS += $(CFLAG_-Wstrict-prototypes)
  32. CFLAGS ?=
  33. CFLAGS += $(XCOMMON_CFLAGS)
  34. CFLAGS += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS)
  35. $(eval $(call check-gcc-var,-Wno-missing-field-initializers))
  36. CFLAGS += $(CFLAG_-Wno-missing-field-initializers)
  37. # Can't add $(OPTIMIZATION) here, it may be target-specific.
  38. # Just adding -Os for now.
  39. HOST_CFLAGS += $(XCOMMON_CFLAGS) -Os $(XWARNINGS) -std=gnu99
  40. #LDFLAGS := $(CPU_LDFLAGS-y) -Wl,-z,now
  41. #LDFLAGS += -Wl,-rpath,$(shell pwd)
  42. ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
  43. CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
  44. endif
  45. ifneq ($(strip $(UCLIBC_EXTRA_LDFLAGS)),"")
  46. LDFLAGS += $(call qstrip,$(UCLIBC_EXTRA_LDFLAGS))
  47. endif
  48. ifneq ($(findstring -s,$(MAKEFLAGS)),)
  49. DISP := sil
  50. Q := @
  51. SCAT := -@true
  52. else
  53. ifneq ($(V)$(VERBOSE),)
  54. DISP := ver
  55. Q :=
  56. SCAT := cat
  57. else
  58. DISP := pur
  59. Q := @
  60. SCAT := -@true
  61. endif
  62. endif
  63. ifneq ($(Q),)
  64. MAKEFLAGS += --no-print-directory
  65. endif
  66. banner := ---------------------------------
  67. pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
  68. pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
  69. pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
  70. pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $(@:.exe=)
  71. sil_showclean =
  72. sil_showdiff = true
  73. sil_showlink = true
  74. sil_showtest = true
  75. ver_showclean =
  76. ver_showdiff = true echo
  77. ver_showlink = true echo
  78. ver_showtest = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n"
  79. do_showclean = $($(DISP)_showclean)
  80. do_showdiff = $($(DISP)_showdiff)
  81. do_showlink = $($(DISP)_showlink)
  82. do_showtest = $($(DISP)_showtest)
  83. showclean = @$(do_showclean)
  84. showdiff = @$(do_showdiff)
  85. showlink = @$(do_showlink)
  86. showtest = @$(do_showtest)