Rules.mak 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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) -nostdinc $(CPUFLAGS) -Dlinux -D__linux__ -I$(TOPDIR)include -I$(GCCINCDIR) -I. -D__PIC__ -D__LIBC__
  66. CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS) -fpic
  67. ifeq ($(DODEBUG),true)
  68. CFLAGS += -Wall -g -D__PIC__
  69. LDFLAGS = -nostdlib
  70. else
  71. CFLAGS += -Wall -D__PIC__ #-fomit-frame-pointer
  72. LDFLAGS = -s -nostdlib
  73. endif
  74. ifndef $(PREFIX)
  75. PREFIX = `pwd`/_install
  76. endif
  77. ifneq ($(HAS_MMU),true)
  78. CFLAGS += -D__HAS_NO_MMU__
  79. endif
  80. ifneq ($(HAS_FLOATS),true)
  81. CFLAGS += -D__HAS_NO_FLOATS__
  82. endif
  83. ifneq ($(DO_FIXME_STUFF),true)
  84. CFLAGS += -DFIXME
  85. endif
  86. # Use '-ffunction-sections -fdata-sections' and '--gc-sections' if they work
  87. # to try and strip out any unused junk automagically....
  88. #
  89. ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \
  90. -o /dev/null -xc /dev/null && $(LD) --gc-sections -v >/dev/null && echo 1),1)
  91. CFLAGS += -ffunction-sections -fdata-sections
  92. LDFLAGS += --gc-sections
  93. endif