]> Git Repo - buildroot-mgba.git/blame - Makefile
Use /usr/include as std include in Xorg
[buildroot-mgba.git] / Makefile
CommitLineData
2d523c23 1# Makefile for buildroot2
ffde94bd 2#
15b26aee 3# Copyright (C) 1999-2005 by Erik Andersen <[email protected]>
ffde94bd 4#
08782ae7 5# This program is free software; you can redistribute it and/or modify
2d523c23
EA
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
ffde94bd 9#
2d523c23
EA
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
08782ae7 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2d523c23 13# General Public License for more details.
ffde94bd 14#
2d523c23
EA
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3ad3d8a1 18#
02bf5816 19
2d523c23
EA
20#--------------------------------------------------------------
21# Just run 'make menuconfig', configure stuff, then run 'make'.
22# You shouldn't need to mess with anything beyond this point...
23#--------------------------------------------------------------
24TOPDIR=./
25CONFIG_CONFIG_IN = Config.in
26CONFIG_DEFCONFIG = .defconfig
27CONFIG = package/config
7def5559 28DATE:=$(shell date -u +%Y%m%d)
a0aef7c4 29
2d523c23 30noconfig_targets := menuconfig config oldconfig randconfig \
0c1e709e 31 defconfig allyesconfig allnoconfig release tags \
e491fba2 32 source-check help
9e250356
BRF
33
34# $(shell find . -name *_defconfig |sed 's/.*\///')
cad58108 35
2d523c23
EA
36# Pull in the user's configuration file
37ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
38-include $(TOPDIR).config
39endif
9741a49e 40
afc61c6e
BRF
41# To put more focus on warnings, be less verbose as default
42# Use 'make V=1' to see the full commands
43ifdef V
44 ifeq ("$(origin V)", "command line")
45 KBUILD_VERBOSE = $(V)
46 endif
47endif
48ifndef KBUILD_VERBOSE
49 KBUILD_VERBOSE = 0
50endif
51
52ifeq ($(KBUILD_VERBOSE),1)
4df454e9 53 quiet=
afc61c6e
BRF
54 Q =
55else
56 quiet=quiet_
57 Q = @
58endif
59
60CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
61 else if [ -x /bin/bash ]; then echo /bin/bash; \
62 else echo sh; fi ; fi)
63
64export CONFIG_SHELL quiet Q KBUILD_VERBOSE
65
66ifndef HOSTAR
67HOSTAR:=ar
68endif
69ifndef HOSTAS
70HOSTAS:=as
71endif
72ifndef HOSTCC
73HOSTCC:=gcc
74else
75endif
76ifndef HOSTCXX
77HOSTCXX:=g++
78endif
79ifndef HOSTLD
80HOSTLD:=ld
81endif
0f9c5b11
US
82ifndef HOSTLN
83HOSTLN:=ln
84endif
83832cda
US
85HOSTAR :=$(shell $(CONFIG_SHELL) -c "which $(HOSTAR)" || type -p $(HOSTAR) || echo ar)
86HOSTAS :=$(shell $(CONFIG_SHELL) -c "which $(HOSTAS)" || type -p $(HOSTAS) || echo as)
87HOSTCC :=$(shell $(CONFIG_SHELL) -c "which $(HOSTCC)" || type -p $(HOSTCC) || echo gcc)
88HOSTCXX:=$(shell $(CONFIG_SHELL) -c "which $(HOSTCXX)" || type -p $(HOSTCXX) || echo g++)
89HOSTLD :=$(shell $(CONFIG_SHELL) -c "which $(HOSTLD)" || type -p $(HOSTLD) || echo ld)
0f9c5b11 90HOSTLN :=$(shell $(CONFIG_SHELL) -c "which $(HOSTLN)" || type -p $(HOSTLN) || echo ln)
afc61c6e 91ifndef CFLAGS_FOR_BUILD
f987b7a5 92CFLAGS_FOR_BUILD:=-g -O2
afc61c6e
BRF
93endif
94export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTLD
95
96
2d523c23 97ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
54e098e4 98
99cf7293
BRF
99# cc-option
100# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
101# sets -march=winchip-c6 if supported else falls back to -march=i586
102# without checking the latter.
103cc-option = $(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
104 > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
105
2c649045
PK
106#############################################################
107#
108# Hide troublesome environment variables from sub processes
109#
110#############################################################
111unexport CROSS_COMPILE
112unexport ARCH
27bc59d4 113
08782ae7
EA
114#############################################################
115#
c6e43c9d 116# Setup the proper filename extensions for the host
08782ae7 117#
7dcbbfbb
BRF
118##############################################################
119ifneq ($(findstring linux,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
120HOST_EXEEXT:=
121HOST_LIBEXT:=.a
122HOST_SHREXT:=.so
3096f34d 123endif
7dcbbfbb 124ifneq ($(findstring apple,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
125HOST_EXEEXT:=
126HOST_LIBEXT:=.a
127HOST_SHREXT:=.dylib
3096f34d 128endif
7dcbbfbb 129ifneq ($(findstring cygwin,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
130HOST_EXEEXT:=.exe
131HOST_LIBEXT:=.lib
132HOST_SHREXT:=.dll
3096f34d 133endif
7dcbbfbb 134ifneq ($(findstring mingw,$(BR2_GNU_BUILD_SUFFIX)),)
c6e43c9d
BRF
135HOST_EXEEXT:=.exe
136HOST_LIBEXT:=.lib
137HOST_SHREXT:=.dll
3096f34d 138endif
cb7d5b81 139
c6e43c9d 140# The preferred type of libs we build for the target
3096f34d 141ifeq ($(BR2_PREFER_STATIC_LIB),y)
c6e43c9d 142LIBTGTEXT=.a
8027784c 143#PREFERRED_LIB_FLAGS:=--disable-shared --enable-static
3096f34d 144else
c6e43c9d 145LIBTGTEXT=.so
8027784c 146#PREFERRED_LIB_FLAGS:=--disable-static --enable-shared
3096f34d 147endif
8027784c 148PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
ffde94bd 149
6ad07203 150BR2_DEPENDS_DIR=$(BASE_DIR)/package/config/buildroot-config/
7dcbbfbb 151
6ad07203 152##############################################################
7dcbbfbb
BRF
153#
154# The list of stuff to build for the target toolchain
155# along with the packages to build for the target.
156#
157##############################################################
158ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
acc706b7 159BASE_TARGETS:=uclibc-configured binutils gcc uclibc-target-utils
7dcbbfbb 160else
acc706b7 161BASE_TARGETS:=uclibc
7dcbbfbb 162endif
acc706b7
BRF
163TARGETS:=
164
f958d897 165include project/Makefile.in
7dcbbfbb
BRF
166include toolchain/Makefile.in
167include package/Makefile.in
168
169#############################################################
170#
171# You should probably leave this stuff alone unless you know
172# what you are doing.
173#
174#############################################################
175
08782ae7 176all: world
ffde94bd 177
2d523c23
EA
178# In this section, we need .config
179include .config.cmd
180
f958d897
US
181include project/*.mk
182
d06645d8
EA
183# We also need the various per-package makefiles, which also add
184# each selected package to TARGETS if that package was selected
185# in the .config file.
acc706b7
BRF
186ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
187# avoid pulling in external toolchain which is broken for toplvl parallel builds
188include $(filter-out $(wildcard toolchain/external-toolchain/*),$(wildcard toolchain/*/*.mk))
189else
d06645d8 190include toolchain/*/*.mk
acc706b7
BRF
191endif
192
62b5ae4b
SH
193ifeq ($(BR2_PACKAGE_LINUX),y)
194TARGETS+=linux26-modules
195endif
acc706b7 196
d06645d8 197include package/*/*.mk
d06645d8 198
79f5f1e8
EA
199# target stuff is last so it can override anything else
200include target/Makefile.in
201
08782ae7 202TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
a5c23541 203TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS))
08782ae7 204TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
ffde94bd 205
acc706b7
BRF
206# all targets depend on the crosscompiler and it's prerequisites
207$(TARGETS): $(BASE_TARGETS)
208
5ef9e52b
BRF
209dirs: $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
210 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
f958d897 211
5ef9e52b 212$(BASE_TARGETS): dirs
f958d897 213
69d692e4 214world: dependencies dirs target-host-info $(BASE_TARGETS) $(TARGETS)
ffde94bd 215
5ef9e52b 216
f958d897 217.PHONY: all world dirs clean dirclean distclean source \
5ef9e52b 218 $(BASE_TARGETS) $(TARGETS) \
747b16dd 219 $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
5ef9e52b
BRF
220 $(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
221 $(BINARIES_DIR) $(PROJECT_BUILD_DIR)
ffde94bd 222
08782ae7
EA
223#############################################################
224#
ef407d3d 225# staging and target directories do NOT list these as
d99c31c6 226# dependencies anywhere else
08782ae7
EA
227#
228#############################################################
5ef9e52b 229$(DL_DIR) $(TOOL_BUILD_DIR) $(BUILD_DIR) \
74cda1e4 230 $(PROJECT_BUILD_DIR) $(BINARIES_DIR) $(TARGET_DIR):
8d583fc0 231 @mkdir -p $@
3ad3d8a1 232
08782ae7 233$(STAGING_DIR):
9c865d75 234 @mkdir -p $(STAGING_DIR)/bin
bf38723f 235 @mkdir -p $(STAGING_DIR)/lib
7e0c890c 236ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
8027784c
BRF
237 @mkdir -p $(STAGING_DIR)/usr/lib
238else
239 @ln -snf . $(STAGING_DIR)/usr
240 @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)
3da708e4 241 @ln -snf ../lib $(STAGING_DIR)/usr/lib
8027784c
BRF
242 @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
243endif
244 @mkdir -p $(STAGING_DIR)/usr/include
ffde94bd 245
74cda1e4
US
246$(PROJECT_BUILD_DIR)/.root: $(TARGET_DIR)
247 if ! [ -d "$(TARGET_DIR)/bin" ] ; then \
248 @echo "Rebuilding TARGET_DIR" ; \
249 if [ -d "$(TARGET_SKELETON)" ] ; then \
250 cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
251 fi; \
252 touch $(STAGING_DIR)/.fakeroot.00000 ; \
253 -find $(TARGET_DIR) -type d -name CVS | xargs rm -rf ; \
254 -find $(TARGET_DIR) -type d -name .svn | xargs rm -rf ; \
bb15c221 255 fi;
74cda1e4 256 touch $@
08782ae7 257
412ca2a4 258
73be7f9e 259source: $(TARGETS_SOURCE) $(HOST_SOURCE)
08782ae7 260
e7c08c29
US
261_source-check:
262 $(MAKE) SPIDER=--spider source
825ff341 263
08782ae7
EA
264#############################################################
265#
266# Cleanup and misc junk
267#
268#############################################################
269clean: $(TARGETS_CLEAN)
3ad3d8a1 270 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
08782ae7
EA
271
272dirclean: $(TARGETS_DIRCLEAN)
3ad3d8a1 273 rm -rf $(STAGING_DIR) $(TARGET_DIR) $(IMAGE)
08782ae7
EA
274
275distclean:
5bc1f0c3
MF
276ifeq ($(DL_DIR),$(BASE_DIR)/dl)
277 rm -rf $(DL_DIR)
278endif
412ca2a4
US
279 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR) \
280 $(LINUX_KERNEL) $(IMAGE) $(BASE_DIR)/include \
81df2264 281 .config.cmd
b5136193 282 $(MAKE) -C $(CONFIG) clean
08782ae7 283
3ad3d8a1 284sourceball:
412ca2a4 285 rm -rf $(BUILD_DIR) $(PROJECT_BUILD_DIR) $(BINARIES_DIR)
08782ae7
EA
286 set -e; \
287 cd ..; \
288 rm -f buildroot.tar.bz2; \
289 tar -cvf buildroot.tar buildroot; \
290 bzip2 -9 buildroot.tar; \
2d523c23
EA
291
292
293else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
294
295all: menuconfig
296
297# configuration
298# ---------------------------------------------------------------------------
299
c0d7d4e0
BRF
300HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
301export HOSTCFLAGS
302
2d523c23 303$(CONFIG)/conf:
fb2c8fec 304 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf
2d523c23
EA
305 -@if [ ! -f .config ] ; then \
306 cp $(CONFIG_DEFCONFIG) .config; \
307 fi
308$(CONFIG)/mconf:
fb2c8fec 309 $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf mconf
2d523c23
EA
310 -@if [ ! -f .config ] ; then \
311 cp $(CONFIG_DEFCONFIG) .config; \
312 fi
313
314menuconfig: $(CONFIG)/mconf
62b5ae4b 315 @-mkdir -p $(CONFIG)/buildroot-config
153b1bea 316 @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
62b5ae4b 317 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
153b1bea
BRF
318 $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
319 test -f .config.cmd || rm -f .config; \
320 fi
2d523c23
EA
321
322config: $(CONFIG)/conf
62b5ae4b
SH
323 @-mkdir -p $(CONFIG)/buildroot-config
324 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
325 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
f987b7a5 326 $(CONFIG)/conf $(CONFIG_CONFIG_IN)
2d523c23
EA
327
328oldconfig: $(CONFIG)/conf
62b5ae4b
SH
329 @-mkdir -p $(CONFIG)/buildroot-config
330 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
331 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
f987b7a5 332 $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
2d523c23
EA
333
334randconfig: $(CONFIG)/conf
62b5ae4b
SH
335 @-mkdir -p $(CONFIG)/buildroot-config
336 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
337 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
f987b7a5 338 $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
2d523c23
EA
339
340allyesconfig: $(CONFIG)/conf
f987b7a5 341 cat $(CONFIG_DEFCONFIG) > .config
62b5ae4b
SH
342 @-mkdir -p $(CONFIG)/buildroot-config
343 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
344 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
f987b7a5 345 $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
2d523c23 346 #sed -i -e "s/^CONFIG_DEBUG.*/# CONFIG_DEBUG is not set/" .config
2d523c23
EA
347
348allnoconfig: $(CONFIG)/conf
62b5ae4b
SH
349 @-mkdir -p $(CONFIG)/buildroot-config
350 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
351 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
f987b7a5 352 $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
2d523c23
EA
353
354defconfig: $(CONFIG)/conf
62b5ae4b
SH
355 @-mkdir -p $(CONFIG)/buildroot-config
356 @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
357 KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
f987b7a5 358 $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
2d523c23 359
825ff341
BRF
360# check if download URLs are outdated
361source-check: allyesconfig
362 $(MAKE) _source-check
363
2d523c23
EA
364#############################################################
365#
366# Cleanup and misc junk
367#
368#############################################################
369clean:
370 rm -f .config .config.old .config.cmd .tmpconfig.h
371 - $(MAKE) -C $(CONFIG) clean
372
373distclean: clean
374 rm -rf sources/*
375
376endif # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
377
ba2e7e02
BRF
378%_defconfig: $(CONFIG)/conf
379 cp $(shell find ./target/ -name $@) .config
380 @$(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
381
e491fba2
BRF
382help:
383 @echo 'Cleaning:'
384 @echo ' clean - delete temporary files created by build'
385 @echo ' distclean - delete all non-source files (including .config)'
386 @echo
387 @echo 'Build:'
388 @echo ' all - make world'
389 @echo
390 @echo 'Configuration:'
391 @echo ' menuconfig - interactive curses-based configurator'
392 @echo ' oldconfig - resolve any unresolved symbols in .config'
393 @echo
394 @echo 'Miscellaneous:'
395 @echo ' source - download all sources needed for offline-build'
396 @echo ' source-check - check all packages for valid download URLS'
397 @echo
ba2e7e02 398
2d523c23 399.PHONY: dummy subdirs release distclean clean config oldconfig \
e491fba2 400 menuconfig tags check test depend defconfig help
2d523c23
EA
401
402
This page took 0.146391 seconds and 4 git commands to generate.