Makefile 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. # Makefile for buildroot2
  2. #
  3. # Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
  4. # Copyright (C) 2006-2010 by the Buildroot developers <buildroot@uclibc.org>
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  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.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # General Public License for more details.
  15. #
  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
  19. #
  20. #--------------------------------------------------------------
  21. # Just run 'make menuconfig', configure stuff, then run 'make'.
  22. # You shouldn't need to mess with anything beyond this point...
  23. #--------------------------------------------------------------
  24. # absolute path
  25. TOPDIR:=$(shell pwd)
  26. CONFIG_CONFIG_IN=Config.in
  27. CONFIG_DEFCONFIG=.defconfig
  28. CONFIG=package/config
  29. DATE:=$(shell date +%Y%m%d)
  30. noconfig_targets:=menuconfig xconfig config oldconfig randconfig \
  31. defconfig allyesconfig allnoconfig release \
  32. randpackageconfig allyespackageconfig allnopackageconfig \
  33. source-check help
  34. # Strip quotes and then whitespaces
  35. qstrip=$(strip $(subst ",,$(1)))
  36. #"))
  37. # Variables for use in Make constructs
  38. comma:=,
  39. empty:=
  40. space:=$(empty) $(empty)
  41. # $(shell find . -name *_defconfig |sed 's/.*\///')
  42. # Pull in the user's configuration file
  43. ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
  44. -include .config
  45. endif
  46. # Override BR2_DL_DIR if shell variable defined
  47. ifneq ($(BUILDROOT_DL_DIR),)
  48. BR2_DL_DIR:=$(BUILDROOT_DL_DIR)
  49. endif
  50. # To put more focus on warnings, be less verbose as default
  51. # Use 'make V=1' to see the full commands
  52. ifdef V
  53. ifeq ("$(origin V)", "command line")
  54. KBUILD_VERBOSE=$(V)
  55. endif
  56. endif
  57. ifndef KBUILD_VERBOSE
  58. KBUILD_VERBOSE=0
  59. endif
  60. ifeq ($(KBUILD_VERBOSE),1)
  61. quiet=
  62. Q=
  63. ifndef VERBOSE
  64. VERBOSE=1
  65. endif
  66. else
  67. quiet=quiet_
  68. Q=@
  69. endif
  70. # we want bash as shell
  71. SHELL:=$(shell if [ -x "$$BASH" ]; then echo $$BASH; \
  72. else if [ -x /bin/bash ]; then echo /bin/bash; \
  73. else echo sh; fi; fi)
  74. # kconfig uses CONFIG_SHELL
  75. CONFIG_SHELL:=$(SHELL)
  76. export SHELL CONFIG_SHELL quiet Q KBUILD_VERBOSE VERBOSE
  77. ifndef HOSTAR
  78. HOSTAR:=ar
  79. endif
  80. ifndef HOSTAS
  81. HOSTAS:=as
  82. endif
  83. ifndef HOSTCC
  84. HOSTCC:=gcc
  85. else
  86. endif
  87. ifndef HOSTCXX
  88. HOSTCXX:=g++
  89. endif
  90. ifndef HOSTFC
  91. HOSTFC:=gfortran
  92. endif
  93. ifndef HOSTCPP
  94. HOSTCPP:=cpp
  95. endif
  96. ifndef HOSTLD
  97. HOSTLD:=ld
  98. endif
  99. ifndef HOSTLN
  100. HOSTLN:=ln
  101. endif
  102. ifndef HOSTNM
  103. HOSTNM:=nm
  104. endif
  105. HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
  106. HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
  107. HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
  108. HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
  109. HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
  110. HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
  111. HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
  112. HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
  113. HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)
  114. ifndef CFLAGS_FOR_BUILD
  115. CFLAGS_FOR_BUILD:=-g -O2
  116. endif
  117. ifndef CXXFLAGS_FOR_BUILD
  118. CXXFLAGS_FOR_BUILD:=-g -O2
  119. endif
  120. ifndef FCFLAGS_FOR_BUILD
  121. FCFLAGS_FOR_BUILD:=-g -O2
  122. endif
  123. export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
  124. ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  125. # cc-option
  126. # Usage: cflags-y+=$(call cc-option, -march=winchip-c6, -march=i586)
  127. # sets -march=winchip-c6 if supported else falls back to -march=i586
  128. # without checking the latter.
  129. cc-option=$(shell if $(TARGET_CC) $(TARGET_CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
  130. > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
  131. #############################################################
  132. #
  133. # Hide troublesome environment variables from sub processes
  134. #
  135. #############################################################
  136. unexport CROSS_COMPILE
  137. unexport ARCH
  138. GNU_HOST_NAME=$(shell package/gnuconfig/config.guess)
  139. #############################################################
  140. #
  141. # Setup the proper filename extensions for the host
  142. #
  143. ##############################################################
  144. ifneq ($(findstring linux,$(GNU_HOST_NAME)),)
  145. HOST_EXEEXT:=
  146. HOST_LIBEXT:=.a
  147. HOST_SHREXT:=.so
  148. endif
  149. ifneq ($(findstring apple,$(GNU_HOST_NAME)),)
  150. HOST_EXEEXT:=
  151. HOST_LIBEXT:=.a
  152. HOST_SHREXT:=.dylib
  153. endif
  154. ifneq ($(findstring cygwin,$(GNU_HOST_NAME)),)
  155. HOST_EXEEXT:=.exe
  156. HOST_LIBEXT:=.lib
  157. HOST_SHREXT:=.dll
  158. HOST_LOADLIBES="-lcurses -lintl"
  159. export HOST_LOADLIBES
  160. endif
  161. ifneq ($(findstring mingw,$(GNU_HOST_NAME)),)
  162. HOST_EXEEXT:=.exe
  163. HOST_LIBEXT:=.lib
  164. HOST_SHREXT:=.dll
  165. endif
  166. # The preferred type of libs we build for the target
  167. ifeq ($(BR2_PREFER_STATIC_LIB),y)
  168. LIBTGTEXT=.a
  169. #PREFERRED_LIB_FLAGS:=--disable-shared --enable-static
  170. else
  171. LIBTGTEXT=.so
  172. #PREFERRED_LIB_FLAGS:=--disable-static --enable-shared
  173. endif
  174. PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
  175. ##############################################################
  176. #
  177. # The list of stuff to build for the target toolchain
  178. # along with the packages to build for the target.
  179. #
  180. ##############################################################
  181. ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
  182. BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers
  183. else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
  184. BASE_TARGETS:=uclibc
  185. endif
  186. TARGETS:=
  187. # silent mode requested?
  188. QUIET:=$(if $(findstring s,$(MAKEFLAGS)),-q)
  189. # Strip off the annoying quoting
  190. ARCH:=$(call qstrip,$(BR2_ARCH))
  191. ifeq ($(ARCH),xtensa)
  192. ARCH:=$(ARCH)_$(call qstrip,$(BR2_xtensa_core_name))
  193. endif
  194. WGET:=$(call qstrip,$(BR2_WGET)) $(SPIDER) $(QUIET)
  195. SVN_CO:=$(call qstrip,$(BR2_SVN_CO)) $(QUIET)
  196. SVN_UP:=$(call qstrip,$(BR2_SVN_UP)) $(QUIET)
  197. BZR_CO:=$(call qstrip,$(BR2_BZR_CO)) $(QUIET)
  198. BZR_UP:=$(call qstrip,$(BR2_BZR_UP)) $(QUIET)
  199. GIT:=$(call qstrip,$(BR2_GIT)) $(QUIET)
  200. ZCAT:=$(call qstrip,$(BR2_ZCAT))
  201. BZCAT:=$(call qstrip,$(BR2_BZCAT))
  202. TAR_OPTIONS=$(call qstrip,$(BR2_TAR_OPTIONS)) -xf
  203. ifneq ("$(origin O)", "command line")
  204. O:=output
  205. else
  206. # other packages might also support Linux-style out of tree builds
  207. # with the O=<dir> syntax (E.G. Busybox does). As make automatically
  208. # forwards command line variable definitions those packages get very
  209. # confused. Fix this by telling make to not do so
  210. MAKEOVERRIDES =
  211. # strangely enough O is still passed to submakes with MAKEOVERRIDES
  212. # (with make 3.81 atleast), the only thing that changes is the output
  213. # of the origin function (command line -> environment).
  214. # Unfortunately some packages don't look at origin (E.G. uClibc 0.9.31+)
  215. # To really make O go away, we have to override it.
  216. override O:=$(O)
  217. endif
  218. # bash prints the name of the directory on 'cd <dir>' if CDPATH is
  219. # set, so unset it here to not cause problems. Notice that the export
  220. # line doesn't affect the environment of $(shell ..) calls, so
  221. # explictly throw away any output from 'cd' here.
  222. export CDPATH:=
  223. BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
  224. $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
  225. DL_DIR=$(call qstrip,$(BR2_DL_DIR))
  226. ifeq ($(DL_DIR),)
  227. DL_DIR:=$(TOPDIR)/dl
  228. endif
  229. BUILD_DIR:=$(BASE_DIR)/build
  230. GNU_TARGET_SUFFIX:=-$(call qstrip,$(BR2_GNU_TARGET_SUFFIX))
  231. STAGING_DIR:=$(call qstrip,$(BR2_STAGING_DIR))
  232. # packages compiled for the host goes here
  233. HOST_DIR:=$(BASE_DIR)/host
  234. # stamp (dependency) files go here
  235. STAMP_DIR:=$(BASE_DIR)/stamps
  236. BINARIES_DIR:=$(BASE_DIR)/images
  237. TARGET_DIR:=$(BASE_DIR)/target
  238. BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config
  239. include toolchain/Makefile.in
  240. include package/Makefile.in
  241. #############################################################
  242. #
  243. # You should probably leave this stuff alone unless you know
  244. # what you are doing.
  245. #
  246. #############################################################
  247. all: world
  248. # In this section, we need .config
  249. include .config.cmd
  250. # We also need the various per-package makefiles, which also add
  251. # each selected package to TARGETS if that package was selected
  252. # in the .config file.
  253. ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
  254. # avoid pulling in external toolchain which is broken for toplvl parallel builds
  255. # Explicit ordering:
  256. include toolchain/dependencies/dependencies.mk
  257. include toolchain/binutils/binutils.mk
  258. include toolchain/ccache/ccache.mk
  259. include toolchain/elf2flt/elf2flt.mk
  260. include toolchain/gcc/gcc-uclibc-3.x.mk
  261. include toolchain/gcc/gcc-uclibc-4.x.mk
  262. include toolchain/gdb/gdb.mk
  263. include toolchain/kernel-headers/kernel-headers.mk
  264. include toolchain/mklibs/mklibs.mk
  265. include toolchain/sstrip/sstrip.mk
  266. include toolchain/uClibc/uclibc.mk
  267. else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
  268. include toolchain/*/*.mk
  269. endif
  270. ifeq ($(BR2_PACKAGE_LINUX),y)
  271. TARGETS+=linux26-modules
  272. endif
  273. include package/*/*.mk
  274. TARGETS+=target-finalize
  275. ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
  276. TARGETS+=target-purgelocales
  277. endif
  278. include fs/common.mk
  279. # target stuff is last so it can override anything else
  280. include target/Makefile.in
  281. TARGETS+=erase-fakeroots
  282. TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
  283. TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
  284. TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
  285. TARGETS_ALL:=$(patsubst %,__real_tgt_%,$(TARGETS))
  286. # all targets depend on the crosscompiler and it's prerequisites
  287. $(TARGETS_ALL): __real_tgt_%: $(BASE_TARGETS) %
  288. $(BR2_DEPENDS_DIR): .config
  289. rm -rf $@
  290. mkdir -p $(@D)
  291. cp -dpRf $(CONFIG)/buildroot-config $@
  292. dirs: $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
  293. $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
  294. $(BASE_TARGETS): dirs
  295. world: dependencies dirs $(BASE_TARGETS) $(TARGETS_ALL)
  296. .PHONY: all world dirs clean distclean source \
  297. $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
  298. $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) \
  299. $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
  300. $(HOST_DIR) $(BR2_DEPENDS_DIR) $(BINARIES_DIR) $(STAMP_DIR)
  301. #############################################################
  302. #
  303. # staging and target directories do NOT list these as
  304. # dependencies anywhere else
  305. #
  306. #############################################################
  307. $(DL_DIR) $(TOOLCHAIN_DIR) $(BUILD_DIR) $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR):
  308. @mkdir -p $@
  309. $(STAGING_DIR):
  310. @mkdir -p $(STAGING_DIR)/bin
  311. @mkdir -p $(STAGING_DIR)/lib
  312. ifeq ($(BR2_TOOLCHAIN_SYSROOT),y)
  313. @mkdir -p $(STAGING_DIR)/usr/lib
  314. else
  315. ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
  316. @ln -snf . $(STAGING_DIR)/usr
  317. @mkdir -p $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)
  318. @ln -snf ../lib $(STAGING_DIR)/usr/lib
  319. @ln -snf ../lib $(STAGING_DIR)/usr/$(REAL_GNU_TARGET_NAME)/lib
  320. endif
  321. endif
  322. @mkdir -p $(STAGING_DIR)/usr/include
  323. @mkdir -p $(STAGING_DIR)/usr/bin
  324. $(BUILD_DIR)/.root:
  325. mkdir -p $(TARGET_DIR)
  326. if ! [ -d "$(TARGET_DIR)/bin" ]; then \
  327. if [ -d "$(TARGET_SKELETON)" ]; then \
  328. cp -fa $(TARGET_SKELETON)/* $(TARGET_DIR)/; \
  329. fi; \
  330. if [ -d "$(TARGET_SKELETON_PATCH)" ]; then \
  331. toolchain/patch-kernel.sh $(TARGET_DIR) $(TARGET_SKELETON_PATCH)/ \*patch\*; \
  332. fi; \
  333. touch $(STAGING_DIR)/.fakeroot.00000; \
  334. fi
  335. -find $(TARGET_DIR) -type d -name CVS -print0 -o -name .svn -print0 | xargs -0 rm -rf
  336. -find $(TARGET_DIR) -type f \( -name .empty -o -name '*~' \) -print0 | xargs -0 rm -rf
  337. touch $@
  338. $(TARGET_DIR): $(BUILD_DIR)/.root
  339. erase-fakeroots:
  340. rm -f $(BUILD_DIR)/.fakeroot*
  341. target-finalize:
  342. ifeq ($(BR2_HAVE_DEVFILES),y)
  343. ( scripts/copy.sh $(STAGING_DIR) $(TARGET_DIR) )
  344. else
  345. rm -rf $(TARGET_DIR)/usr/include $(TARGET_DIR)/usr/lib/pkgconfig
  346. find $(TARGET_DIR)/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
  347. find $(TARGET_DIR)/usr/lib \( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
  348. endif
  349. ifneq ($(BR2_HAVE_DOCUMENTATION),y)
  350. rm -rf $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/man
  351. rm -rf $(TARGET_DIR)/usr/info $(TARGET_DIR)/usr/share/info
  352. rm -rf $(TARGET_DIR)/usr/doc $(TARGET_DIR)/usr/share/doc
  353. endif
  354. find $(TARGET_DIR) -type f -perm +111 | xargs $(STRIPCMD) 2>/dev/null || true
  355. $(TARGET_LDCONFIG) -r $(TARGET_DIR) 2>/dev/null
  356. mkdir -p $(TARGET_DIR)/etc
  357. echo $(BR2_VERSION)$(shell $(TOPDIR)/scripts/setlocalversion) > \
  358. $(TARGET_DIR)/etc/br-version
  359. ifneq ($(BR2_ROOTFS_POST_BUILD_SCRIPT),"")
  360. $(BR2_ROOTFS_POST_BUILD_SCRIPT) $(TARGET_DIR)
  361. endif
  362. ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
  363. LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
  364. LOCALE_NOPURGE=$(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
  365. target-purgelocales:
  366. rm -f $(LOCALE_WHITELIST)
  367. for i in $(LOCALE_NOPURGE); do echo $$i >> $(LOCALE_WHITELIST); done
  368. for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/man /usr/share/man)); \
  369. do \
  370. for lang in $$(cd $$dir; ls .|grep -v man); \
  371. do \
  372. grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
  373. done; \
  374. done
  375. endif
  376. source: $(TARGETS_SOURCE) $(HOST_SOURCE)
  377. _source-check:
  378. $(MAKE) SPIDER=--spider source
  379. external-deps:
  380. @$(MAKE) -Bs BR2_WGET=$(TOPDIR)/toolchain/wget-show-external-deps.sh \
  381. SPIDER=--spider source
  382. ifeq ($(BR2_CONFIG_CACHE),y)
  383. # drop configure cache if configuration is changed
  384. $(BUILD_DIR)/tgt-config.cache: .config
  385. rm -f $@
  386. touch $@
  387. $(BASE_TARGETS): | $(BUILD_DIR)/tgt-config.cache
  388. endif
  389. else # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  390. all: menuconfig
  391. # configuration
  392. # ---------------------------------------------------------------------------
  393. HOSTCFLAGS=$(CFLAGS_FOR_BUILD)
  394. export HOSTCFLAGS
  395. $(CONFIG)/conf:
  396. @mkdir -p $(CONFIG)/buildroot-config
  397. $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) conf
  398. -@if [ ! -f .config ]; then \
  399. cp $(CONFIG_DEFCONFIG) .config; \
  400. fi
  401. $(CONFIG)/mconf:
  402. @mkdir -p $(CONFIG)/buildroot-config
  403. $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) mconf
  404. -@if [ ! -f .config ]; then \
  405. cp $(CONFIG_DEFCONFIG) .config; \
  406. fi
  407. $(CONFIG)/qconf:
  408. @mkdir -p $(CONFIG)/buildroot-config
  409. $(MAKE) CC="$(HOSTCC)" -C $(CONFIG) qconf
  410. -@if [ ! -f .config ]; then \
  411. cp $(CONFIG_DEFCONFIG) .config; \
  412. fi
  413. xconfig: $(CONFIG)/qconf
  414. @mkdir -p $(CONFIG)/buildroot-config
  415. @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  416. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  417. $(CONFIG)/qconf $(CONFIG_CONFIG_IN); then \
  418. test -f .config.cmd || rm -f .config; \
  419. fi
  420. menuconfig: $(CONFIG)/mconf
  421. @mkdir -p $(CONFIG)/buildroot-config
  422. @if ! KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  423. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  424. $(CONFIG)/mconf $(CONFIG_CONFIG_IN); then \
  425. test -f .config.cmd || rm -f .config; \
  426. fi
  427. config: $(CONFIG)/conf
  428. @mkdir -p $(CONFIG)/buildroot-config
  429. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  430. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  431. $(CONFIG)/conf $(CONFIG_CONFIG_IN)
  432. oldconfig: $(CONFIG)/conf
  433. @mkdir -p $(CONFIG)/buildroot-config
  434. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  435. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  436. $(CONFIG)/conf -o $(CONFIG_CONFIG_IN)
  437. randconfig: $(CONFIG)/conf
  438. @mkdir -p $(CONFIG)/buildroot-config
  439. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  440. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  441. $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
  442. allyesconfig: $(CONFIG)/conf
  443. cat $(CONFIG_DEFCONFIG) > .config
  444. @mkdir -p $(CONFIG)/buildroot-config
  445. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  446. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  447. $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
  448. allnoconfig: $(CONFIG)/conf
  449. @mkdir -p $(CONFIG)/buildroot-config
  450. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  451. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  452. $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
  453. randpackageconfig: $(CONFIG)/conf
  454. @mkdir -p $(CONFIG)/buildroot-config
  455. @grep -v BR2_PACKAGE_ .config > .config.nopkg
  456. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  457. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  458. KCONFIG_ALLCONFIG=.config.nopkg \
  459. $(CONFIG)/conf -r $(CONFIG_CONFIG_IN)
  460. @rm -f .config.nopkg
  461. allyespackageconfig: $(CONFIG)/conf
  462. @mkdir -p $(CONFIG)/buildroot-config
  463. @grep -v BR2_PACKAGE_ .config > .config.nopkg
  464. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  465. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  466. KCONFIG_ALLCONFIG=.config.nopkg \
  467. $(CONFIG)/conf -y $(CONFIG_CONFIG_IN)
  468. @rm -f .config.nopkg
  469. allnopackageconfig: $(CONFIG)/conf
  470. @mkdir -p $(CONFIG)/buildroot-config
  471. @grep -v BR2_PACKAGE_ .config > .config.nopkg
  472. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  473. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  474. KCONFIG_ALLCONFIG=.config.nopkg \
  475. $(CONFIG)/conf -n $(CONFIG_CONFIG_IN)
  476. @rm -f .config.nopkg
  477. defconfig: $(CONFIG)/conf
  478. @mkdir -p $(CONFIG)/buildroot-config
  479. @KCONFIG_AUTOCONFIG=$(CONFIG)/buildroot-config/auto.conf \
  480. KCONFIG_AUTOHEADER=$(CONFIG)/buildroot-config/autoconf.h \
  481. $(CONFIG)/conf -d $(CONFIG_CONFIG_IN)
  482. # check if download URLs are outdated
  483. source-check: allyesconfig
  484. $(MAKE) _source-check
  485. endif # ifeq ($(BR2_HAVE_DOT_CONFIG),y)
  486. #############################################################
  487. #
  488. # Cleanup and misc junk
  489. #
  490. #############################################################
  491. clean:
  492. rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
  493. $(STAMP_DIR) $(BUILD_DIR) $(TOOLCHAIN_DIR)
  494. distclean: clean
  495. ifeq ($(DL_DIR),$(TOPDIR)/dl)
  496. rm -rf $(DL_DIR)
  497. endif
  498. ifeq ($(O),output)
  499. rm -rf $(O)
  500. endif
  501. rm -rf .config .config.old .config.cmd .auto.deps
  502. -$(MAKE) -C $(CONFIG) clean
  503. flush:
  504. rm -f $(BUILD_DIR)/tgt-config.cache
  505. %_defconfig: $(TOPDIR)/configs/%_defconfig
  506. cp $^ .config
  507. @$(MAKE) oldconfig
  508. configured: dirs host-sed kernel-headers uclibc-config busybox-config linux26-config
  509. prepatch: gcc-patched binutils-patched gdb-patched uclibc-patched
  510. cross: $(BASE_TARGETS)
  511. help:
  512. @echo 'Cleaning:'
  513. @echo ' clean - delete all files created by build'
  514. @echo ' distclean - delete all non-source files (including .config)'
  515. @echo
  516. @echo 'Build:'
  517. @echo ' all - make world'
  518. @echo
  519. @echo 'Configuration:'
  520. @echo ' menuconfig - interactive curses-based configurator'
  521. @echo ' xconfig - interactive Qt-based configurator'
  522. @echo ' oldconfig - resolve any unresolved symbols in .config'
  523. @echo ' randconfig - New config with random answer to all options'
  524. @echo ' defconfig - New config with default answer to all options'
  525. @echo ' allyesconfig - New config where all options are accepted with yes'
  526. @echo ' allnoconfig - New config where all options are answered with no'
  527. @echo ' randpackageconfig - New config with random answer to package options'
  528. @echo ' allyespackageconfig - New config where pkg options are accepted with yes'
  529. @echo ' allnopackageconfig - New config where package options are answered with no'
  530. @echo ' configured - make {uclibc/busybox/linux26}-config'
  531. @echo
  532. @echo 'Miscellaneous:'
  533. @echo ' source - download all sources needed for offline-build'
  534. @echo ' source-check - check all packages for valid download URLs'
  535. @echo ' external-deps - list external packages used'
  536. @echo ' flush - flush configuration cache'
  537. @echo
  538. @$(foreach b, $(notdir $(wildcard $(TOPDIR)/configs/*_defconfig)), \
  539. printf " %-35s - Build for %s\\n" $(b) $(b:_defconfig=);)
  540. @echo
  541. @echo 'See docs/README and docs/buildroot.html for further details'
  542. @echo
  543. release:
  544. OUT=buildroot-$$(grep -A2 BR2_VERSION $(CONFIG_CONFIG_IN)|grep default|cut -f2 -d\"); \
  545. git archive --format=tar --prefix=$$OUT/ master|gzip -9 >$$OUT.tar.gz
  546. .PHONY: $(noconfig_targets)