Rules.mak 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. # Disable this if your CPU has a memory management unit (MMU)
  46. HAS_MMU = true
  47. # Disable this if your CPU has a floating point unit (FPU)
  48. HAS_FLOATS = true
  49. # If you are running a cross compiler, you may want to set this
  50. # to something more interesting...
  51. CROSS = #powerpc-linux-
  52. CC = $(CROSS)gcc
  53. STRIPTOOL = $(CROSS)strip
  54. #--------------------------------------------------------
  55. # Nothing beyond this point should need be touched by mere
  56. # mortals so you should probably leave this stuff alone.
  57. #--------------------------------------------------------
  58. GCCINCDIR = $(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
  59. ARFLAGS=r
  60. CCFLAGS= $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) -Dlinux -D__linux__ -I$(TOPDIR)include -I$(GCCINCDIR) -I. -D__PIC__ -D__LIBC__
  61. CFLAGS=$(ARCH) $(CCFLAGS) $(DEFS)
  62. ifeq ($(DODEBUG),true)
  63. CFLAGS += -Wall -g -D__PIC__
  64. LDFLAGS = -nostdlib
  65. else
  66. CFLAGS += -Wall -D__PIC__ #-fomit-frame-pointer
  67. LDFLAGS = -s -nostdlib
  68. endif
  69. ifndef $(PREFIX)
  70. PREFIX = `pwd`/_install
  71. endif
  72. ifneq ($(HAS_MMU),true)
  73. CFLAGS += -D__HAS_NO_MMU__
  74. endif
  75. ifneq ($(HAS_FLOATS),true)
  76. CFLAGS += -D__HAS_NO_FLOATS__
  77. endif
  78. # Use '-ffunction-sections -fdata-sections' and '--gc-sections' if they work
  79. # to try and strip out any unused junk automagically....
  80. #
  81. ifeq ($(shell $(CC) -ffunction-sections -fdata-sections -S \
  82. -o /dev/null -xc /dev/null && $(LD) --gc-sections -v >/dev/null && echo 1),1)
  83. CFLAGS += -ffunction-sections -fdata-sections
  84. LDFLAGS += --gc-sections
  85. endif