Makefile 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000, 2001 by Lineo, inc.
  4. # Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  5. #
  6. # This program is free software; you can redistribute it and/or modify it under
  7. # the terms of the GNU Library General Public License as published by the Free
  8. # Software Foundation; either version 2 of the License, or (at your option) any
  9. # later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but WITHOUT
  12. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  13. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  14. # details.
  15. #
  16. # You should have received a copy of the GNU Library General Public License
  17. # along with this program; if not, write to the Free Software Foundation, Inc.,
  18. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. #
  20. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  21. # other sundry sources. Files within this library are copyright by their
  22. # respective copyright holders.
  23. #--------------------------------------------------------
  24. #
  25. #There are a number of configurable options in "Config"
  26. #
  27. #--------------------------------------------------------
  28. TOPDIR=./
  29. include Rules.mak
  30. DIRS = extra ldso libc libcrypt libutil libm
  31. all: headers uClibc_config.h subdirs $(DO_SHARED) done
  32. shared:
  33. @$(MAKE) -C libc shared
  34. @$(MAKE) -C ldso shared
  35. @$(MAKE) -C libcrypt shared
  36. @$(MAKE) -C libutil shared
  37. @$(MAKE) -C libm shared
  38. done: $(DO_SHARED)
  39. @echo
  40. @echo Finally finished compiling...
  41. @echo
  42. headers: dummy
  43. @rm -f include/asm include/linux include/bits
  44. @ln -s $(KERNEL_SOURCE)/include/asm include/asm
  45. @if [ ! -f include/asm/unistd.h ] ; then \
  46. echo " "; \
  47. echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
  48. echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
  49. echo "correctly. Please edit \`Config' and fix these settings."; \
  50. echo " "; \
  51. /bin/false; \
  52. fi;
  53. @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
  54. echo "WARNING: I bet your x86 system really has an MMU, right?"; \
  55. echo " malloc and friends won't work unless you fix \`Config'"; \
  56. echo " "; \
  57. sleep 10; \
  58. fi;
  59. @ln -s $(KERNEL_SOURCE)/include/linux include/linux
  60. @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
  61. (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
  62. uClibc_config.h: Config
  63. @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
  64. @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
  65. @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
  66. @echo "#endif" >> uClibc_config.h
  67. @echo "#define linux 1" >> uClibc_config.h
  68. @echo "#define __linux__ 1" >> uClibc_config.h
  69. @if [ "$(HAS_MMU)" = "true" ] ; then \
  70. echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
  71. else \
  72. echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
  73. fi
  74. @if [ "$(HAS_FLOATS)" = "true" ] ; then \
  75. echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
  76. else \
  77. echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
  78. fi
  79. @if [ "$(HAS_DOUBLE)" = "true" ] ; then \
  80. echo "#define __UCLIBC_HAS_DOUBLE__ 1" >> uClibc_config.h ; \
  81. else \
  82. echo "#undef __UCLIBC_HAS_DOUBLE__" >> uClibc_config.h ; \
  83. fi
  84. @if [ "$(HAS_LONG_DOUBLE)" = "true" ] ; then \
  85. echo "#define __UCLIBC_HAS_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
  86. else \
  87. echo "#undef __UCLIBC_HAS_LONG_DOUBLE__" >> uClibc_config.h ; \
  88. fi
  89. @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
  90. echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
  91. else \
  92. echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
  93. fi
  94. @if [ "$(HAS_LOCALE)" = "true" ] ; then \
  95. echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
  96. echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
  97. else \
  98. echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
  99. fi
  100. @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
  101. echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
  102. if [ `expr match "$(CC)" ".*\(m68k-elf-.*\)"`x = x ]; then \
  103. echo "#define const" >> uClibc_config.h ; \
  104. echo "#define __const" >> uClibc_config.h ; \
  105. echo "#define __extension" >> uClibc_config.h ; \
  106. fi; \
  107. else \
  108. echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
  109. fi
  110. @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
  111. echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
  112. else \
  113. echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
  114. fi
  115. @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
  116. echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
  117. else \
  118. echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
  119. fi
  120. subdirs: $(patsubst %, _dir_%, $(DIRS))
  121. $(patsubst %, _dir_%, $(DIRS)) : dummy
  122. $(MAKE) -C $(patsubst _dir_%, %, $@)
  123. tags:
  124. ctags -R
  125. install: install_runtime install_dev
  126. # Installs shared library
  127. install_runtime:
  128. install -d $(INSTALL_DIR)/lib
  129. cp -fa lib/* $(INSTALL_DIR)/lib;
  130. #ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
  131. ln -sf $(INSTALL_DIR)/lib/$(UCLIBC_LDSO) /lib/$(UCLIBC_LDSO);
  132. install -d $(INSTALL_DIR)/etc
  133. ldso/util/ldconfig
  134. #endif
  135. # Installs development library and headers
  136. # This is done with the assumption that it can blow away anything
  137. # in $(INSTALL_DIR)/include. Probably true only if you're using
  138. # a packaging system.
  139. install_dev:
  140. install -d $(INSTALL_DIR)/include
  141. install -d $(INSTALL_DIR)/include/bits
  142. rm -f $(INSTALL_DIR)/include/asm
  143. rm -f $(INSTALL_DIR)/include/linux
  144. ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
  145. ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
  146. find include/ -type f -depth -not -path "*CVS*" -exec install \
  147. -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
  148. find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
  149. -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
  150. install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
  151. $(MAKE) -C extra/gcc-uClibc install
  152. clean:
  153. @rm -rf tmp lib
  154. rm -f include/asm include/linux include/bits uClibc_config.h
  155. - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
  156. .PHONY: dummy subdirs