96fa2494a88329dfcdfa41e93238b1bea9635380
[openwrt.git] / obsolete-buildroot / Makefile
1 # Makefile for a simple busybox/uClibc root filesystem
2 #
3 # Copyright (C) 2001-2004 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
21
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 #############################################################
30
31 # What sortof target system shall we compile this for?
32 #ARCH:=i386
33 #ARCH:=arm
34 #ARCH:=mips
35 ARCH:=mipsel
36 #ARCH:=powerpc
37 #ARCH:=sh4
38 # Busybox link failing due to needing libgcc functions that are statics.
39 #ARCH:=cris
40
41 # The following currently fail to build since no shared lib support.
42 #ARCH:=sh64
43 #ARCH:=m68k
44 #ARCH:=v850
45 #ARCH:=sparc
46 #ARCH:=whatever
47
48 # If you are building a native gcc toolchain, do you want to
49 # build the old gcc-2.95 based toolchain, or would you prefer
50 # a nice and shiny new gcc-3.3.2 toolchain?
51 # WARNING -- 2.95 currently only builds for i386, arm, mips*, and powerpc.
52 # WARNING -- 2.95 does not currently build natively for the target.
53 GCC_2_95_TOOLCHAIN:=false
54
55 # Enable this to use the uClibc daily snapshot instead of a released
56 # version. Daily snapshots may contain new features and bugfixes. Or
57 # they may not even compile at all, depending on what Erik is doing...
58 #USE_UCLIBC_SNAPSHOT:=
59 #USE_UCLIBC_SNAPSHOT:=snapshot
60 USE_UCLIBC_SNAPSHOT:=20040509
61
62 # Temporary option... Fall back to (slightly modified) ldso 0.9.24 code?
63 # This is here temporarily since I'm having problems with the current
64 # cvs ldso code on mipsel.
65 USE_UCLIBC_LDSO_0_9_24:=true
66 #USE_UCLIBC_LDSO_0_9_24:=false
67
68 # Enable this to use the busybox daily snapshot instead of a released
69 # version. Daily snapshots may contain new features and bugfixes. Or
70 # they may not even compile at all....
71 #USE_BUSYBOX_SNAPSHOT:=
72 #USE_BUSYBOX_SNAPSHOT:=snapshot
73 USE_BUSYBOX_SNAPSHOT:=20040509
74
75 # Enable large file (files > 2 GB) support
76 BUILD_WITH_LARGEFILE:=true
77
78 # Command used to download source code
79 WGET:=wget --passive-ftp
80
81 # Optimize toolchain for which type of CPU?
82 OPTIMIZE_FOR_CPU=$(ARCH)
83 #OPTIMIZE_FOR_CPU=i686
84 # Note... gcc 2.95 does not seem to like anything higher than i586.
85 #OPTIMIZE_FOR_CPU=i586
86 #OPTIMIZE_FOR_CPU=whatever
87
88 # Soft floating point options.
89 # Notes:
90 # Currently builds with gcc 3.3 for arm, mips, mipsel, powerpc.
91 # (i386 support will be added back in at some point.)
92 # Only tested with multilib enabled.
93 # For i386, long double is the same as double (64 bits). While this
94 # is unusual for x86, it seemed the best approach considering the
95 # limitations in the gcc floating point emulation library.
96 # For arm, soft float uses the usual libfloat routines.
97 # Custom specs files are used to set the default gcc mode to soft float
98 # as a convenience, since you shouldn't link hard and soft float
99 # together. In fact, arm won't even let you.
100 # (Un)comment the appropriate line below.
101 #SOFT_FLOAT:=true
102 SOFT_FLOAT:=false
103
104 TARGET_OPTIMIZATION=-Os -mips2
105 TARGET_DEBUGGING= #-g
106
107 # Currently the unwind stuff seems to work for staticly linked apps but
108 # not dynamic. So use setjmp/longjmp exceptions by default.
109 GCC_USE_SJLJ_EXCEPTIONS:=--enable-sjlj-exceptions
110 #GCC_USE_SJLJ_EXCEPTIONS:=
111
112 # Any additional gcc options you may want to include....
113 EXTRA_GCC_CONFIG_OPTIONS:=
114
115 # Enable the following if you want locale/gettext/i18n support.
116 # NOTE! Currently the pregnerated locale stuff only works for x86!
117 #ENABLE_LOCALE:=true
118 ENABLE_LOCALE:=false
119
120 # If you want multilib enabled, enable this...
121 MULTILIB:=--enable-multilib
122
123 # Build/install c++ compiler and libstdc++?
124 #INSTALL_LIBSTDCPP:=true
125 INSTALL_LIBSTDCPP:=false
126
127 # Build/install java compiler and libgcj? (requires c++)
128 # WARNING!!! DOES NOT BUILD FOR TARGET WITHOUT INTERVENTION!!! mjn3
129 #INSTALL_LIBGCJ:=true
130 INSTALL_LIBGCJ:=false
131
132 # For SMP machines some stuff can be run in parallel
133 #JLEVEL=-j3
134
135 #############################################################
136 #
137 # The list of stuff to build for the target filesystem
138 #
139 #############################################################
140 TARGETS:=host-sed
141
142 ifeq ($(GCC_2_95_TOOLCHAIN),true)
143 TARGETS+=uclibc-configured binutils gcc2_95
144 else
145 TARGETS+=uclibc-configured binutils gcc3_3
146 endif
147
148 # Do you want user mode Linux (x86 only), or are you building a
149 # your own kernel that will run on its own? Perhaps you have a
150 # kernel you have already configured and you want to use that?
151 # The default is to just use a set of known working kernel
152 # headers. Unless you want to build a kernel, I recommend just
153 # using that...
154 #TARGETS+=kernel-headers
155 #TARGETS+=linux
156 #TARGETS+=user-mode-linux
157 #TARGETS+=system-linux
158 TARGETS+= openwrt-base
159
160 # The default minimal set
161 #TARGETS+=busybox tinylogin
162
163 # Openssh...
164 #TARGETS+=zlib openssl openssh
165 # Dropbear sshd is much smaller than openssl + openssh
166 #TARGETS+=dropbear_sshd
167
168 # Everything needed to build a full uClibc development system!
169 #TARGETS+=coreutils findutils bash make diffutils patch sed
170 #TARGETS+=ed flex bison file gawk tar grep bzip2
171
172 #If you want a development system, you probably want gcc built
173 # with uClibc so it can run within your dev system...
174 #TARGETS+=gcc2_95_target ccache_target # NOT WORKING!!!
175 #TARGETS+=gcc3_3_target ccache_target
176
177 # Of course, if you are installing a development system, you
178 # may want some header files so you can compile stuff....
179 #TARGETS+=ncurses-headers zlib-headers openssl-headers
180
181 # More development system stuff for those that want it
182 #TARGETS+=m4 autoconf automake libtool
183
184 # Perl
185 #TARGETS+=perl
186
187 # Some nice debugging tools
188 #TARGETS+=gdb strace ltrace
189
190 # The Valgrind debugger (x86 only)
191 #TARGETS+=valgrind
192
193 # Some stuff for access points and firewalls
194 #TARGETS+=iptables hostap wtools dhcp_relay bridge
195 #TARGETS+=iproute2 netsnmp
196
197 # Run customize.mk at the very end to add your own special config.
198 # This is useful for making your own distro within the buildroot
199 # process.
200 # TARGETS+=customize
201
202 #############################################################
203 #
204 # Pick your root filesystem type.
205 #
206 #############################################################
207 #TARGETS+=ext2root
208
209 # Must mount cramfs with 'ramdisk_blocksize=4096'
210 #TARGETS+=cramfsroot
211
212 # You may need to edit make/jffs2root.mk to change target
213 # endian-ness or similar, but this is sufficient for most
214 # things as-is...
215 #TARGETS+=jffs2root
216
217 #TARGETS+= openwrt-linux.trx
218 TARGETS+= openwrt-code.bin
219
220 #############################################################
221 #
222 # You should probably leave this stuff alone unless you know
223 # what you are doing.
224 #
225 #############################################################
226
227 ifeq ($(SOFT_FLOAT),true)
228 SOFT_FLOAT_CONFIG_OPTION:=--without-float
229 TARGET_SOFT_FLOAT:=-msoft-float
230 ARCH_FPU_SUFFIX:=_nofpu
231 else
232 SOFT_FLOAT_CONFIG_OPTION:=
233 TARGET_SOFT_FLOAT:=
234 ARCH_FPU_SUFFIX:=
235 endif
236
237 ifeq ($(INSTALL_LIBGCJ),true)
238 INSTALL_LIBSTDCPP:=true
239 endif
240
241 # WARNING -- uClibc currently disables large file support on cris.
242 ifeq ("$(strip $(ARCH))","cris")
243 BUILD_WITH_LARGEFILE:=false
244 endif
245
246 ifneq ($(BUILD_WITH_LARGEFILE),true)
247 DISABLE_LARGEFILE= --disable-largefile
248 endif
249 TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
250
251 HOSTCC:=gcc
252 BASE_DIR:=${shell pwd}
253 SOURCE_DIR:=$(BASE_DIR)/sources
254 DL_DIR:=$(SOURCE_DIR)/dl
255 PATCH_DIR=$(SOURCE_DIR)/patches
256 BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
257 TARGET_DIR:=$(BUILD_DIR)/root
258 STAGING_DIR=$(BUILD_DIR)/staging_dir
259 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
260 TARGET_PATH=$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
261 IMAGE:=$(BASE_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
262 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
263 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
264 KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
265 TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
266 TARGET_CC=$(TARGET_CROSS)gcc
267 STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
268
269
270 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
271 -e 's/sparc.*/sparc/' \
272 -e 's/arm.*/arm/g' \
273 -e 's/m68k.*/m68k/' \
274 -e 's/ppc/powerpc/g' \
275 -e 's/v850.*/v850/g' \
276 -e 's/sh[234]/sh/' \
277 -e 's/mips-.*/mips/' \
278 -e 's/mipsel-.*/mipsel/' \
279 -e 's/cris.*/cris/' \
280 -e 's/i[3-9]86/i386/' \
281 )
282 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
283 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
284 AR=$(TARGET_CROSS)ar \
285 AS=$(TARGET_CROSS)as \
286 LD=$(TARGET_CROSS)ld \
287 NM=$(TARGET_CROSS)nm \
288 CC=$(TARGET_CROSS)gcc \
289 GCC=$(TARGET_CROSS)gcc \
290 CXX=$(TARGET_CROSS)g++ \
291 RANLIB=$(TARGET_CROSS)ranlib
292
293 ifeq ($(ENABLE_LOCALE),true)
294 DISABLE_NLS:=
295 else
296 DISABLE_NLS:=--disable-nls
297 endif
298
299
300 all: world
301
302 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
303 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
304 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
305
306 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS)
307 @echo "ALL DONE."
308
309 .PHONY: all world clean dirclean distclean source $(TARGETS) \
310 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
311
312 include make/*.mk
313
314 #############################################################
315 #
316 # staging and target directories do NOT list these as
317 # dependancies anywhere else
318 #
319 #############################################################
320 $(DL_DIR):
321 mkdir $(DL_DIR)
322
323 $(BUILD_DIR):
324 mkdir $(BUILD_DIR)
325
326 $(STAGING_DIR):
327 rm -rf $(STAGING_DIR)
328 mkdir -p $(STAGING_DIR)/lib
329 mkdir -p $(STAGING_DIR)/usr
330 ln -fs $(REAL_GNU_TARGET_NAME)/include $(STAGING_DIR)/include
331 ln -fs ../lib $(STAGING_DIR)/usr/lib
332 ln -fs ../$(REAL_GNU_TARGET_NAME)/include $(STAGING_DIR)/usr/include
333
334
335 $(TARGET_DIR): $(DL_DIR)/$(OPENWRT_ROOT_SKEL)
336 rm -rf $(TARGET_DIR)
337 #zcat $(SOURCE_DIR)/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
338 zcat $(DL_DIR)/$(OPENWRT_ROOT_SKEL) | tar -C $(BUILD_DIR) -xf -
339 #cp -a $(SOURCE_DIR)/target_skeleton/* $(TARGET_DIR)/
340 -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
341
342 source: $(TARGETS_SOURCE)
343
344 #############################################################
345 #
346 # Cleanup and misc junk
347 #
348 #############################################################
349 clean:
350 rm -rf $(TOOL_BUILD_DIR) $(BUILD_DIR) $(IMAGE) \
351 openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \
352 openwrt-kmodules.tar.bz2
353
354 dirclean: $(TARGETS_DIRCLEAN)
355 rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE) \
356 openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \
357 openwrt-kmodules.tar.bz2
358
359 distclean:
360 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) \
361 openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \
362 openwrt-kmodules.tar.bz2
363
364 sourceball:
365 rm -rf $(BUILD_DIR)
366 set -e; \
367 cd ..; \
368 rm -f buildroot.tar.bz2; \
369 tar -cvf buildroot.tar buildroot; \
370 bzip2 -9 buildroot.tar; \
This page took 0.052574 seconds and 3 git commands to generate.