Rules.mak 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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/nds32.*/nds32/' \
  19. -e 's/parisc.*/hppa/' \
  20. -e 's/ppc/powerpc/g' \
  21. -e 's/sh[234].*/sh/' \
  22. -e 's/microblaze.*/microblaze/' \
  23. -e 's/mips.*/mips/' \
  24. -e 's/cris.*/cris/' \
  25. -e 's/xtensa.*/xtensa/' \
  26. )
  27. endif
  28. export TARGET_ARCH
  29. RM_R = $(Q)$(RM) -r
  30. LN_S = $(Q)$(LN) -fs
  31. XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE
  32. XWARNINGS += $(CFLAG_-Wstrict-prototypes)
  33. CFLAGS ?=
  34. CFLAGS += $(XCOMMON_CFLAGS)
  35. CFLAGS += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS)
  36. $(eval $(call check-gcc-var,-Wno-missing-field-initializers))
  37. CFLAGS += $(CFLAG_-Wno-missing-field-initializers)
  38. # Can't add $(OPTIMIZATION) here, it may be target-specific.
  39. # Just adding -Os for now.
  40. HOST_CFLAGS += $(XCOMMON_CFLAGS) -Os $(XWARNINGS) -std=gnu99
  41. #LDFLAGS := $(CPU_LDFLAGS-y) -Wl,-z,now
  42. #LDFLAGS += -Wl,-rpath,$(shell pwd)
  43. ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"")
  44. CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS))
  45. endif
  46. ifneq ($(strip $(UCLIBC_EXTRA_LDFLAGS)),"")
  47. LDFLAGS += $(call qstrip,$(UCLIBC_EXTRA_LDFLAGS))
  48. endif
  49. ifneq ($(findstring -s,$(MAKEFLAGS)),)
  50. DISP := sil
  51. Q := @
  52. SCAT := -@true
  53. else
  54. ifneq ($(V)$(VERBOSE),)
  55. DISP := ver
  56. Q :=
  57. SCAT := cat
  58. else
  59. DISP := pur
  60. Q := @
  61. SCAT := -@true
  62. endif
  63. endif
  64. ifneq ($(Q),)
  65. MAKEFLAGS += --no-print-directory
  66. endif
  67. banner := ---------------------------------
  68. pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
  69. pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
  70. pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
  71. pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $(@:.exe=)
  72. sil_showclean =
  73. sil_showdiff = true
  74. sil_showlink = true
  75. sil_showtest = true
  76. ver_showclean =
  77. ver_showdiff = true echo
  78. ver_showlink = true echo
  79. ver_showtest = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n"
  80. do_showclean = $($(DISP)_showclean)
  81. do_showdiff = $($(DISP)_showdiff)
  82. do_showlink = $($(DISP)_showlink)
  83. do_showtest = $($(DISP)_showtest)
  84. showclean = @$(do_showclean)
  85. showdiff = @$(do_showdiff)
  86. showlink = @$(do_showlink)
  87. showtest = @$(do_showtest)