]>
Commit | Line | Data |
---|---|---|
08782ae7 | 1 | # Makefile for a simple busybox/uClibc root filesystem |
ffde94bd | 2 | # |
03c3fa25 | 3 | # Copyright (C) 2001-2003 Erik Andersen <[email protected]> |
08782ae7 | 4 | # Copyright (C) 2002 by Tim Riker <[email protected]> |
ffde94bd | 5 | # |
08782ae7 EA |
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. | |
ffde94bd | 10 | # |
08782ae7 EA |
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. | |
ffde94bd | 15 | # |
08782ae7 EA |
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 | |
ffde94bd | 20 | |
ffde94bd | 21 | |
08782ae7 EA |
22 | ############################################################# |
23 | # | |
24 | # EDIT this stuff to suit your system and preferences | |
25 | # | |
26 | # Use := when possible to get precomputation, thereby | |
27 | # speeding up the build process. | |
28 | # | |
29 | ############################################################# | |
ffde94bd | 30 | |
08782ae7 EA |
31 | # What sortof target system shall we compile this for? |
32 | ARCH:=i386 | |
33 | #ARCH:=arm | |
27bc59d4 | 34 | #ARCH:=powerpc |
08782ae7 | 35 | #ARCH:=whatever |
c38dcccc | 36 | |
95f81a5a | 37 | # enable to build a native gcc toolchain with uclibc support |
5a9f7f2b | 38 | USE_UCLIBC_TOOLCHAIN:=true |
95f81a5a | 39 | |
18e33c25 EA |
40 | # If you are building a native gcc toolchain, do you want to |
41 | # build the old gcc-2.95 based toolchain, or would you prefer | |
42 | # a nice and shiny new gcc-3.2.1 toolchain? | |
43 | GCC_2_95_TOOLCHAIN:=false | |
44 | ||
08782ae7 EA |
45 | # Enable this to use the uClibc daily snapshot instead of a released |
46 | # version. Daily snapshots may contain new features and bugfixes. Or | |
95f81a5a | 47 | # they may not even compile at all, depending on what Erik is doing... |
d906413a | 48 | USE_UCLIBC_SNAPSHOT:=true |
c38dcccc | 49 | |
085ba9f4 EA |
50 | # Enable this to use the busybox daily snapshot instead of a released |
51 | # version. Daily snapshots may contain new features and bugfixes. Or | |
52 | # they may not even compile at all.... | |
26da803f | 53 | USE_BUSYBOX_SNAPSHOT:=true |
085ba9f4 | 54 | |
08782ae7 | 55 | # Enable large file (files > 2 GB) support |
03c3fa25 | 56 | BUILD_WITH_LARGEFILE:=true |
ffde94bd | 57 | |
8a2597ea EA |
58 | # Command used to download source code |
59 | WGET:=wget --passive-ftp | |
60 | ||
27bc59d4 | 61 | # Optimize toolchain for which type of CPU? |
ef7784a6 EA |
62 | OPTIMIZE_FOR_CPU=$(ARCH) |
63 | #OPTIMIZE_FOR_CPU=i486 | |
64 | #OPTIMIZE_FOR_CPU=strongarm | |
65 | #OPTIMIZE_FOR_CPU=whatever | |
27bc59d4 EA |
66 | |
67 | # Any additional gcc options you may want to include.... | |
ef7784a6 EA |
68 | EXTRA_GCC_CONFIG_OPTIONS= |
69 | #EXTRA_GCC_CONFIG_OPTIONS=--without-float | |
27bc59d4 | 70 | |
cb7d5b81 EA |
71 | # Enable the following if you want locale/gettext/i18n support. |
72 | #ENABLE_LOCALE:=true | |
73 | ENABLE_LOCALE:=false | |
74 | ||
75 | # If you want multilib enabled, enable this... | |
76 | MULTILIB:=--enable-multilib | |
77 | ||
78 | #Install libstdc++? | |
79 | INSTALL_LIBSTDCPP=true | |
0e956fc1 | 80 | |
02bf5816 EA |
81 | # For SMP machines some stuff can be run in parallel |
82 | #JLEVEL=-j3 | |
83 | ||
08782ae7 EA |
84 | ############################################################# |
85 | # | |
86 | # The list of stuff to build for the target filesystem | |
87 | # | |
88 | ############################################################# | |
cb7d5b81 | 89 | TARGETS:= |
03c3fa25 EA |
90 | # The toolchain comes next if we are building one |
91 | ifeq ($(USE_UCLIBC_TOOLCHAIN),true) | |
a0aef7c4 EA |
92 | ifeq ($(GCC_2_95_TOOLCHAIN),true) |
93 | TARGETS+=binutils uclibc-configured gcc2_95 | |
94 | else | |
cb7d5b81 | 95 | TARGETS+=binutils uclibc-configured gcc3_3 |
a0aef7c4 | 96 | endif |
cb7d5b81 EA |
97 | else |
98 | TARGETS+=uclibc | |
03c3fa25 EA |
99 | endif |
100 | ||
cb7d5b81 EA |
101 | # Do you want user mode Linux (x86 only), or are you building a |
102 | # your own kernel that will run on its own? Perhaps you have a | |
4edbe2ca | 103 | # kernel you have already configured and you want to use that? |
cb7d5b81 EA |
104 | # The default is to just use a set of known working kernel |
105 | # headers. Unless you want to build a kernel, I recommend just | |
106 | # using that... | |
107 | TARGETS+=kernel-headers | |
5455b5e0 | 108 | #TARGETS+=linux |
5eb4604c | 109 | #TARGETS+=user-mode-linux |
59759b8f | 110 | #TARGETS+=system-linux |
5455b5e0 | 111 | |
cad58108 | 112 | # The default minimal set |
b8a2361d | 113 | TARGETS+=busybox tinylogin |
cad58108 EA |
114 | |
115 | # Openssh... | |
116 | #TARGETS+=zlib openssl openssh | |
59759b8f EA |
117 | # Dropbear sshd is much smaller than openssl + openssh |
118 | #TARGETS+=dropbear_sshd | |
cad58108 EA |
119 | |
120 | # Everything needed to build a full uClibc development system! | |
de857763 | 121 | #TARGETS+=coreutils findutils bash make diffutils patch sed |
a0aef7c4 EA |
122 | #TARGETS+=ed flex bison file gawk tar grep |
123 | ||
124 | #If you want a development system, you probably want gcc built | |
125 | # with uClibc so it can run within your dev system... | |
126 | #TARGETS+=gcc2_95_target | |
bc9faa33 | 127 | #TARGETS+=gcc3_3_target |
cad58108 | 128 | |
7564033f EA |
129 | # Of course, if you are installing a development system, you |
130 | # may want some header files so you can compile stuff.... | |
131 | #TARGETS+=ncurses-headers zlib-headers openssl-headers | |
132 | ||
b7d4f49c EA |
133 | # More development system stuff for those that want it |
134 | #TARGETS+=m4 autoconf automake libtool | |
135 | ||
13694747 EA |
136 | # Perl |
137 | #TARGETS+=perl | |
138 | ||
cad58108 EA |
139 | # Some nice debugging tools |
140 | #TARGETS+=gdb strace | |
141 | ||
382187f0 | 142 | # The Valgrind debugger (x86 only) |
cad58108 | 143 | #TARGETS+=valgrind |
ffde94bd | 144 | |
9741a49e | 145 | # Some stuff for access points and firewalls |
c8eea31d | 146 | #TARGETS+=iptables hostap wtools dhcp_relay bridge |
26da803f | 147 | #TARGETS+=iproute2 netsnmp |
9741a49e | 148 | |
54e098e4 EA |
149 | # Run customize.mk at the very end to add your own special config. |
150 | # This is useful for making your own distro within the buildroot | |
151 | # process. | |
152 | # TARGETS+=customize | |
153 | ||
154 | ############################################################# | |
155 | # | |
08782ae7 | 156 | # Pick your root filesystem type. |
54e098e4 EA |
157 | # |
158 | ############################################################# | |
08782ae7 | 159 | TARGETS+=ext2root |
ffde94bd | 160 | |
27bc59d4 EA |
161 | # Must mount cramfs with 'ramdisk_blocksize=4096' |
162 | #TARGETS+=cramfsroot | |
163 | ||
164 | # You may need to edit make/jffs2root.mk to change target | |
165 | # endian-ness or similar, but this is sufficient for most | |
166 | # things as-is... | |
167 | #TARGETS+=jffs2root | |
168 | ||
08782ae7 EA |
169 | ############################################################# |
170 | # | |
171 | # You should probably leave this stuff alone unless you know | |
172 | # what you are doing. | |
173 | # | |
174 | ############################################################# | |
08782ae7 | 175 | HOSTCC:=gcc |
9741a49e | 176 | BASE_DIR:=${shell pwd} |
08782ae7 EA |
177 | SOURCE_DIR:=$(BASE_DIR)/sources |
178 | DL_DIR:=$(SOURCE_DIR)/dl | |
179 | PATCH_DIR=$(SOURCE_DIR)/patches | |
d906413a | 180 | BUILD_DIR:=$(BASE_DIR)/build_$(ARCH) |
08782ae7 | 181 | TARGET_DIR:=$(BUILD_DIR)/root |
370fb2a3 | 182 | STAGING_DIR=$(BUILD_DIR)/staging_dir |
d906413a | 183 | TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH) |
370fb2a3 | 184 | TARGET_PATH=$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin |
d108fa86 EA |
185 | TARGET_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc- |
186 | TARGET_CC=$(TARGET_CROSS)gcc | |
370fb2a3 | 187 | STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note |
cad58108 | 188 | #STRIP:=/bin/true |
59759b8f | 189 | IMAGE:=$(BASE_DIR)/root_fs_$(ARCH) |
370fb2a3 | 190 | GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux |
a5c23541 | 191 | KERNEL_CROSS=$(STAGING_DIR)/bin/$(ARCH)-uclibc- |
36830bae EA |
192 | HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \ |
193 | -e 's/sparc.*/sparc/' \ | |
194 | -e 's/arm.*/arm/g' \ | |
195 | -e 's/m68k.*/m68k/' \ | |
196 | -e 's/ppc/powerpc/g' \ | |
197 | -e 's/v850.*/v850/g' \ | |
198 | -e 's/sh[234]/sh/' \ | |
199 | -e 's/mips-.*/mips/' \ | |
200 | -e 's/mipsel-.*/mipsel/' \ | |
201 | -e 's/cris.*/cris/' \ | |
0554f62a | 202 | -e 's/i[3-9]86/i386/' \ |
36830bae EA |
203 | ) |
204 | GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu | |
1fc3f2f3 EA |
205 | TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \ |
206 | AR=$(TARGET_CROSS)ar \ | |
207 | AS=$(TARGET_CROSS)as \ | |
208 | LD=$(TARGET_CROSS)ld \ | |
209 | NM=$(TARGET_CROSS)nm \ | |
210 | CC=$(TARGET_CROSS)gcc \ | |
211 | GCC=$(TARGET_CROSS)gcc \ | |
212 | CXX=$(TARGET_CROSS)g++ \ | |
213 | RANLIB=$(TARGET_CROSS)ranlib | |
cb7d5b81 EA |
214 | #Directory in which to build the toolchain |
215 | TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH) | |
216 | ifeq ($(ENABLE_LOCALE),true) | |
217 | DISABLE_NLS:= | |
218 | else | |
219 | DISABLE_NLS:=--disable-nls | |
220 | endif | |
221 | ||
ffde94bd | 222 | |
08782ae7 | 223 | all: world |
ffde94bd | 224 | |
08782ae7 | 225 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
a5c23541 | 226 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS)) |
08782ae7 | 227 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
ffde94bd | 228 | |
08782ae7 | 229 | world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) |
ffde94bd | 230 | |
a5c23541 EA |
231 | .PHONY: all world clean dirclean distclean source $(TARGETS) \ |
232 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) | |
ffde94bd | 233 | |
08782ae7 | 234 | include make/*.mk |
ffde94bd | 235 | |
08782ae7 EA |
236 | ############################################################# |
237 | # | |
238 | # staging and target directories do NOT list these as | |
239 | # dependancies anywhere else | |
240 | # | |
241 | ############################################################# | |
242 | $(DL_DIR): | |
243 | mkdir $(DL_DIR) | |
ffde94bd | 244 | |
08782ae7 EA |
245 | $(BUILD_DIR): |
246 | mkdir $(BUILD_DIR) | |
c79e9982 | 247 | |
08782ae7 EA |
248 | $(STAGING_DIR): |
249 | rm -rf $(STAGING_DIR) | |
de2ae8dc EA |
250 | mkdir -p $(STAGING_DIR)/lib |
251 | mkdir -p $(STAGING_DIR)/usr/lib | |
252 | mkdir -p $(STAGING_DIR)/include | |
ffde94bd | 253 | |
08782ae7 | 254 | $(TARGET_DIR): |
ffde94bd | 255 | rm -rf $(TARGET_DIR) |
08782ae7 EA |
256 | zcat $(SOURCE_DIR)/skel.tar.gz | tar -C $(BUILD_DIR) -xf - |
257 | cp -a $(SOURCE_DIR)/target_skeleton/* $(TARGET_DIR)/ | |
339f2f49 | 258 | -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1 |
08782ae7 | 259 | |
a5c23541 | 260 | source: $(TARGETS_SOURCE) |
08782ae7 EA |
261 | |
262 | ############################################################# | |
263 | # | |
264 | # Cleanup and misc junk | |
265 | # | |
266 | ############################################################# | |
267 | clean: $(TARGETS_CLEAN) | |
268 | rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE) | |
269 | ||
270 | dirclean: $(TARGETS_DIRCLEAN) | |
271 | rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE) | |
272 | ||
273 | distclean: | |
274 | rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) | |
275 | ||
276 | sourceball: | |
277 | rm -rf $(BUILD_DIR) | |
278 | set -e; \ | |
279 | cd ..; \ | |
280 | rm -f buildroot.tar.bz2; \ | |
281 | tar -cvf buildroot.tar buildroot; \ | |
282 | bzip2 -9 buildroot.tar; \ |