Makefile 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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 libc libcrypt libresolv libutil libm
  31. ifndef $(TARGET_PREFIX)
  32. TARGET_PREFIX = `pwd`/_install
  33. endif
  34. all: headers uClibc_config.h subdirs $(DO_SHARED) done
  35. shared:
  36. @$(MAKE) -C libc shared
  37. ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
  38. @$(MAKE) -C ldso shared
  39. endif
  40. @$(MAKE) -C libcrypt shared
  41. @$(MAKE) -C libutil shared
  42. @$(MAKE) -C libm shared
  43. done: $(DO_SHARED)
  44. @echo
  45. @echo Finally finished compiling...
  46. @echo
  47. headers: dummy
  48. @rm -f include/asm include/linux include/bits
  49. @ln -s $(KERNEL_SOURCE)/include/asm include/asm
  50. @if [ ! -f include/asm/unistd.h ] ; then \
  51. echo " "; \
  52. echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
  53. echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
  54. echo "correctly. Please edit \`Config' and fix these settings."; \
  55. echo " "; \
  56. /bin/false; \
  57. fi;
  58. @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
  59. echo "WARNING: I bet your x86 system really has an MMU, right?"; \
  60. echo " malloc and friends won't work unless you fix \`Config'"; \
  61. echo " "; \
  62. sleep 10; \
  63. fi;
  64. @ln -s $(KERNEL_SOURCE)/include/linux include/linux
  65. @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
  66. (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
  67. make -C libc/sysdeps/linux/$(TARGET_ARCH) headers
  68. uClibc_config.h: Config
  69. @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
  70. @echo "#if !defined __FEATURES_H && !defined __need_uClibc_config_h" >> uClibc_config.h
  71. @echo "#error Never include <bits/uClibc_config.h> directly; use <features.h> instead." >> uClibc_config.h
  72. @echo "#endif" >> uClibc_config.h
  73. @echo "#define linux 1" >> uClibc_config.h
  74. @echo "#define __linux__ 1" >> uClibc_config.h
  75. @if [ "$(HAS_MMU)" = "true" ] ; then \
  76. echo "#define __UCLIBC_HAS_MMU__ 1" >> uClibc_config.h ; \
  77. else \
  78. echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
  79. fi
  80. @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
  81. echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
  82. else \
  83. echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
  84. fi
  85. @if [ "$(HAS_LIBM_FLOAT)" = "true" ] ; then \
  86. echo "#define __UCLIBC_HAS_LIBM_FLOAT__ 1" >> uClibc_config.h ; \
  87. else \
  88. echo "#undef __UCLIBC_HAS_LIBM_FLOAT__" >> uClibc_config.h ; \
  89. fi
  90. @if [ "$(HAS_LIBM_DOUBLE)" = "true" ] ; then \
  91. echo "#define __UCLIBC_HAS_LIBM_DOUBLE__ 1" >> uClibc_config.h ; \
  92. else \
  93. echo "#undef __UCLIBC_HAS_LIBM_DOUBLE__" >> uClibc_config.h ; \
  94. fi
  95. @if [ "$(HAS_LIBM_LONG_DOUBLE)" = "true" ] ; then \
  96. echo "#define __UCLIBC_HAS_LIBM_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
  97. else \
  98. echo "#undef __UCLIBC_HAS_LIBM_LONG_DOUBLE__" >> uClibc_config.h ; \
  99. fi
  100. @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
  101. echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
  102. else \
  103. echo "#undef __UCLIBC_HAS_LONG_LONG__" >> uClibc_config.h ; \
  104. fi
  105. @if [ "$(HAS_LOCALE)" = "true" ] ; then \
  106. echo "#define __UCLIBC_HAS_LOCALE__ 1" >> uClibc_config.h ; \
  107. echo "#define __UCLIBC_LOCALE_DIR \""$(LOCALE_DIR)"\"" >> uClibc_config.h ; \
  108. else \
  109. echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
  110. fi
  111. @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
  112. echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
  113. if [ `expr match "$(CC)" ".*\(m68k-elf-.*\)"`x = x ]; then \
  114. echo "#define const" >> uClibc_config.h ; \
  115. echo "#define __const" >> uClibc_config.h ; \
  116. echo "#define __extension" >> uClibc_config.h ; \
  117. fi; \
  118. else \
  119. echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
  120. fi
  121. @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
  122. echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
  123. else \
  124. echo "#undef NO_UNDERSCORES" >> uClibc_config.h ; \
  125. fi
  126. @if [ "$(INCLUDE_RPC)" = "true" ] ; then \
  127. echo "#define __UCLIBC_HAS_RPC__ 1" >> uClibc_config.h ; \
  128. else \
  129. echo "#undef __UCLIBC_HAS_RPC__" >> uClibc_config.h ; \
  130. fi
  131. subdirs: $(patsubst %, _dir_%, $(DIRS))
  132. $(patsubst %, _dir_%, $(DIRS)) : dummy
  133. $(MAKE) -C $(patsubst _dir_%, %, $@)
  134. tags:
  135. ctags -R
  136. install: install_dev
  137. # Installs shared libraries for a target.
  138. install_target:
  139. ifeq ($(DO_SHARED),shared)
  140. install -d $(TARGET_PREFIX)$(ROOT_DIR)/lib
  141. cp -fa lib/*.so* $(TARGET_PREFIX)$(ROOT_DIR)/lib;
  142. endif
  143. ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
  144. install -d $(TARGET_PREFIX)$(ROOT_DIR)/etc
  145. install -d $(TARGET_PREFIX)$(ROOT_DIR)/sbin
  146. install -d $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
  147. cp -f ldso/util/ldd $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
  148. cp -f ldso/util/ldconfig $(TARGET_PREFIX)$(ROOT_DIR)/sbin
  149. # -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
  150. endif
  151. # Installs development library and headers
  152. # This is done with the assumption that it can blow away anything
  153. # in $(DEVEL_PREFIX)$(ROOT_DIR)/include. Probably true only if you're using
  154. # a packaging system.
  155. install_dev:
  156. ifeq ($(DO_SHARED),shared)
  157. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/lib
  158. cp -fa lib/*.so* $(DEVEL_PREFIX)$(ROOT_DIR)/lib;
  159. endif
  160. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib
  161. cp -fa lib/*.[ao] $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib;
  162. ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
  163. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
  164. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
  165. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
  166. cp -f ldso/util/ldd $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
  167. cp -f ldso/util/ldconfig $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
  168. # -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
  169. endif
  170. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
  171. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include
  172. install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits
  173. rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
  174. rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
  175. ln -s $(KERNEL_SOURCE)/include/asm $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
  176. ln -s $(KERNEL_SOURCE)/include/linux $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
  177. find include/ -type f -depth -not -path "*CVS*" -exec install \
  178. -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
  179. find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
  180. -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
  181. install -m 644 include/bits/uClibc_config.h $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits/
  182. $(MAKE) -C extra/gcc-uClibc install
  183. clean:
  184. @rm -rf tmp lib
  185. - find include -type l -exec rm -f {} \;
  186. - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
  187. ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
  188. make -C ldso clean
  189. endif
  190. .PHONY: dummy subdirs