Makefile 6.6 KB

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