Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # Makefile for uClibc
  2. #
  3. # Copyright (C) 2000 by Lineo, inc.
  4. #
  5. # This program is free software; you can redistribute it and/or modify it under
  6. # the terms of the GNU Library General Public License as published by the Free
  7. # Software Foundation; either version 2 of the License, or (at your option) any
  8. # later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but WITHOUT
  11. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Library General Public License
  16. # along with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. # Derived in part from the Linux-8086 C library, the GNU C Library, and several
  20. # other sundry sources. Files within this library are copyright by their
  21. # respective copyright holders.
  22. #--------------------------------------------------------
  23. #
  24. #There are a number of configurable options in "Config"
  25. #
  26. #--------------------------------------------------------
  27. include Rules.mak
  28. DIRS = extra misc pwd_grp stdio string termios net signal stdlib sysdeps unistd
  29. ifeq ($(HAS_MMU),true)
  30. DO_SHARED=shared
  31. endif
  32. all: libc.a $(DO_SHARED) done
  33. libc.a: halfclean headers subdirs
  34. $(CROSS)ranlib libc.a
  35. # Surely there is a better way to do this then dumping all
  36. # the objects into a tmp dir. Please -- someone enlighten me.
  37. shared: libc.a
  38. @rm -rf tmp
  39. @mkdir tmp
  40. @(cd tmp; ar -x ../libc.a)
  41. @(cd tmp; CC=$(CC) /bin/sh ../extra/scripts/get-needed-libgcc-objects.sh)
  42. $(CC) -s -nostdlib -shared -o libuClibc.so.1 -Wl,-soname,libuClibc.so.1 tmp/*.o
  43. @rm -rf tmp
  44. done: libc.a $(DO_SHARED)
  45. @echo
  46. @echo Finally finished compiling...
  47. @echo
  48. halfclean:
  49. @rm -f libc.a libuClibc.so.1 crt0.o
  50. headers: dummy
  51. @rm -f include/asm include/linux include/bits
  52. @ln -s $(KERNEL_SOURCE)/include/asm include/asm
  53. @if [ ! -f include/asm/unistd.h ] ; then \
  54. echo " "; \
  55. echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
  56. echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
  57. echo "correctly. Please edit \`Config' and fix these settings."; \
  58. echo " "; \
  59. /bin/false; \
  60. fi;
  61. @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
  62. echo "WARNING: I bet your x86 system really has an MMU, right?"; \
  63. echo " malloc and friends won't work unless you fix \`Config'"; \
  64. echo " "; \
  65. sleep 10; \
  66. fi;
  67. @ln -s $(KERNEL_SOURCE)/include/linux include/linux
  68. @ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
  69. tags:
  70. ctags -R
  71. clean: subdirs_clean
  72. @rm -rf tmp
  73. rm -f libc.a crt0.o libuClibc.so.1
  74. rm -f include/asm include/linux include/bits
  75. subdirs: $(patsubst %, _dir_%, $(DIRS))
  76. subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) test)
  77. $(patsubst %, _dir_%, $(DIRS)) : dummy
  78. $(MAKE) -C $(patsubst _dir_%, %, $@)
  79. $(patsubst %, _dirclean_%, $(DIRS) test) : dummy
  80. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  81. install:
  82. @if [ `id -u` -ne 0 ]; then \
  83. echo "Aborting install -- You must be root."; \
  84. /bin/false; \
  85. fi;
  86. rm -f $(INSTALL_DIR)/include/asm
  87. rm -f $(INSTALL_DIR)/include/linux
  88. mkdir -p $(INSTALL_DIR)/include/bits
  89. ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
  90. ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
  91. find include/ -type f -depth -print | cpio -pdmu $(INSTALL_DIR)
  92. find include/bits/ -depth -print | cpio -pdmu $(INSTALL_DIR)
  93. rm -f $(INSTALL_DIR)/lib/libc.a
  94. cp libc.a $(INSTALL_DIR)/lib
  95. chmod 644 $(INSTALL_DIR)/lib/libc.a
  96. chown -R root.root $(INSTALL_DIR)/lib/libc.a
  97. if [ -f crt0.o ] ; then \
  98. rm -f $(INSTALL_DIR)/lib/crt0.o; \
  99. cp crt0.o $(INSTALL_DIR)/lib ; \
  100. chmod 644 $(INSTALL_DIR)/lib/crt0.o; \
  101. chown -R root.root $(INSTALL_DIR)/lib/crt0.o; \
  102. fi;
  103. chmod -R 775 `find $(INSTALL_DIR)/include -type d`
  104. chmod -R 644 `find $(INSTALL_DIR)/include -type f`
  105. chown -R root.root $(INSTALL_DIR)/include
  106. .PHONY: dummy