Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 = misc pwd_grp stdio string termios unistd net signal stdlib sysdeps extra
  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. $(CC) -s -nostdlib -shared -o libuClibc.so.1 -Wl,-soname,libuClibc.so.1 tmp/*.o
  42. @rm -rf tmp
  43. done: libc.a $(DO_SHARED)
  44. @echo
  45. @echo Finally finished compiling...
  46. @echo
  47. halfclean:
  48. @rm -f libc.a libuClibc.so.1 crt0.o
  49. headers: dummy
  50. @rm -f include/asm include/linux include/bits
  51. @ln -s $(KERNEL_SOURCE)/include/asm include/asm
  52. @if [ ! -f include/asm/unistd.h ] ; then \
  53. echo " "; \
  54. echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
  55. echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
  56. echo "correctly. Please edit \`Config' and fix these settings."; \
  57. echo " "; \
  58. /bin/false; \
  59. fi;
  60. @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
  61. echo "WARNING: I bet your x86 system really has an MMU, right?"; \
  62. echo " malloc and friends won't work unless you fix \`Config'"; \
  63. echo " "; \
  64. sleep 10; \
  65. fi;
  66. @ln -s $(KERNEL_SOURCE)/include/linux include/linux
  67. @ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
  68. tags:
  69. ctags -R
  70. clean: subdirs_clean
  71. @rm -rf tmp
  72. rm -f libc.a crt0.o libuClibc.so.1
  73. rm -f include/asm include/linux include/bits
  74. subdirs: $(patsubst %, _dir_%, $(DIRS))
  75. subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) test)
  76. $(patsubst %, _dir_%, $(DIRS)) : dummy
  77. $(MAKE) -C $(patsubst _dir_%, %, $@)
  78. $(patsubst %, _dirclean_%, $(DIRS) test) : dummy
  79. $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
  80. install:
  81. @if [ `id -u` -ne 0 ]; then \
  82. echo "aborting install -- you are not root."; \
  83. /bin/false; \
  84. fi;
  85. rm -f $(INSTALL_DIR)/include/asm
  86. rm -f $(INSTALL_DIR)/include/linux
  87. mkdir -p $(INSTALL_DIR)/include/bits
  88. ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
  89. ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
  90. find include/ -type f -depth -print | cpio -pdmu $(INSTALL_DIR)
  91. find include/bits/ -depth -print | cpio -pdmu $(INSTALL_DIR)
  92. rm -f $(INSTALL_DIR)/lib/libc.a
  93. cp libc.a $(INSTALL_DIR)/lib
  94. chmod 644 $(INSTALL_DIR)/lib/libc.a
  95. chown -R root.root $(INSTALL_DIR)/lib/libc.a
  96. if [ -f crt0.o ] ; then \
  97. rm -f $(INSTALL_DIR)/lib/crt0.o; \
  98. cp crt0.o $(INSTALL_DIR)/lib ; \
  99. chmod 644 $(INSTALL_DIR)/lib/crt0.o; \
  100. chown -R root.root $(INSTALL_DIR)/lib/crt0.o; \
  101. fi;
  102. chmod -R 775 `find $(INSTALL_DIR)/include -type d`
  103. chmod -R 644 `find $(INSTALL_DIR)/include -type f`
  104. chown -R root.root $(INSTALL_DIR)/include
  105. .PHONY: dummy