Rules.mak 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Rules.make for uCLibc
  2. #
  3. # This file contains rules which are shared between multiple Makefiles.
  4. # Feel free to adjust to taste...
  5. # -Erik Andersen <andersen@lineo.com> < andersee@debian.org>
  6. #
  7. # Copyright (C) 2000 by Lineo, inc.
  8. #
  9. # This program is free software; you can redistribute it and/or modify it under
  10. # the terms of the GNU Library General Public License as published by the Free
  11. # Software Foundation; either version 2 of the License, or (at your option) any
  12. # later version.
  13. #
  14. # This program is distributed in the hope that it will be useful, but WITHOUT
  15. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  17. # details.
  18. #
  19. # You should have received a copy of the GNU General Public License along with
  20. # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  21. # Place, Suite 330, Boston, MA 02111-1307 USA
  22. #
  23. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  24. # other sundry sources. Files within this library are copyright by their
  25. # respective copyright holders.
  26. PROG := libc.a
  27. VERSION := 0.95
  28. BUILDTIME := $(shell TZ=UTC date --utc "+%Y.%m.%d-%H:%M%z")
  29. export VERSION
  30. # Set the following to `true' to make a debuggable build.
  31. # Do not enable this for production builds...
  32. DODEBUG = false
  33. # This specifies which malloc implementation is used.
  34. # "malloc-simple" is very, very small, but is also very, very dumb
  35. # and does not try to make good use of memory or clean up after itself.
  36. # "malloc" on the other hand is a bit bigger, but is pretty smart thereby
  37. # minimizing memory wastage and reusing already allocated memory. This
  38. # can be lots faster and safer IMHO.
  39. #MALLOC = malloc-simple
  40. MALLOC = malloc
  41. # If you want large file summit support (greater then 2 Gib),
  42. # turn this on. This has no effect unless your kernel supports
  43. # lfs. This surrently does nothing...
  44. DOLFS = false
  45. # Enable stuff that is broken (to fix it of course....)
  46. DO_FIXME_STUFF = true
  47. # Disable this if your CPU has a memory management unit (MMU)
  48. HAS_MMU = true
  49. # Disable this if your CPU has a floating point unit (FPU)
  50. HAS_FLOATS = true
  51. # Use C functions instead of macros for ctype.h stuff
  52. # This should generally stay false...
  53. USE_CTYPE_C_FUNCTIONS = false
  54. # If you are running a cross compiler, you may want to set this
  55. # to something more interesting...
  56. CROSS = #powerpc-linux-
  57. CC = $(CROSS)gcc
  58. STRIPTOOL = $(CROSS)strip
  59. # Figure out what arch to build...
  60. ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g')
  61. #--------------------------------------------------------
  62. # Nothing beyond this point should need be touched by mere
  63. # mortals so you should probably leave this stuff alone.
  64. #--------------------------------------------------------
  65. GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
  66. ARFLAGS=r
  67. CCFLAGS=$(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) -Dlinux -D__linux__ -I$(TOPDIR)include -I$(GCCINCDIR) -I. -D__LIBC__
  68. # Figure out what arch to build...
  69. ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g')
  70. ifeq ($(ARCH), arm)
  71. ARCH_CFLAGS=-fpic
  72. endif
  73. CFLAGS=$(ARCH_CFLAGS) $(CCFLAGS) $(DEFS)
  74. ifeq ($(DODEBUG),true)
  75. CFLAGS += -Wall -g
  76. LDFLAGS = -nostdlib
  77. else
  78. CFLAGS += -Wall #-fomit-frame-pointer
  79. LDFLAGS = -s -nostdlib
  80. endif
  81. ifndef $(PREFIX)
  82. PREFIX = `pwd`/_install
  83. endif
  84. ifneq ($(HAS_MMU),true)
  85. CFLAGS += -D__HAS_NO_MMU__
  86. endif
  87. ifneq ($(HAS_FLOATS),true)
  88. CFLAGS += -D__HAS_NO_FLOATS__
  89. endif
  90. ifneq ($(DO_FIXME_STUFF),true)
  91. CFLAGS += -DFIXME
  92. endif
  93. # Use '-ffunction-sections -fdata-sections' and '--gc-sections' if they work
  94. # to try and strip out any unused junk automagically....
  95. #
  96. ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \
  97. -o /dev/null -xc /dev/null && $(LD) --gc-sections -v >/dev/null && echo 1),1)
  98. CFLAGS += -ffunction-sections -fdata-sections
  99. LDFLAGS += --gc-sections
  100. endif