update snapshot value
[openwrt/svn-archive/archive.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 SNAPSHOT:=20040705
32
33 ARCH:=mipsel
34 USE_UCLIBC_SNAPSHOT:=$(SNAPSHOT)
35 USE_UCLIBC_LDSO_0_9_24:=false
36 USE_BUSYBOX_SNAPSHOT:=$(SNAPSHOT)
37 USE_NETFILTER_SNAPSHOT:=$(SNAPSHOT)
38 USE_BRIDGE_VERSION:=0.9.7
39 BUILD_WITH_LARGEFILE:=true
40
41 OPTIMIZE_FOR_CPU=$(ARCH)
42
43 PUB_DIR:=/var/www/html/testsite/ipkg
44
45 # Command used to download source code
46 WGET:=wget --passive-ftp
47
48 # Soft floating point options.
49 # Notes:
50 # Currently builds with gcc 3.3 for arm, mips, mipsel, powerpc.
51 # (i386 support will be added back in at some point.)
52 # Only tested with multilib enabled.
53 # For i386, long double is the same as double (64 bits). While this
54 # is unusual for x86, it seemed the best approach considering the
55 # limitations in the gcc floating point emulation library.
56 # For arm, soft float uses the usual libfloat routines.
57 # Custom specs files are used to set the default gcc mode to soft float
58 # as a convenience, since you shouldn't link hard and soft float
59 # together. In fact, arm won't even let you.
60 # (Un)comment the appropriate line below.
61 #SOFT_FLOAT:=true
62 SOFT_FLOAT:=false
63
64 TARGET_OPTIMIZATION=-Os -mips2
65 TARGET_DEBUGGING= #-g
66
67 # Currently the unwind stuff seems to work for staticly linked apps but
68 # not dynamic. So use setjmp/longjmp exceptions by default.
69 # GCC_USE_SJLJ_EXCEPTIONS:=--enable-sjlj-exceptions
70 GCC_USE_SJLJ_EXCEPTIONS:=
71
72 # Any additional gcc options you may want to include....
73 EXTRA_GCC_CONFIG_OPTIONS:=
74
75 # Enable the following if you want locale/gettext/i18n support.
76 # NOTE! Currently the pregnerated locale stuff only works for x86!
77 #ENABLE_LOCALE:=true
78 ENABLE_LOCALE:=false
79
80 # If you want multilib enabled, enable this...
81 MULTILIB:=--enable-multilib
82
83 # Build/install c++ compiler and libstdc++?
84 #INSTALL_LIBSTDCPP:=true
85 INSTALL_LIBSTDCPP:=false
86
87 # Build/install java compiler and libgcj? (requires c++)
88 # WARNING!!! DOES NOT BUILD FOR TARGET WITHOUT INTERVENTION!!! mjn3
89 #INSTALL_LIBGCJ:=true
90 INSTALL_LIBGCJ:=false
91
92 # For SMP machines some stuff can be run in parallel
93 #JLEVEL=-j3
94
95 #############################################################
96 #
97 # The list of stuff to build for the target filesystem
98 #
99 #############################################################
100 TARGETS:=host-sed gcc3_3 ipkg-utils openwrt-base openwrt-code.bin
101
102 PACKAGES:=oidentd iproute2 sched-modules wshaper
103
104 #############################################################
105 #
106 # You should probably leave this stuff alone unless you know
107 # what you are doing.
108 #
109 #############################################################
110
111 ifeq ($(SOFT_FLOAT),true)
112 SOFT_FLOAT_CONFIG_OPTION:=--without-float
113 TARGET_SOFT_FLOAT:=-msoft-float
114 ARCH_FPU_SUFFIX:=_nofpu
115 else
116 SOFT_FLOAT_CONFIG_OPTION:=
117 TARGET_SOFT_FLOAT:=
118 ARCH_FPU_SUFFIX:=
119 endif
120
121 ifeq ($(INSTALL_LIBGCJ),true)
122 INSTALL_LIBSTDCPP:=true
123 endif
124
125 # WARNING -- uClibc currently disables large file support on cris.
126 ifeq ("$(strip $(ARCH))","cris")
127 BUILD_WITH_LARGEFILE:=false
128 endif
129
130 ifneq ($(BUILD_WITH_LARGEFILE),true)
131 DISABLE_LARGEFILE= --disable-largefile
132 endif
133 TARGET_CFLAGS=$(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)
134
135 HOSTCC:=gcc
136 BASE_DIR:=${shell pwd}
137 SOURCE_DIR:=$(BASE_DIR)/sources
138 DL_DIR:=$(SOURCE_DIR)/dl
139 PATCH_DIR=$(SOURCE_DIR)/patches
140 BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
141 TARGET_DIR:=$(BUILD_DIR)/root
142 STAGING_DIR=$(BUILD_DIR)/staging_dir
143 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
144 TARGET_PATH=$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
145 IMAGE:=$(BASE_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
146 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
147 GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
148 KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
149 TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
150 TARGET_CC=$(TARGET_CROSS)gcc
151 STRIP=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
152
153
154 HOST_ARCH:=$(shell $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
155 -e 's/sparc.*/sparc/' \
156 -e 's/arm.*/arm/g' \
157 -e 's/m68k.*/m68k/' \
158 -e 's/ppc/powerpc/g' \
159 -e 's/v850.*/v850/g' \
160 -e 's/sh[234]/sh/' \
161 -e 's/mips-.*/mips/' \
162 -e 's/mipsel-.*/mipsel/' \
163 -e 's/cris.*/cris/' \
164 -e 's/i[3-9]86/i386/' \
165 )
166 GNU_HOST_NAME:=$(HOST_ARCH)-pc-linux-gnu
167 TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
168 AR=$(TARGET_CROSS)ar \
169 AS=$(TARGET_CROSS)as \
170 LD=$(TARGET_CROSS)ld \
171 NM=$(TARGET_CROSS)nm \
172 CC=$(TARGET_CROSS)gcc \
173 GCC=$(TARGET_CROSS)gcc \
174 CXX=$(TARGET_CROSS)g++ \
175 RANLIB=$(TARGET_CROSS)ranlib
176
177 ifeq ($(ENABLE_LOCALE),true)
178 DISABLE_NLS:=
179 else
180 DISABLE_NLS:=--disable-nls
181 endif
182
183
184 all: world
185
186 TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
187 TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
188 TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
189
190
191 PACKAGES_IPK:=$(patsubst %,%-ipk,$(PACKAGES))
192
193
194 $(BUILD_DIR)/Packages : $(PACKAGES_IPK)
195 (cd $(BUILD_DIR) ; $(IPKG_MAKE_INDEX) . > Packages)
196
197 world: $(DL_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) $(TARGETS) $(PACKAGES_IPK) $(BUILD_DIR)/Packages
198 @echo "ALL DONE."
199
200 .PHONY: all world clean dirclean distclean source $(TARGETS) \
201 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE)
202
203 include make/*.mk
204
205 #############################################################
206 #
207 # staging and target directories do NOT list these as
208 # dependancies anywhere else
209 #
210 #############################################################
211 $(DL_DIR):
212 mkdir $(DL_DIR)
213
214 $(BUILD_DIR):
215 mkdir $(BUILD_DIR)
216
217 $(STAGING_DIR):
218 rm -rf $(STAGING_DIR)
219 mkdir -p $(STAGING_DIR)/lib
220 mkdir -p $(STAGING_DIR)/usr
221 ln -fs $(REAL_GNU_TARGET_NAME)/include $(STAGING_DIR)/include
222 ln -fs ../lib $(STAGING_DIR)/usr/lib
223 ln -fs ../$(REAL_GNU_TARGET_NAME)/include $(STAGING_DIR)/usr/include
224
225
226 $(TARGET_DIR): $(DL_DIR)/$(OPENWRT_ROOT_SKEL)
227 rm -rf $(TARGET_DIR)
228 #zcat $(SOURCE_DIR)/skel.tar.gz | tar -C $(BUILD_DIR) -xf -
229 zcat $(DL_DIR)/$(OPENWRT_ROOT_SKEL) | tar -C $(BUILD_DIR) -xf -
230 #cp -a $(SOURCE_DIR)/target_skeleton/* $(TARGET_DIR)/
231 -find $(TARGET_DIR) -type d -name CVS -exec rm -rf {} \; > /dev/null 2>&1
232
233 source: $(TARGETS_SOURCE)
234
235 #############################################################
236 #
237 # Cleanup and misc junk
238 #
239 #############################################################
240 clean:
241 rm -rf $(TOOL_BUILD_DIR) $(BUILD_DIR) $(IMAGE) \
242 openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \
243 openwrt-kmodules.tar.bz2
244
245 dirclean: $(TARGETS_DIRCLEAN)
246 rm -rf $(TARGET_DIR) $(STAGING_DIR) $(IMAGE) \
247 openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \
248 openwrt-kmodules.tar.bz2
249
250 distclean:
251 rm -rf $(DL_DIR) $(BUILD_DIR) $(LINUX_KERNEL) $(IMAGE) \
252 openwrt-linux.trx openwrt-g-code.bin openwrt-gs-code.bin \
253 openwrt-kmodules.tar.bz2
254
255
256 publish:
257 chmod 644 $(BUILD_DIR)/Packages
258 chmod 644 $(BUILD_DIR)/Packages.filelist
259 chmod 644 $(BUILD_DIR)/*.ipk
260 cp $(BUILD_DIR)/Packages $(PUB_DIR)
261 cp $(BUILD_DIR)/Packages.filelist $(PUB_DIR)
262 cp $(BUILD_DIR)/*.ipk $(PUB_DIR)
263
264
265
266 sourceball:
267 rm -rf $(BUILD_DIR)
268 set -e; \
269 cd ..; \
270 rm -f buildroot.tar.bz2; \
271 tar -cvf buildroot.tar buildroot; \
272 bzip2 -9 buildroot.tar; \