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