Rules.mak 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #--------------------------------------------------------
  60. # Nothing beyond this point should need be touched by mere
  61. # mortals so you should probably leave this stuff alone.
  62. #--------------------------------------------------------
  63. GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
  64. ARFLAGS=r
  65. CCFLAGS=$(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) -Dlinux -D__linux__ -I$(TOPDIR)include -I$(GCCINCDIR) -I. -D__LIBC__
  66. # Figure out what arch to build...
  67. ARCH = $(shell uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/' -e 's/arm.*/arm/g')
  68. ifeq ($(ARCH), arm)
  69. ARCH_CFLAGS=-fpic
  70. endif
  71. CFLAGS=$(ARCH_CFLAGS) $(CCFLAGS) $(DEFS)
  72. ifeq ($(DODEBUG),true)
  73. CFLAGS += -Wall -g
  74. LDFLAGS = -nostdlib
  75. else
  76. CFLAGS += -Wall #-fomit-frame-pointer
  77. LDFLAGS = -s -nostdlib
  78. endif
  79. ifndef $(PREFIX)
  80. PREFIX = `pwd`/_install
  81. endif
  82. ifneq ($(HAS_MMU),true)
  83. CFLAGS += -D__HAS_NO_MMU__
  84. endif
  85. ifneq ($(HAS_FLOATS),true)
  86. CFLAGS += -D__HAS_NO_FLOATS__
  87. endif
  88. ifneq ($(DO_FIXME_STUFF),true)
  89. CFLAGS += -DFIXME
  90. endif
  91. # Use '-ffunction-sections -fdata-sections' and '--gc-sections' if they work
  92. # to try and strip out any unused junk automagically....
  93. #
  94. ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \
  95. -o /dev/null -xc /dev/null && $(LD) --gc-sections -v >/dev/null && echo 1),1)
  96. CFLAGS += -ffunction-sections -fdata-sections
  97. LDFLAGS += --gc-sections
  98. endif