Makefile 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. # Makefile for a simple busybox/uClibc root filesystem
  2. #
  3. # Copyright (C) 2001-2003 Erik Andersen <andersen@codepoet.org>
  4. # Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU Library General Public License as
  8. # published by the Free Software Foundation; either version 2 of the
  9. # License, or (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  19. # USA
  20. TARGETS=
  21. #############################################################
  22. #
  23. # EDIT this stuff to suit your system and preferences
  24. #
  25. # Use := when possible to get precomputation, thereby
  26. # speeding up the build process.
  27. #
  28. #############################################################
  29. # What sortof target system shall we compile this for?
  30. ARCH:=i386
  31. #ARCH:=arm
  32. #ARCH:=powerpc
  33. #ARCH:=whatever
  34. # enable to build a native gcc toolchain with uclibc support
  35. USE_UCLIBC_TOOLCHAIN:=true
  36. # If you are building a native gcc toolchain, do you want to
  37. # build the old gcc-2.95 based toolchain, or would you prefer
  38. # a nice and shiny new gcc-3.2.1 toolchain?
  39. GCC_2_95_TOOLCHAIN:=false
  40. # Enable this to use the uClibc daily snapshot instead of a released
  41. # version. Daily snapshots may contain new features and bugfixes. Or
  42. # they may not even compile at all, depending on what Erik is doing...
  43. USE_UCLIBC_SNAPSHOT:=false
  44. # Enable this to use the busybox daily snapshot instead of a released
  45. # version. Daily snapshots may contain new features and bugfixes. Or
  46. # they may not even compile at all....
  47. USE_BUSYBOX_SNAPSHOT:=false
  48. # Enable large file (files > 2 GB) support
  49. BUILD_WITH_LARGEFILE:=true
  50. # Command used to download source code
  51. WGET:=wget --passive-ftp
  52. # Optimize toolchain for which type of CPU?
  53. OPTIMIZE_FOR_CPU=$(ARCH)
  54. #OPTIMIZE_FOR_CPU=i486
  55. #OPTIMIZE_FOR_CPU=strongarm
  56. #OPTIMIZE_FOR_CPU=whatever
  57. # Any additional gcc options you may want to include....
  58. EXTRA_GCC_CONFIG_OPTIONS=
  59. #EXTRA_GCC_CONFIG_OPTIONS=--without-float
  60. #############################################################
  61. #
  62. # The list of stuff to build for the target filesystem
  63. #
  64. #############################################################
  65. # The toolchain comes next if we are building one
  66. ifeq ($(USE_UCLIBC_TOOLCHAIN),true)
  67. TARGETS+=uclibc_toolchain
  68. endif
  69. # Do you want user mode Linux (x86 only), or are you building a
  70. # real kernel # that will run on its own? Perhaps you have a
  71. # kernel you have already configured and you want to use that?
  72. #TARGETS+=linux
  73. #TARGETS+=user-mode-linux
  74. TARGETS+=system-linux
  75. # The default minimal set
  76. TARGETS+=busybox tinylogin
  77. # Openssh...
  78. #TARGETS+=zlib openssl openssh
  79. # Everything needed to build a full uClibc development system!
  80. #TARGETS+=coreutils findutils bash make diffutils patch sed
  81. #TARGETS+=ed flex bison file gawk tar grep gcc_target
  82. # Of course, if you are installing a development system, you
  83. # may want some header files so you can compile stuff....
  84. #TARGETS+=ncurses-headers zlib-headers openssl-headers
  85. # More development system stuff for those that want it
  86. #TARGETS+=m4 autoconf automake libtool
  87. # Some nice debugging tools
  88. #TARGETS+=gdb strace
  89. # The Valgrind debugger (x86 only)
  90. #TARGETS+=valgrind
  91. # Some stuff for access points and firewalls
  92. #TARGETS+=iptables hostap wtools dhcp_relay bridge
  93. # Run customize.mk at the very end to add your own special config.
  94. # This is useful for making your own distro within the buildroot
  95. # process.
  96. # TARGETS+=customize
  97. #############################################################
  98. #
  99. # Pick your root filesystem type.
  100. #
  101. #############################################################
  102. TARGETS+=ext2root
  103. # Must mount cramfs with 'ramdisk_blocksize=4096'
  104. #TARGETS+=cramfsroot
  105. # You may need to edit make/jffs2root.mk to change target
  106. # endian-ness or similar, but this is sufficient for most
  107. # things as-is...
  108. #TARGETS+=jffs2root
  109. #############################################################
  110. #
  111. # You should probably leave this stuff alone unless you know
  112. # what you are doing.
  113. #
  114. #############################################################
  115. HOSTCC:=gcc
  116. BASE_DIR:=${shell pwd}
  117. SOURCE_DIR:=$(BASE_DIR)/sources
  118. DL_DIR:=$(SOURCE_DIR)/dl
  119. PATCH_DIR=$(SOURCE_DIR)/patches
  120. BUILD_DIR:=$(BASE_DIR)/build
  121. TARGET_DIR:=$(BUILD_DIR)/root
  122. STAGING_DIR=$(BUILD_DIR)/staging_dir
  123. TOOL_BUILD_DIR=$(BASE_DIR)/build
  124. TARGET_PATH=$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
  125. TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
  126. TARGET_CC=$(TARGET_CROSS)gcc
  127. STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
  128. #STRIP:=/bin/true
  129. IMAGE:=$(BASE_DIR)/root_fs
  130. GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
  131. KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc-
  132. HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
  133. -e 's/sparc.*/sparc/' \
  134. -e 's/arm.*/arm/g' \
  135. -e 's/m68k.*/m68k/' \
  136. -e 's/ppc/powerpc/g' \
  137. -e 's/v850.*/v850/g' \
  138. -e 's/sh[234]/sh/' \
  139. -e 's/mips-.*/mips/' \
  140. -e 's/mipsel-.*/mipsel/' \
  141. -e 's/cris.*/cris/' \
  142. )
  143. GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
  144. TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
  145. AR=$(TARGET_CROSS)ar \
  146. AS=$(TARGET_CROSS)as \
  147. LD=$(TARGET_CROSS)ld \
  148. NM=$(TARGET_CROSS)nm \
  149. CC=$(TARGET_CROSS)gcc \
  150. GCC=$(TARGET_CROSS)gcc \
  151. CXX=$(TARGET_CROSS)g++ \
  152. RANLIB=$(TARGET_CROSS)ranlib
  153. all: world
  154. TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
  155. TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
  156. TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
  157. world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
  158. .PHONY: all world clean dirclean distclean source $(TARGETS) \
  159. $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
  160. include make/*.mk
  161. #############################################################
  162. #
  163. # staging and target directories do NOT list these as
  164. # dependancies anywhere else
  165. #
  166. #############################################################
  167. $(DL_DIR):
  168. mkdir $(DL_DIR)
  169. $(BUILD_DIR):
  170. mkdir $(BUILD_DIR)
  171. $(STAGING_DIR):
  172. rm -rf $(STAGING_DIR)
  173. mkdir -p $(STAGING_DIR)/lib
  174. mkdir -p $(STAGING_DIR)/usr/lib
  175. mkdir -p $(STAGING_DIR)/include
  176. $(TARGET_DIR):
  177. rm -rf $(TARGET_DIR)
  178. zcat $(SOURCE_DIR)/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
  179. cp -a $(SOURCE_DIR)/target_skeleton/* $(TARGET_DIR)/
  180. -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
  181. source: $(TARGETS_SOURCE)
  182. #############################################################
  183. #
  184. # Cleanup and misc junk
  185. #
  186. #############################################################
  187. clean: $(TARGETS_CLEAN)
  188. rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE)
  189. dirclean: $(TARGETS_DIRCLEAN)
  190. rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE)
  191. distclean:
  192. rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE)
  193. sourceball:
  194. rm -rf $(BUILD_DIR)
  195. set -e; \
  196. cd ..; \
  197. rm -f buildroot.tar.bz2; \
  198. tar -cvf buildroot.tar buildroot; \
  199. bzip2 -9 buildroot.tar; \