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