【记录】尝试分析Buildroot在make menuconfig后make时的内部执行逻辑

【背景】

https://www.crifan.com/try_analysis_buildroot_after_make


折腾:

【已解决】Cygwin下为xscale编译BuildRoot时make出错:/bin/sh: -c: line 0: syntax error near unexpected token `(‘

期间,需要去分析Buildroot的make的逻辑。

对于Buildroot在make menuconfig后,(又去make clean了一下,然后)去make,此时的输出是:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CLi@PC-CLI-1 ~ /develop/buildroot/buildroot-2013 .05
make
/usr/bin/make -j4  HOSTCC= "/usr/bin/gcc" HOSTCXX= "/usr/bin/g++" silentoldconfig
make [1]: Entering directory ` /home/CLi/develop/buildroot/buildroot-2013 .05'
mkdir -p  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/lxdialog
/usr/bin/make CC= "/usr/bin/gcc" HOSTCC= "/usr/bin/gcc" obj= /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -C support /kconfig -f Makefile.br conf
make [2]: Entering directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"  -MM *.c >  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/ .depend 2> /dev/null || :
make [2]: Leaving directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
make [2]: Entering directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"   -c conf.c -o  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/conf .o
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"  -I. -c  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.c -o  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.o
In  file included from  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.c:2500:0:
. /confdata .c: In  function ‘conf_split_config’:
. /confdata .c:849:6: warning: assignment makes pointer from integer without a cast [enabled by default]
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"    /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/conf .o  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.o  -o  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/conf
rm /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.c
make [2]: Leaving directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
BR2_DEFCONFIG= '' KCONFIG_AUTOCONFIG= /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/auto .conf KCONFIG_AUTOHEADER= /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/autoconf .h KCONFIG_TRISTATE= /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/tristate .config BUILDROOT_CONFIG= /home/CLi/develop/buildroot/buildroot-2013 .05/.config  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/conf --silentoldconfig Config. in
make [1]: Leaving directory ` /home/CLi/develop/buildroot/buildroot-2013 .05'
mkdir -p  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/target
rsync -a \
                 --exclude .empty --exclude .svn --exclude .git \
                 --exclude .hg --exclude=CVS --exclude  '*~' \
                 /home/CLi/develop/buildroot/buildroot-2013 .05 /system/skeleton/ /home/CLi/develop/buildroot/buildroot-2013 .05 /output/target/
cp support /misc/target-dir-warning .txt  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
touch /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/ .root
>>> host-ccache 3.1.8 Extracting
bzcat  /home/CLi/develop/buildroot/buildroot-2013 .05 /dl/ccache-3 .1.8. tar .bz2 |  tar --strip-components=1 -C  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/host-ccache-3 .1.8  -xf -
>>> host-ccache 3.1.8 Patching package //ccache
>>> host-ccache 3.1.8 Updating config.sub and config.guess
for file in config.guess config.sub;  do for in $( find /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/host-ccache-3 .1.8 -name $ file );  do cp support /gnuconfig/ $ file $i;  done done
>>> host-ccache 3.1.8 Patching libtool
>>> host-ccache 3.1.8 Configuring
( cd /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/host-ccache-3 .1.8/ &&  rm -rf config.cache; PATH= /home/CLi/develop/buildroot/buildroot-2013 .05 /output/host/bin : /home/CLi/develop/buildroot/buildroot-2013 .05 /output/host/usr/bin : /home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin : /opt/crosstool-ng/bin : /home/CLi/develop/crosstool-ng/x-tools/armxscalecurl/bin : /usr/local/bin : /usr/bin : /cygdrive/d/tmp/dev_install_root/Python27_x64 : /cygdrive/d/tmp/dev_install_root/Python27_x64/Lib/site-packages/PyQt4 : /cygdrive/d/tmp/dev_install_root/Perl64/site/bin : /cygdrive/d/tmp/dev_install_root/Perl64/bin : /cygdrive/c/Program Files /Common Files /Microsoft Shared /Windows Live: /cygdrive/c/Program Files (x86) /Common Files /Microsoft Shared /Windows Live: /cygdrive/c/Windows/system32 : /cygdrive/c/Windows : /cygdrive/c/Windows/System32/Wbem : /cygdrive/c/Windows/System32/WindowsPowerShell/v1 .0: /cygdrive/c/Program Files (x86) /Microsoft SQL Server /100/Tools/Binn : /cygdrive/c/Program Files /Microsoft SQL Server /100/Tools/Binn : /cygdrive/c/Program Files /Microsoft SQL Server /100/DTS/Binn : /cygdrive/d/tmp/WordPress/mysql/mysql-5 .5.18 /MySQL/MySQL Server 5.5 /bin : /cygdrive/d/tmp/WordPress/DevRoot/MySQL/MySQL Server 5.5 /bin : /cygdrive/d/tmp/WordPress/DevRoot/php-5 .3.6-Win32-VC9-x64: /cygdrive/d/tmp/WordPress/DevRoot/php-5 .3.6-Win32-VC9-x64 /ext : /cygdrive/d/tmp/WordPress/DevRoot/Python27 : /cygdrive/c/Program Files (x86) /Common Files /Acronis/SnapAPI : /cygdrive/c/Program Files (x86) /Windows Live /Shared : /cygdrive/c/Program Files /Java/jdk1 .7.0_11 /bin : /home/CLi/develop/docbook/tools/fop/lib : /home/CLi/develop/docbook/tools/fop : /cygdrive/d/DevInstallRoot/FF/DD_IDE_1 .1.2 /TOK/BIN : /cygdrive/d/DevInstallRoot/FF/DD_IDE_1 .2.0 /TOK/BIN : /cygdrive/d/DevRoot/EmbeddedDevelop/trunk/Research/CLI/FF/FBK/develop/tools/develop-tools : /cygdrive/d/tmp/WordPress/DevRoot/Python27/Scripts : /cygdrive/d/tmp/dev_install_root/PostgreSQL/8 .3 /bin : /cygdrive/d/tmp/dev_install_root/ant/apache-ant-1 .8.4 /bin : /cygdrive/c/Program Files /nodejs : /cygdrive/c/Program Files /Microsoft/Web Platform Installer: /cygdrive/c/Program Files /TortoiseSVN/bin : /cygdrive/d/DevRoot/IndustrialMobileAutomation/HandheldDataSetter/ANTLR/batchFile : /cygdrive/c/Program Files (x86) /QuickTime/QTSystem : /cygdrive/d/tmp/tmp_dev_root/android/adt-bundle-windows/sdk/platform-tools : /cygdrive/d/tmp/dev_install_root/Tesseract-OCR : /cygdrive/d/tmp/dev_install_root/jython2 .5.3 /bin : /cygdrive/d/devinstallroot/gnuarm/bin : /cygdrive/d/tmp/dev_install_root/HTML Help Workshop: /cygdrive/c/Users/CLi/AppData/Roaming/npm : /usr/lib/lapack : /opt/gcc-4 .0.4-glibc-2.3.6-kernel-2.6.17 /sysroot-arm-xscale-linux-gnu/usr/include : /opt/gcc-4 .0.4-glibc-2.3.6-kernel-2.6.17 /sysroot-arm-xscale-linux-gnu/usr/include/linux AR= "/usr/bin/ar" AS= "/usr/bin/as" LD= "/usr/bin/ld" NM= "/usr/bin/nm" CC= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /usr/bin/gcc" GCC= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /usr/bin/gcc" CXX= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /usr/bin/g++" CPP= "/usr/bin/cpp" CPPFLAGS= "-I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" CFLAGS= "-O2 -I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" CXXFLAGS= "-O2 -I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" LDFLAGS= "-L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/lib -L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib -Wl,-rpath,/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR= "/" PKG_CONFIG_LIBDIR= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib/pkgconfig:/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/share/pkgconfig" PERLLIB= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib/perl" LD_LIBRARY_PATH= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib:" CFLAGS= "-O2 -I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" LDFLAGS= "-L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/lib -L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib -Wl,-rpath,/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib" CC= "/usr/bin/gcc" . /configure --prefix= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr" --sysconfdir= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/etc" -- enable -shared --disable-static --disable-gtk-doc --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no ccache_cv_zlib_1_2_3=no )
/bin/sh : -c: line 0: syntax error near unexpected token `('
/bin/sh : -c: line 0: `( cd /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/host-ccache-3 .1.8/ &&  rm -rf config.cache; PATH= /home/CLi/develop/buildroot/buildroot-2013 .05 /output/host/bin : /home/CLi/develop/buildroot/buildroot-2013 .05 /output/host/usr/bin : /home/CLi/develop/crosstool-ng/x-tools/arm-xscale-linux-gnueabi/bin : /opt/crosstool-ng/bin : /home/CLi/develop/crosstool-ng/x-tools/armxscalecurl/bin : /usr/local/bin : /usr/bin : /cygdrive/d/tmp/dev_install_root/Python27_x64 : /cygdrive/d/tmp/dev_install_root/Python27_x64/Lib/site-packages/PyQt4 : /cygdrive/d/tmp/dev_install_root/Perl64/site/bin : /cygdrive/d/tmp/dev_install_root/Perl64/bin : /cygdrive/c/Program Files /Common Files /Microsoft Shared /Windows Live: /cygdrive/c/Program Files (x86) /Common Files /Microsoft Shared /Windows Live: /cygdrive/c/Windows/system32 : /cygdrive/c/Windows : /cygdrive/c/Windows/System32/Wbem : /cygdrive/c/Windows/System32/WindowsPowerShell/v1 .0: /cygdrive/c/Program Files (x86) /Microsoft SQL Server /100/Tools/Binn : /cygdrive/c/Program Files /Microsoft SQL Server /100/Tools/Binn : /cygdrive/c/Program Files /Microsoft SQL Server /100/DTS/Binn : /cygdrive/d/tmp/WordPress/mysql/mysql-5 .5.18 /MySQL/MySQL Server 5.5 /bin : /cygdrive/d/tmp/WordPress/DevRoot/MySQL/MySQL Server 5.5 /bin : /cygdrive/d/tmp/WordPress/DevRoot/php-5 .3.6-Win32-VC9-x64: /cygdrive/d/tmp/WordPress/DevRoot/php-5 .3.6-Win32-VC9-x64 /ext : /cygdrive/d/tmp/WordPress/DevRoot/Python27 : /cygdrive/c/Program Files (x86) /Common Files /Acronis/SnapAPI : /cygdrive/c/Program Files (x86) /Windows Live /Shared : /cygdrive/c/Program Files /Java/jdk1 .7.0_11 /bin : /home/CLi/develop/docbook/tools/fop/lib : /home/CLi/develop/docbook/tools/fop : /cygdrive/d/DevInstallRoot/FF/DD_IDE_1 .1.2 /TOK/BIN : /cygdrive/d/DevInstallRoot/FF/DD_IDE_1 .2.0 /TOK/BIN : /cygdrive/d/DevRoot/EmbeddedDevelop/trunk/Research/CLI/FF/FBK/develop/tools/develop-tools : /cygdrive/d/tmp/WordPress/DevRoot/Python27/Scripts : /cygdrive/d/tmp/dev_install_root/PostgreSQL/8 .3 /bin : /cygdrive/d/tmp/dev_install_root/ant/apache-ant-1 .8.4 /bin : /cygdrive/c/Program Files /nodejs : /cygdrive/c/Program Files /Microsoft/Web Platform Installer: /cygdrive/c/Program Files /TortoiseSVN/bin : /cygdrive/d/DevRoot/IndustrialMobileAutomation/HandheldDataSetter/ANTLR/batchFile : /cygdrive/c/Program Files (x86) /QuickTime/QTSystem : /cygdrive/d/tmp/tmp_dev_root/android/adt-bundle-windows/sdk/platform-tools : /cygdrive/d/tmp/dev_install_root/Tesseract-OCR : /cygdrive/d/tmp/dev_install_root/jython2 .5.3 /bin : /cygdrive/d/devinstallroot/gnuarm/bin : /cygdrive/d/tmp/dev_install_root/HTML Help Workshop: /cygdrive/c/Users/CLi/AppData/Roaming/npm : /usr/lib/lapack : /opt/gcc-4 .0.4-glibc-2.3.6-kernel-2.6.17 /sysroot-arm-xscale-linux-gnu/usr/include : /opt/gcc-4 .0.4-glibc-2.3.6-kernel-2.6.17 /sysroot-arm-xscale-linux-gnu/usr/include/linux AR= "/usr/bin/ar" AS= "/usr/bin/as" LD= "/usr/bin/ld" NM= "/usr/bin/nm" CC= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /usr/bin/gcc" GCC= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /usr/bin/gcc" CXX= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/ccache /usr/bin/g++" CPP= "/usr/bin/cpp" CPPFLAGS= "-I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" CFLAGS= "-O2 -I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" CXXFLAGS= "-O2 -I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" LDFLAGS= "-L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/lib -L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib -Wl,-rpath,/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR= "/" PKG_CONFIG_LIBDIR= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib/pkgconfig:/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/share/pkgconfig" PERLLIB= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib/perl" LD_LIBRARY_PATH= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib:" CFLAGS= "-O2 -I/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/include" LDFLAGS= "-L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/lib -L/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib -Wl,-rpath,/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr/lib" CC= "/usr/bin/gcc" . /configure --prefix= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/usr" --sysconfdir= "/home/CLi/develop/buildroot/buildroot-2013.05/output/host/etc" -- enable -shared --disable-static --disable-gtk-doc --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no ccache_cv_zlib_1_2_3=no )'
make : *** [ /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/host-ccache-3 .1.8/.stamp_configured] Error 1
 
CLi@PC-CLI-1 ~ /develop/buildroot/buildroot-2013 .05
$

然后,对照着makefile,看看能否看出完整的make的逻辑。

 

【折腾过程】

1.此处的:

/usr/bin/make -j4 HOSTCC="/usr/bin/gcc" HOSTCXX="/usr/bin/g++" silentoldconfig

很明显,对应着是:

?
1
2
$(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
     $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig

对应的关系是:

make时,调用的是:

?
1
all: world

->

?
1
world: toolchain $(TARGETS_ALL)

->

?
1
toolchain: prepare dirs dependencies $(BASE_TARGETS)

->

?
1
prepare: $(BUILD_DIR)/buildroot-config/auto.conf

->

?
1
2
$(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFIG)
     $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX_NOCCACHE)" silentoldconfig

 

2.然后继续看剩下的逻辑。

mkdir -p /home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config/lxdialog

此处,也容易分析出来是:

?
1
2
3
$(BUILD_DIR)/buildroot-config/%onf:
     mkdir -p $(@D)/lxdialog
     $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

然后反推出来,好像是:

?
1
2
3
4
5
6
.PHONY: all world toolchain dirs clean distclean source outputmakefile \
     legal-info legal-info-prepare legal-info-clean \
     $(BASE_TARGETS) $(TARGETS) $(TARGETS_ALL) \
     $(TARGETS_CLEAN) $(TARGETS_DIRCLEAN) $(TARGETS_SOURCE) $(TARGETS_LEGAL_INFO) \
     $(TOOLCHAIN_DIR) $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \
     $(HOST_DIR) $(BINARIES_DIR) $(STAMP_DIR)

调用到了all:

?
1
all: menuconfig

->

?
1
2
3
menuconfig: $(BUILD_DIR)/buildroot-config/mconf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)

->

?
1
2
3
$(BUILD_DIR)/buildroot-config/%onf:
     mkdir -p $(@D)/lxdialog
     $(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

好像是的。

3.不管如何,此处,先去创建lxdialog文件夹,然后继续去:

?
1
/usr/bin/make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" obj=/home/CLi/develop/buildroot/buildroot-2013.05/output/build/buildroot-config -C support/kconfig -f Makefile.br conf

此处很明显,其实是对应的是:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
config: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< $(CONFIG_CONFIG_IN)
 
oldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< --oldconfig $(CONFIG_CONFIG_IN)
 
randconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< --randconfig $(CONFIG_CONFIG_IN)
 
allyesconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< --allyesconfig $(CONFIG_CONFIG_IN)
 
allnoconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< --allnoconfig $(CONFIG_CONFIG_IN)
 
randpackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
     @grep '^config BR2_PACKAGE_' Config.in.legacy | \
         while read config pkg; do \
         echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
     @$(COMMON_CONFIG_ENV) \
         KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
         $< --randconfig $(CONFIG_CONFIG_IN)
     @rm -f $(CONFIG_DIR)/.config.nopkg
 
allyespackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
     @grep '^config BR2_PACKAGE_' Config.in.legacy | \
         while read config pkg; do \
         echo "# $$pkg is not set" >> $(CONFIG_DIR)/.config.nopkg; done
     @$(COMMON_CONFIG_ENV) \
         KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
         $< --allyesconfig $(CONFIG_CONFIG_IN)
     @rm -f $(CONFIG_DIR)/.config.nopkg
 
allnopackageconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @grep -v BR2_PACKAGE_ $(BUILDROOT_CONFIG) > $(CONFIG_DIR)/.config.nopkg
     @$(COMMON_CONFIG_ENV) \
         KCONFIG_ALLCONFIG=$(CONFIG_DIR)/.config.nopkg \
         $< --allnoconfig $(CONFIG_CONFIG_IN)
     @rm -f $(CONFIG_DIR)/.config.nopkg
 
silentoldconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     $(COMMON_CONFIG_ENV) $< --silentoldconfig $(CONFIG_CONFIG_IN)
 
olddefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     $(COMMON_CONFIG_ENV) $< --olddefconfig $(CONFIG_CONFIG_IN)
 
defconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< --defconfig$(if $(DEFCONFIG),=$(DEFCONFIG)) $(CONFIG_CONFIG_IN)
 
%_defconfig: $(BUILD_DIR)/buildroot-config/conf $(TOPDIR)/configs/%_defconfig outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< --defconfig=$(TOPDIR)/configs/$@ $(CONFIG_CONFIG_IN)
 
savedefconfig: $(BUILD_DIR)/buildroot-config/conf outputmakefile
     @mkdir -p $(BUILD_DIR)/buildroot-config
     @$(COMMON_CONFIG_ENV) $< \
         --savedefconfig=$(if $(DEFCONFIG),$(DEFCONFIG),$(CONFIG_DIR)/defconfig) \
         $(CONFIG_CONFIG_IN)

中的某一个。

4.然后去看了看对应的文件夹:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\support\kconfig

以及其中的Makefile文件:

Makefile.br

然后其又用:

?
1
include Makefile

而调用了:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\support\kconfig\Makefile

此处,即:

执行Makefile.br,传入conf的目标;

而Makefile.br先会去包含Makefile

5.但是具体执行逻辑没看懂。

但是通过:

?
1
2
make [2]: Entering directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"  -MM *.c >  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/ .depend 2> /dev/null || :

中的:

2>/dev/null

而找到对应的地方了,是:

Makefile.br中的:

?
1
2
$(obj)/.depend: $(wildcard *.h *.c)
     $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > $@ 2>/dev/null || :

此处,也不是完全懂,但是不关心。跳过。

后来看懂了一点:

是生成对应的依赖文件:

D:\tmp\tmp_dev_root\cgwin\home\CLi\develop\buildroot\buildroot-2013.05\output\build\buildroot-config\.depend

此处其内容为:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
conf.o: conf.c lkc.h expr.h list.h lkc_proto.h
confdata.o: confdata.c lkc.h expr.h list.h lkc_proto.h
expr.o: expr.c lkc.h expr.h list.h lkc_proto.h
images.o: images.c
kxgettext.o: kxgettext.c lkc.h expr.h list.h lkc_proto.h
mconf.o: mconf.c lkc.h expr.h list.h lkc_proto.h lxdialog/dialog.h
menu.o: menu.c lkc.h expr.h list.h lkc_proto.h
nconf.o: nconf.c lkc.h expr.h list.h lkc_proto.h nconf.h \
  /usr/include/ncursesw/curses.h /usr/include/ncursesw/menu.h \
  /usr/include/ncursesw/panel.h /usr/include/ncursesw/form.h \
  /usr/include/ncursesw/ncurses.h
nconf.gui.o: nconf.gui.c nconf.h /usr/include/ncursesw/curses.h \
  /usr/include/ncursesw/menu.h /usr/include/ncursesw/panel.h \
  /usr/include/ncursesw/form.h /usr/include/ncursesw/ncurses.h
symbol.o: symbol.c lkc.h expr.h list.h lkc_proto.h
util.o: util.c lkc.h expr.h list.h lkc_proto.h

6.接下来,主要是去编译一些.c文件:

?
1
2
3
4
5
6
7
8
9
make [2]: Leaving directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
make [2]: Entering directory ` /home/CLi/develop/buildroot/buildroot-2013 .05 /support/kconfig '
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"   -c conf.c -o  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/conf .o
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"  -I. -c  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.c -o  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.o
In  file included from  /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config/zconf .tab.c:2500:0:
. /confdata .c: In  function ‘conf_split_config’:
. /confdata .c:849:6: warning: assignment makes pointer from integer without a cast [enabled by default]
/usr/bin/gcc -I /usr/include/ncursesw -DCURSES_LOC= ""  -DNCURSES_WIDECHAR=1 -DLOCALE -DKBUILD_NO_NLS -I /home/CLi/develop/buildroot/buildroot-2013 .05 /output/build/buildroot-config -DCONFIG_=\"\"    /home/CLi/develop/buildroot/buildroot-2013

你可能感兴趣的:(buildroot,Makefile)