]>
Commit | Line | Data |
---|---|---|
2d523c23 | 1 | # Makefile for buildroot2 |
ffde94bd | 2 | # |
15b26aee | 3 | # Copyright (C) 1999-2005 by Erik Andersen <[email protected]> |
eb057575 | 4 | # Copyright (C) 2006-2010 by the Buildroot developers <[email protected]> |
ffde94bd | 5 | # |
08782ae7 | 6 | # This program is free software; you can redistribute it and/or modify |
2d523c23 EA |
7 | # it under the terms of the GNU General Public License as published by |
8 | # the Free Software Foundation; either version 2 of the License, or | |
9 | # (at your option) any later version. | |
ffde94bd | 10 | # |
2d523c23 EA |
11 | # This program is distributed in the hope that it will be useful, |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
08782ae7 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2d523c23 | 14 | # General Public License for more details. |
b30d673c | 15 | # |
2d523c23 EA |
16 | # You should have received a copy of the GNU General Public License |
17 | # along with this program; if not, write to the Free Software | |
18 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
3ad3d8a1 | 19 | # |
02bf5816 | 20 | |
2d523c23 EA |
21 | #-------------------------------------------------------------- |
22 | # Just run 'make menuconfig', configure stuff, then run 'make'. | |
23 | # You shouldn't need to mess with anything beyond this point... | |
24 | #-------------------------------------------------------------- | |
6b1dd45b PK |
25 | # absolute path |
26 | TOPDIR:=$(shell pwd) | |
18d979c7 | 27 | CONFIG_CONFIG_IN=Config.in |
18d979c7 | 28 | CONFIG=package/config |
a8ee1240 | 29 | DATE:=$(shell date +%Y%m%d) |
a0aef7c4 | 30 | |
8b6585a9 | 31 | noconfig_targets:=menuconfig nconfig gconfig xconfig config oldconfig randconfig \ |
0b368800 | 32 | defconfig %_defconfig savedefconfig allyesconfig allnoconfig silentoldconfig release \ |
6652770f | 33 | randpackageconfig allyespackageconfig allnopackageconfig \ |
e491fba2 | 34 | source-check help |
9e250356 | 35 | |
580c6d9b TP |
36 | # Strip quotes and then whitespaces |
37 | qstrip=$(strip $(subst ",,$(1))) | |
38 | #")) | |
39 | ||
f85f2de1 PK |
40 | # Variables for use in Make constructs |
41 | comma:=, | |
42 | empty:= | |
43 | space:=$(empty) $(empty) | |
44 | ||
39ca6d50 WW |
45 | ifneq ("$(origin O)", "command line") |
46 | O:=output | |
47 | CONFIG_DIR:=$(TOPDIR) | |
48 | else | |
49 | # other packages might also support Linux-style out of tree builds | |
50 | # with the O=<dir> syntax (E.G. Busybox does). As make automatically | |
51 | # forwards command line variable definitions those packages get very | |
52 | # confused. Fix this by telling make to not do so | |
53 | MAKEOVERRIDES = | |
54 | # strangely enough O is still passed to submakes with MAKEOVERRIDES | |
55 | # (with make 3.81 atleast), the only thing that changes is the output | |
56 | # of the origin function (command line -> environment). | |
57 | # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+) | |
58 | # To really make O go away, we have to override it. | |
59 | override O:=$(O) | |
60 | CONFIG_DIR:=$(O) | |
de846f6e PK |
61 | # we need to pass O= everywhere we call back into the toplevel makefile |
62 | EXTRAMAKEARGS = O=$(O) | |
39ca6d50 WW |
63 | endif |
64 | ||
a1b0651a US |
65 | # $(shell find . -name *_defconfig |sed 's/.*\///') |
66 | # Pull in the user's configuration file | |
67 | ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) | |
39ca6d50 | 68 | -include $(CONFIG_DIR)/.config |
7521f373 | 69 | endif |
9741a49e | 70 | |
efd8576c US |
71 | # Override BR2_DL_DIR if shell variable defined |
72 | ifneq ($(BUILDROOT_DL_DIR),) | |
73 | BR2_DL_DIR:=$(BUILDROOT_DL_DIR) | |
74 | endif | |
efd8576c | 75 | |
afc61c6e BRF |
76 | # To put more focus on warnings, be less verbose as default |
77 | # Use 'make V=1' to see the full commands | |
78 | ifdef V | |
79 | ifeq ("$(origin V)", "command line") | |
18d979c7 | 80 | KBUILD_VERBOSE=$(V) |
afc61c6e BRF |
81 | endif |
82 | endif | |
83 | ifndef KBUILD_VERBOSE | |
18d979c7 | 84 | KBUILD_VERBOSE=0 |
afc61c6e BRF |
85 | endif |
86 | ||
87 | ifeq ($(KBUILD_VERBOSE),1) | |
4df454e9 | 88 | quiet= |
18d979c7 | 89 | Q= |
1669b6ed BRF |
90 | ifndef VERBOSE |
91 | VERBOSE=1 | |
92 | endif | |
afc61c6e BRF |
93 | else |
94 | quiet=quiet_ | |
18d979c7 | 95 | Q=@ |
afc61c6e BRF |
96 | endif |
97 | ||
69f85924 PK |
98 | # we want bash as shell |
99 | SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | |
afc61c6e | 100 | else if [ -x /bin/bash ]; then echo /bin/bash; \ |
18d979c7 | 101 | else echo sh; fi; fi) |
afc61c6e | 102 | |
69f85924 PK |
103 | # kconfig uses CONFIG_SHELL |
104 | CONFIG_SHELL:=$(SHELL) | |
105 | ||
106 | export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE | |
afc61c6e BRF |
107 | |
108 | ifndef HOSTAR | |
109 | HOSTAR:=ar | |
110 | endif | |
111 | ifndef HOSTAS | |
112 | HOSTAS:=as | |
113 | endif | |
114 | ifndef HOSTCC | |
115 | HOSTCC:=gcc | |
116 | else | |
117 | endif | |
118 | ifndef HOSTCXX | |
119 | HOSTCXX:=g++ | |
120 | endif | |
5f97580e BRF |
121 | ifndef HOSTFC |
122 | HOSTFC:=gfortran | |
123 | endif | |
356133b4 US |
124 | ifndef HOSTCPP |
125 | HOSTCPP:=cpp | |
126 | endif | |
afc61c6e BRF |
127 | ifndef HOSTLD |
128 | HOSTLD:=ld | |
129 | endif | |
0f9c5b11 US |
130 | ifndef HOSTLN |
131 | HOSTLN:=ln | |
132 | endif | |
356133b4 US |
133 | ifndef HOSTNM |
134 | HOSTNM:=nm | |
135 | endif | |
69f85924 PK |
136 | HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar) |
137 | HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as) | |
138 | HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc) | |
139 | HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++) | |
140 | HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran) | |
141 | HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp) | |
142 | HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld) | |
143 | HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln) | |
144 | HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm) | |
54e93328 | 145 | |
afc61c6e | 146 | ifndef CFLAGS_FOR_BUILD |
f987b7a5 | 147 | CFLAGS_FOR_BUILD:=-g -O2 |
afc61c6e | 148 | endif |
5f97580e BRF |
149 | ifndef CXXFLAGS_FOR_BUILD |
150 | CXXFLAGS_FOR_BUILD:=-g -O2 | |
151 | endif | |
152 | ifndef FCFLAGS_FOR_BUILD | |
153 | FCFLAGS_FOR_BUILD:=-g -O2 | |
154 | endif | |
155 | export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD | |
afc61c6e | 156 | |
39ca6d50 WW |
157 | # bash prints the name of the directory on 'cd <dir>' if CDPATH is |
158 | # set, so unset it here to not cause problems. Notice that the export | |
159 | # line doesn't affect the environment of $(shell ..) calls, so | |
160 | # explictly throw away any output from 'cd' here. | |
161 | export CDPATH:= | |
162 | BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd) | |
163 | $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist)) | |
164 | ||
165 | BUILD_DIR:=$(BASE_DIR)/build | |
166 | ||
afc61c6e | 167 | |
cfe511b2 | 168 | ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
54e098e4 | 169 | |
99cf7293 | 170 | # cc-option |
18d979c7 | 171 | # Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586) |
99cf7293 BRF |
172 | # sets -march=winchip-c6 if supported else falls back to -march=i586 |
173 | # without checking the latter. | |
18d979c7 | 174 | cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
99cf7293 BRF |
175 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) |
176 | ||
2c649045 PK |
177 | ############################################################# |
178 | # | |
179 | # Hide troublesome environment variables from sub processes | |
180 | # | |
181 | ############################################################# | |
182 | unexport CROSS_COMPILE | |
183 | unexport ARCH | |
27bc59d4 | 184 | |
c71816a8 | 185 | GNU_HOST_NAME:=$(shell package/gnuconfig/config.guess) |
60281cbf | 186 | |
08782ae7 EA |
187 | ############################################################# |
188 | # | |
c6e43c9d | 189 | # Setup the proper filename extensions for the host |
08782ae7 | 190 | # |
7dcbbfbb | 191 | ############################################################## |
60281cbf | 192 | ifneq ($(findstring linux,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
193 | HOST_EXEEXT:= |
194 | HOST_LIBEXT:=.a | |
195 | HOST_SHREXT:=.so | |
3096f34d | 196 | endif |
60281cbf | 197 | ifneq ($(findstring apple,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
198 | HOST_EXEEXT:= |
199 | HOST_LIBEXT:=.a | |
200 | HOST_SHREXT:=.dylib | |
3096f34d | 201 | endif |
60281cbf | 202 | ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
203 | HOST_EXEEXT:=.exe |
204 | HOST_LIBEXT:=.lib | |
205 | HOST_SHREXT:=.dll | |
2c279671 PK |
206 | HOST_LOADLIBES="-lcurses -lintl" |
207 | export HOST_LOADLIBES | |
3096f34d | 208 | endif |
60281cbf | 209 | ifneq ($(findstring mingw,$(GNU_HOST_NAME)),) |
c6e43c9d BRF |
210 | HOST_EXEEXT:=.exe |
211 | HOST_LIBEXT:=.lib | |
212 | HOST_SHREXT:=.dll | |
3096f34d | 213 | endif |
cb7d5b81 | 214 | |
c6e43c9d | 215 | # The preferred type of libs we build for the target |
3096f34d | 216 | ifeq ($(BR2_PREFER_STATIC_LIB),y) |
c6e43c9d | 217 | LIBTGTEXT=.a |
8027784c | 218 | #PREFERRED_LIB_FLAGS:=--disable-shared --enable-static |
3096f34d | 219 | else |
c6e43c9d | 220 | LIBTGTEXT=.so |
8027784c | 221 | #PREFERRED_LIB_FLAGS:=--disable-static --enable-shared |
3096f34d | 222 | endif |
8027784c | 223 | PREFERRED_LIB_FLAGS:=--enable-static --enable-shared |
ffde94bd | 224 | |
6ad07203 | 225 | ############################################################## |
7dcbbfbb BRF |
226 | # |
227 | # The list of stuff to build for the target toolchain | |
228 | # along with the packages to build for the target. | |
229 | # | |
230 | ############################################################## | |
bc994c53 | 231 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
3d8919a1 | 232 | BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers |
26b44b2b | 233 | else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) |
51f5f627 | 234 | BASE_TARGETS:=uclibc |
7dcbbfbb | 235 | endif |
acc706b7 BRF |
236 | TARGETS:= |
237 | ||
89464a96 PK |
238 | # silent mode requested? |
239 | QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q) | |
240 | ||
397fe5cc TP |
241 | # Strip off the annoying quoting |
242 | ARCH:=$(call qstrip,$(BR2_ARCH)) | |
243 | ifeq ($(ARCH),xtensa) | |
244 | ARCH:=$(ARCH)_$(call qstrip,$(BR2_xtensa_core_name)) | |
245 | endif | |
65e80a0b | 246 | |
07b2af1a | 247 | WGET:=$(call qstrip,$(BR2_WGET)) $(QUIET) |
cf71111b MP |
248 | SVN:=$(call qstrip,$(BR2_SVN)) $(QUIET) |
249 | BZR:=$(call qstrip,$(BR2_BZR)) $(QUIET) | |
397fe5cc TP |
250 | GIT:=$(call qstrip,$(BR2_GIT)) $(QUIET) |
251 | ZCAT:=$(call qstrip,$(BR2_ZCAT)) | |
252 | BZCAT:=$(call qstrip,$(BR2_BZCAT)) | |
253 | TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf | |
254 | ||
397fe5cc TP |
255 | DL_DIR=$(call qstrip,$(BR2_DL_DIR)) |
256 | ifeq ($(DL_DIR),) | |
416323e9 | 257 | DL_DIR:=$(TOPDIR)/dl |
397fe5cc TP |
258 | endif |
259 | ||
397fe5cc TP |
260 | GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX)) |
261 | ||
262 | STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR)) | |
263 | ||
264 | # packages compiled for the host goes here | |
3b2a803d | 265 | HOST_DIR:=$(BASE_DIR)/host |
397fe5cc TP |
266 | |
267 | # stamp (dependency) files go here | |
3b2a803d | 268 | STAMP_DIR:=$(BASE_DIR)/stamps |
397fe5cc | 269 | |
3b2a803d TP |
270 | BINARIES_DIR:=$(BASE_DIR)/images |
271 | TARGET_DIR:=$(BASE_DIR)/target | |
4c5bf461 | 272 | TOOLCHAIN_DIR=$(BASE_DIR)/toolchain |
fbc22eca | 273 | TARGET_SKELETON=$(TOPDIR)/fs/skeleton |
397fe5cc | 274 | |
397fe5cc | 275 | BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config |
1dbe6e33 | 276 | |
7dcbbfbb BRF |
277 | include toolchain/Makefile.in |
278 | include package/Makefile.in | |
279 | ||
280 | ############################################################# | |
281 | # | |
282 | # You should probably leave this stuff alone unless you know | |
283 | # what you are doing. | |
284 | # | |
285 | ############################################################# | |
286 | ||
6547bced | 287 | all: world |
ffde94bd | 288 | |
2d523c23 | 289 | # In this section, we need .config |
2691d808 | 290 | -include $(CONFIG_DIR)/.config.cmd |
2d523c23 | 291 | |
d06645d8 EA |
292 | # We also need the various per-package makefiles, which also add |
293 | # each selected package to TARGETS if that package was selected | |
294 | # in the .config file. | |
bc994c53 | 295 | ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) |
ed020099 | 296 | include toolchain/toolchain-buildroot.mk |
26b44b2b | 297 | else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) |
ed020099 | 298 | include toolchain/toolchain-external.mk |
acc706b7 BRF |
299 | endif |
300 | ||
d06645d8 | 301 | include package/*/*.mk |
d06645d8 | 302 | |
32faf351 | 303 | TARGETS+=target-finalize |
d45de0ca | 304 | |
b87b4742 PK |
305 | ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) |
306 | TARGETS+=target-purgelocales | |
307 | endif | |
308 | ||
649b5b92 | 309 | include boot/common.mk |
79f5f1e8 | 310 | include target/Makefile.in |
487e21cf | 311 | include linux/linux.mk |
649b5b92 | 312 | include fs/common.mk |
79f5f1e8 | 313 | |
02a623dd | 314 | TARGETS+=erase-fakeroots |
c2fc93bc | 315 | |
08782ae7 | 316 | TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS)) |
3b08e64d | 317 | TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS)) |
08782ae7 | 318 | TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS)) |
b3efde23 | 319 | TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS)) |
acc706b7 | 320 | # all targets depend on the crosscompiler and it's prerequisites |
b3efde23 | 321 | $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) % |
acc706b7 | 322 | |
cb5710c5 | 323 | dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
397fe5cc | 324 | $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) |
f958d897 | 325 | |
5ef9e52b | 326 | $(BASE_TARGETS): dirs |
f958d897 | 327 | |
0b368800 TP |
328 | $(BUILD_DIR)/buildroot-config/auto.conf: $(CONFIG_DIR)/.config |
329 | $(MAKE) $(EXTRAMAKEARGS) silentoldconfig | |
330 | ||
331 | prepare: $(BUILD_DIR)/buildroot-config/auto.conf | |
332 | ||
333 | world: prepare dependencies dirs $(BASE_TARGETS) $(TARGETS_ALL) | |
ffde94bd | 334 | |
5ef9e52b | 335 | |
406053d5 | 336 | .PHONY: all world dirs clean distclean source \ |
b3efde23 | 337 | $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \ |
747b16dd | 338 | $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \ |
cb5710c5 | 339 | $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ |
397fe5cc | 340 | $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR) |
ffde94bd | 341 | |
08782ae7 EA |
342 | ############################################################# |
343 | # | |
ef407d3d | 344 | # staging and target directories do NOT list these as |
d99c31c6 | 345 | # dependencies anywhere else |
08782ae7 EA |
346 | # |
347 | ############################################################# | |
cb5710c5 | 348 | $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR): |
8d583fc0 | 349 | @mkdir -p $@ |
3ad3d8a1 | 350 | |
08782ae7 | 351 | $(STAGING_DIR): |
9c865d75 | 352 | @mkdir -p $(STAGING_DIR)/bin |
bf38723f | 353 | @mkdir -p $(STAGING_DIR)/lib |
8027784c | 354 | @mkdir -p $(STAGING_DIR)/usr/lib |
8027784c | 355 | @mkdir -p $(STAGING_DIR)/usr/include |
a05c337d | 356 | @mkdir -p $(STAGING_DIR)/usr/bin |
ffde94bd | 357 | |
2b3a43f4 DM |
358 | ifeq ($(BR2_ROOTFS_SKELETON_CUSTOM),y) |
359 | TARGET_SKELETON=$(BR2_ROOTFS_SKELETON_CUSTOM_PATH) | |
360 | endif | |
361 | ||
397fe5cc | 362 | $(BUILD_DIR)/.root: |
7547c7eb | 363 | mkdir -p $(TARGET_DIR) |
f0ca4b82 BRF |
364 | if ! [ -d "$(TARGET_DIR)/bin" ]; then \ |
365 | if [ -d "$(TARGET_SKELETON)" ]; then \ | |
18d979c7 | 366 | cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \ |
74cda1e4 | 367 | fi; \ |
edb5ca9c MG |
368 | if [ -d "$(TARGET_SKELETON_PATCH)" ]; then \ |
369 | toolchain/patch-kernel.sh $(TARGET_DIR) $(TARGET_SKELETON_PATCH)/ \*patch\*; \ | |
370 | fi; \ | |
18d979c7 | 371 | touch $(STAGING_DIR)/.fakeroot.00000; \ |
f0ca4b82 | 372 | fi |
fc3eb18b | 373 | -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf |
b9656e81 | 374 | -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf |
7547c7eb | 375 | touch $@ |
08782ae7 | 376 | |
397fe5cc | 377 | $(TARGET_DIR): $(BUILD_DIR)/.root |
c6771dfb | 378 | |
c2fc93bc | 379 | erase-fakeroots: |
397fe5cc | 380 | rm -f $(BUILD_DIR)/.fakeroot* |
412ca2a4 | 381 | |
32faf351 | 382 | target-finalize: |
d45de0ca JV |
383 | ifeq ($(BR2_HAVE_DEVFILES),y) |
384 | ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) ) | |
bc67ca29 | 385 | else |
bea9e43f | 386 | rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/lib/pkgconfig $(TARGET_DIR)/usr/share/aclocal |
027aa1d2 WB |
387 | find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f |
388 | find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f | |
bc67ca29 | 389 | endif |
e48a72e5 MS |
390 | ifneq ($(BR2_PACKAGE_GDB),y) |
391 | rm -rf $(TARGET_DIR)/usr/share/gdb | |
392 | endif | |
87b0637b | 393 | ifneq ($(BR2_HAVE_DOCUMENTATION),y) |
32faf351 | 394 | rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man |
32faf351 | 395 | rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info |
87b0637b | 396 | rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc |
d701a823 | 397 | rm -rf $(TARGET_DIR)/usr/share/gtk-doc |
32faf351 PK |
398 | endif |
399 | find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true | |
4ccde7fa TP |
400 | mkdir -p $(TARGET_DIR)/etc |
401 | # Mandatory configuration file and auxilliary cache directory | |
402 | # for recent versions of ldconfig | |
403 | touch $(TARGET_DIR)/etc/ld.so.conf | |
404 | mkdir -p $(TARGET_DIR)/var/cache/ldconfig | |
e49e2fed PK |
405 | if [ -x "$(TARGET_CROSS)ldconfig" ]; \ |
406 | then \ | |
4ccde7fa | 407 | $(TARGET_CROSS)ldconfig -r $(TARGET_DIR); \ |
e49e2fed | 408 | else \ |
4ccde7fa | 409 | /sbin/ldconfig -r $(TARGET_DIR); \ |
e49e2fed | 410 | fi |
912ea81a PK |
411 | echo $(BR2_VERSION)$(shell $(TOPDIR)/scripts/setlocalversion) > \ |
412 | $(TARGET_DIR)/etc/br-version | |
413 | ||
eed7d873 DM |
414 | ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"") |
415 | $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR) | |
416 | endif | |
417 | ||
b87b4742 | 418 | ifeq ($(BR2_ENABLE_LOCALE_PURGE),y) |
397fe5cc | 419 | LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge |
6cdf2481 | 420 | LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST)) |
b87b4742 PK |
421 | |
422 | target-purgelocales: | |
423 | rm -f $(LOCALE_WHITELIST) | |
424 | for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done | |
425 | ||
426 | for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \ | |
427 | do \ | |
428 | for lang in $$(cd $$dir; ls .|grep -v man); \ | |
429 | do \ | |
430 | grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \ | |
431 | done; \ | |
432 | done | |
433 | endif | |
434 | ||
3b08e64d | 435 | source: $(TARGETS_SOURCE) $(HOST_SOURCE) |
08782ae7 | 436 | |
6547bced | 437 | _source-check: |
07b2af1a | 438 | @echo "TODO $@" |
825ff341 | 439 | |
155971e0 | 440 | external-deps: |
07b2af1a | 441 | @echo "TODO $@" |
155971e0 | 442 | |
b7d6c8ad TP |
443 | show-targets: |
444 | @echo $(TARGETS) | |
445 | ||
b5972138 | 446 | ifeq ($(BR2_CONFIG_CACHE),y) |
26082e79 TP |
447 | # drop configure caches if configuration is changed |
448 | $(BUILD_DIR)/tgt-config.cache $(BUILD_DIR)/host-config.cache: $(CONFIG_DIR)/.config | |
b5972138 PK |
449 | rm -f $@ |
450 | touch $@ | |
451 | ||
26082e79 | 452 | $(BASE_TARGETS): | $(BUILD_DIR)/tgt-config.cache $(BUILD_DIR)/host-config.cache |
b5972138 PK |
453 | endif |
454 | ||
cfe511b2 | 455 | else # ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
2d523c23 EA |
456 | |
457 | all: menuconfig | |
458 | ||
459 | # configuration | |
460 | # --------------------------------------------------------------------------- | |
461 | ||
c0d7d4e0 BRF |
462 | HOSTCFLAGS=$(CFLAGS_FOR_BUILD) |
463 | export HOSTCFLAGS | |
464 | ||
2cc210c9 PK |
465 | $(BUILD_DIR)/buildroot-config/%onf: |
466 | mkdir -p $(@D)/lxdialog | |
7c524dd0 | 467 | $(MAKE) CC="$(HOSTCC)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F) |
2d523c23 | 468 | |
1039eb74 TP |
469 | COMMON_CONFIG_ENV = \ |
470 | KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \ | |
471 | KCONFIG_AUTOHEADER=$(BUILD_DIR)/buildroot-config/autoconf.h \ | |
0b368800 | 472 | KCONFIG_TRISTATE=$(BUILD_DIR)/buildroot-config/tristate.config \ |
1039eb74 | 473 | BUILDROOT_CONFIG=$(CONFIG_DIR)/.config |
2d523c23 | 474 | |
2cc210c9 | 475 | xconfig: $(BUILD_DIR)/buildroot-config/qconf |
39ca6d50 | 476 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 477 | @if ! $(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN); then \ |
39ca6d50 | 478 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
b0df9df3 AY |
479 | fi |
480 | ||
2cc210c9 | 481 | gconfig: $(BUILD_DIR)/buildroot-config/gconf |
39ca6d50 | 482 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 TP |
483 | @if ! $(COMMON_CONFIG_ENV) srctree=$(TOPDIR) \ |
484 | $< $(CONFIG_CONFIG_IN); then \ | |
39ca6d50 | 485 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
2b42aae7 PK |
486 | fi |
487 | ||
2cc210c9 | 488 | menuconfig: $(BUILD_DIR)/buildroot-config/mconf |
39ca6d50 | 489 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 490 | @if ! $(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN); then \ |
39ca6d50 | 491 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
153b1bea | 492 | fi |
2d523c23 | 493 | |
8b6585a9 TP |
494 | nconfig: $(BUILD_DIR)/buildroot-config/nconf |
495 | @mkdir -p $(BUILD_DIR)/buildroot-config | |
1039eb74 | 496 | @if ! $(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN); then \ |
39ca6d50 | 497 | test -f $(CONFIG_DIR)/.config.cmd || rm -f $(CONFIG_DIR)/.config; \ |
153b1bea | 498 | fi |
2d523c23 | 499 | |
2cc210c9 | 500 | config: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 | 501 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 502 | @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN) |
2d523c23 | 503 | |
2cc210c9 | 504 | oldconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 | 505 | mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 506 | @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 507 | |
2cc210c9 | 508 | randconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 | 509 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 510 | @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 511 | |
2cc210c9 | 512 | allyesconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 | 513 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 514 | @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 515 | |
cf4689f8 | 516 | allnoconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 | 517 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 518 | @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 519 | |
2cc210c9 | 520 | randpackageconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 WW |
521 | @mkdir -p $(BUILD_DIR)/buildroot-config |
522 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 523 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 524 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 525 | $< --randconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 526 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 527 | |
2cc210c9 | 528 | allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 WW |
529 | @mkdir -p $(BUILD_DIR)/buildroot-config |
530 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 531 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 532 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 533 | $< --allyesconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 534 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 535 | |
2cc210c9 | 536 | allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 WW |
537 | @mkdir -p $(BUILD_DIR)/buildroot-config |
538 | @grep -v BR2_PACKAGE_ $(CONFIG_DIR)/.config > $(CONFIG_DIR)/.config.nopkg | |
1039eb74 | 539 | @$(COMMON_CONFIG_ENV) \ |
39ca6d50 | 540 | KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \ |
1039eb74 | 541 | $< --allnoconfig $(CONFIG_CONFIG_IN) |
39ca6d50 | 542 | @rm -f $(CONFIG_DIR)/.config.nopkg |
6652770f | 543 | |
0b368800 TP |
544 | silentoldconfig: $(BUILD_DIR)/buildroot-config/conf |
545 | @mkdir -p $(BUILD_DIR)/buildroot-config | |
546 | $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN) | |
547 | ||
2cc210c9 | 548 | defconfig: $(BUILD_DIR)/buildroot-config/conf |
39ca6d50 | 549 | @mkdir -p $(BUILD_DIR)/buildroot-config |
1039eb74 | 550 | @$(COMMON_CONFIG_ENV) $< --defconfig $(CONFIG_CONFIG_IN) |
2d523c23 | 551 | |
6f38119c TP |
552 | %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig |
553 | @mkdir -p $(BUILD_DIR)/buildroot-config | |
1039eb74 | 554 | @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN) |
6f38119c | 555 | |
e1b1a18a TP |
556 | savedefconfig: $(BUILD_DIR)/buildroot-config/conf |
557 | @mkdir -p $(BUILD_DIR)/buildroot-config | |
558 | @$(COMMON_CONFIG_ENV) $< --savedefconfig=$(TOPDIR)/defconfig $(CONFIG_CONFIG_IN) | |
2d523c23 | 559 | |
6547bced | 560 | # check if download URLs are outdated |
825ff341 | 561 | source-check: allyesconfig |
de846f6e | 562 | $(MAKE) $(EXTRAMAKEARGS) _source-check |
825ff341 | 563 | |
406053d5 PK |
564 | endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y) |
565 | ||
2d523c23 EA |
566 | ############################################################# |
567 | # | |
568 | # Cleanup and misc junk | |
569 | # | |
570 | ############################################################# | |
571 | clean: | |
406053d5 PK |
572 | rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \ |
573 | $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR) | |
2d523c23 EA |
574 | |
575 | distclean: clean | |
406053d5 PK |
576 | ifeq ($(DL_DIR),$(TOPDIR)/dl) |
577 | rm -rf $(DL_DIR) | |
578 | endif | |
579 | ifeq ($(O),output) | |
580 | rm -rf $(O) | |
581 | endif | |
39ca6d50 | 582 | rm -rf $(CONFIG_DIR)/.config $(CONFIG_DIR)/.config.old $(CONFIG_DIR)/.config.cmd $(CONFIG_DIR)/.auto.deps |
2d523c23 | 583 | |
260d3b4a | 584 | flush: |
26082e79 | 585 | rm -f $(BUILD_DIR)/tgt-config.cache $(BUILD_DIR)/host-config.cache |
260d3b4a | 586 | |
5459a9c5 | 587 | configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config |
b8f28d65 | 588 | |
126bb72f US |
589 | prepatch: gcc-patched binutils-patched gdb-patched uclibc-patched |
590 | ||
b8f28d65 US |
591 | cross: $(BASE_TARGETS) |
592 | ||
e491fba2 BRF |
593 | help: |
594 | @echo 'Cleaning:' | |
406053d5 | 595 | @echo ' clean - delete all files created by build' |
e491fba2 BRF |
596 | @echo ' distclean - delete all non-source files (including .config)' |
597 | @echo | |
598 | @echo 'Build:' | |
599 | @echo ' all - make world' | |
600 | @echo | |
601 | @echo 'Configuration:' | |
602 | @echo ' menuconfig - interactive curses-based configurator' | |
c48bbb8c | 603 | @echo ' xconfig - interactive Qt-based configurator' |
2b42aae7 | 604 | @echo ' gconfig - interactive GTK-based configurator' |
e491fba2 | 605 | @echo ' oldconfig - resolve any unresolved symbols in .config' |
c48bbb8c PK |
606 | @echo ' randconfig - New config with random answer to all options' |
607 | @echo ' defconfig - New config with default answer to all options' | |
608 | @echo ' allyesconfig - New config where all options are accepted with yes' | |
609 | @echo ' allnoconfig - New config where all options are answered with no' | |
6652770f PK |
610 | @echo ' randpackageconfig - New config with random answer to package options' |
611 | @echo ' allyespackageconfig - New config where pkg options are accepted with yes' | |
612 | @echo ' allnopackageconfig - New config where package options are answered with no' | |
7b2ec610 | 613 | @echo ' configured - make {uclibc/busybox/linux26}-config' |
e491fba2 BRF |
614 | @echo |
615 | @echo 'Miscellaneous:' | |
616 | @echo ' source - download all sources needed for offline-build' | |
03380402 | 617 | @echo ' source-check - check all packages for valid download URLs' |
155971e0 | 618 | @echo ' external-deps - list external packages used' |
13a85e3c | 619 | @echo ' flush - flush configuration cache' |
e491fba2 | 620 | @echo |
58fd779a PK |
621 | @$(foreach b, $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig)), \ |
622 | printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);) | |
623 | @echo | |
232fa7ee | 624 | @echo 'See docs/README and docs/buildroot.html for further details' |
663dee48 | 625 | @echo |
ba2e7e02 | 626 | |
23ddf460 | 627 | release: |
e62d2ecd | 628 | OUT=buildroot-$$(grep -A2 BR2_VERSION $(CONFIG_CONFIG_IN)|grep default|cut -f2 -d\"); \ |
23ddf460 | 629 | git archive --format=tar --prefix=$$OUT/ master|gzip -9 >$$OUT.tar.gz |
e62d2ecd | 630 | |
6652770f | 631 | .PHONY: $(noconfig_targets) |
50cbb4a1 | 632 |