Rules.mak 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. }
  33. endif
  34. # If you are running a cross compiler, you may want to set this
  35. # to something more interesting...
  36. CC = ../$(TESTDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
  37. HOST_CC = gcc
  38. STRIPTOOL=strip
  39. LDD = ../$(TESTDIR)ldso/util/ldd
  40. # Check if 'ls -sh' works or not
  41. LSFLAGS = -l
  42. # turn all the warnings on
  43. WARNINGS=-Wall
  44. # use '-Os' optimization if available, else use -O2
  45. OPTIMIZATION = ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
  46. then echo "-Os"; else echo "-O2" ; fi}
  47. ifeq ($(DODEBUG),true)
  48. CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -g
  49. GLIBC_CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -g
  50. LDFLAGS =-Wl,-warn-common
  51. GLIBC_LDFLAGS =-Wl,-warn-common
  52. STRIPTOOL =true -Since_we_are_debugging
  53. else
  54. CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer
  55. GLIBC_CFLAGS +=$(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer
  56. LDFLAGS =-s -Wl,-warn-common
  57. GLIBC_LDFLAGS =-s -Wl,-warn-common
  58. STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
  59. endif
  60. ifneq ($(DODYNAMIC),true)
  61. LDFLAGS +=--static
  62. GLIBC_LDFLAGS +=--static
  63. endif
  64. CFLAGS+=--uclibc-use-build-dir
  65. LDFLAGS+=--uclibc-use-build-dir