Rules.mak 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Rules.make for uClibc test apps.
  2. #
  3. # Copyright (C) 2001 by Lineo, inc.
  4. #
  5. #
  6. #Note: This does not read the top level Rules.mak file
  7. #
  8. -include $(TESTDIR)../.config
  9. include $(TESTDIR)Config
  10. # Use NATIVE_ARCH here since running these test is not
  11. # even possible when cross compiling...
  12. NATIVE_ARCH:= $(shell uname -m | sed \
  13. -e 's/i.86/i386/' \
  14. -e 's/sparc.*/sparc/' \
  15. -e 's/arm.*/arm/g' \
  16. -e 's/m68k.*/m68k/' \
  17. -e 's/ppc/powerpc/g' \
  18. -e 's/v850.*/v850/g' \
  19. -e 's/sh[234].*/sh/' \
  20. -e 's/mips.*/mips/' \
  21. )
  22. ifeq ($(strip $(TARGET_ARCH)),)
  23. TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
  24. -e 's/i.86/i386/' \
  25. -e 's/sparc.*/sparc/' \
  26. -e 's/arm.*/arm/g' \
  27. -e 's/m68k.*/m68k/' \
  28. -e 's/ppc/powerpc/g' \
  29. -e 's/v850.*/v850/g' \
  30. -e 's/sh[234]/sh/' \
  31. -e 's/mips-.*/mips/' \
  32. -e 's/mipsel-.*/mipsel/' \
  33. -e 's/cris.*/cris/' \
  34. )
  35. endif
  36. export TARGET_ARCH
  37. # If you are running a cross compiler, you may want to set this
  38. # to something more interesting...
  39. CC = ../$(TESTDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
  40. HOST_CC = gcc
  41. STRIPTOOL=strip
  42. LDD = ../$(TESTDIR)ldso/util/ldd
  43. # Check if 'ls -sh' works or not
  44. LSFLAGS = -l
  45. # turn all the warnings on
  46. WARNINGS=-Wall
  47. # use '-Os' optimization if available, else use -O2
  48. OPTIMIZATION = ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
  49. then echo "-Os"; else echo "-O2" ; fi}
  50. ifeq ($(DODEBUG),true)
  51. CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -g
  52. GLIBC_CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -g
  53. LDFLAGS =-Wl,-warn-common
  54. GLIBC_LDFLAGS =-Wl,-warn-common
  55. STRIPTOOL =true -Since_we_are_debugging
  56. else
  57. CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer
  58. GLIBC_CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer
  59. LDFLAGS =-s -Wl,-warn-common
  60. GLIBC_LDFLAGS =-s -Wl,-warn-common
  61. STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
  62. endif
  63. ifneq ($(DODYNAMIC),true)
  64. LDFLAGS +=--static
  65. GLIBC_LDFLAGS +=--static
  66. endif
  67. CFLAGS+=--uclibc-use-build-dir
  68. LDFLAGS+=--uclibc-use-build-dir