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