'How to find the entry point to target in recursive makefile?

Note: Simplified directory layout and debug message are in the below.

We usually type make under /top_folder/buildroot, and let make to handle the rest of stuff. One part of task that make does is to look into the makefile under /top_folder/kernel/linux-3.6.5.

The process in perspective of make be like:

  1. look into the makefile under /top_folder/buildroot
  2. run commands
  3. see the command that requires to look into the makefile under /top_folder/kernel/linux-3.6.5
  4. go /top_folder/kernel/linux-3.6.5 and look it
  5. run commands

I wanted to know what command is in number 3 because if I just type make under /top_folder/kernel/linux-3.6.5 it shows error.

[root@ns linux-3.6.5]# make
top_folder/kernel/linux-3.6.5/scripts/gcc-version.sh: line 25: ROSS_COMPILEgcc: command not found
top_folder/kernel/linux-3.6.5/scripts/gcc-version.sh: line 26: ROSS_COMPILEgcc: command not found
make: ROSS_COMPILEgcc: Command not found
make[1]: Nothing to be done for `all'.
  HOSTCC  scripts/basic/fixdep
make[1]: Nothing to be done for `relocs'.
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
/bin/sh: ROSS_COMPILEgcc: command not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2

Considering the debug message from make --debug=b below, I know that

  1. the command must locate between part 2 and part 3 given that make[1]: Entering directory `top_folder/kernel/linux-3.6.5' is printed.
  2. part 1 is the output from the makefile under /top_folder/buildroot.
  3. part 3 is the output from the makefile under /top_folder/kernel/linux-3.6.5.

By far what I did but failed:

  1. search keyword linux-configure and linux-depends
  2. search keyword 3.6.5
  3. search keyword >>>
  4. search keyword Building

Please share your idea on how to trace makefile, especially in this case. Thanks in advance. If I missed something please let me know.


/*simplified directory layout*/

top_folder
|
| --- kernel
|     |
|     | --- linux-3.6.5
|           |
|           | --- Makefile
|
| --- buildroot
      |
      | --- Makefile

[root@ns buildroot]# make --debug=b

/*part 1*/

This program built for i386-redhat-linux-gnu
Reading makefiles...
Updating goal targets....
File `all' does not exist.
  File `world' does not exist.
 File `bcm_patch' does not exist.
Must remake target `bcm_patch'.
./bcm_patch.sh
Successfully remade target file `bcm_patch'.
 File `prepare' does not exist.
Must remake target `prepare'.
Successfully remade target file `prepare'.
 File `dirs' does not exist.
  File `top_folder/buildroot/output/toolchain' does not exist.
 Must remake target `top_folder/buildroot/output/toolchain'.
 Successfully remade target file `top_folder/buildroot/output/toolchain'.
  File `top_folder/buildroot/output/build' does not exist.
 Must remake target `top_folder/buildroot/output/build'.
 Successfully remade target file `top_folder/buildroot/output/build'.
  File `top_folder/buildroot/output/host/usr/arm-broadcom-linux-uclibcgnueabi/sysroot' does not exist.
 Must remake target `top_folder/buildroot/output/host/usr/arm-broadcom-linux-uclibcgnueabi/sysroot'.
 Successfully remade target file `top_folder/buildroot/output/host/usr/arm-broadcom-linux-uclibcgnueabi/sysroot'.
  File `top_folder/buildroot/output/target' does not exist.
 Must remake target `top_folder/buildroot/output/target'.
 Successfully remade target file `top_folder/buildroot/output/target'.
  File `top_folder/buildroot/output/host' does not exist.
 Must remake target `top_folder/buildroot/output/host'.
 Successfully remade target file `top_folder/buildroot/output/host'.
  File `top_folder/buildroot/output/images' does not exist.
 Must remake target `top_folder/buildroot/output/images'.
 Successfully remade target file `top_folder/buildroot/output/images'.
  File `top_folder/buildroot/output/stamps' does not exist.
 Must remake target `top_folder/buildroot/output/stamps'.
 Successfully remade target file `top_folder/buildroot/output/stamps'.
Must remake target `dirs'.
Successfully remade target file `dirs'.
 File `dependencies' does not exist.
  File `core-dependencies' does not exist.
 Must remake target `core-dependencies'.
 Successfully remade target file `core-dependencies'.

 /*huge numbers of messages omitted*/

 Must remake target `linux-depends'.
 Successfully remade target file `linux-depends'.
   Must remake target `linux-configure'.
   Successfully remade target file `linux-configure'.
    File `top_folder/buildroot/output/build/linux-3.6.5/.stamp_built' does not exist.
   Must remake target `top_folder/buildroot/output/build/linux-3.6.5/.stamp_built'.
              
 /*part 2*/
 
 >>> linux 3.6.5 Building
 PATH="top_folder/buildroot/output/host/bin:top_folder/buildroot/output/host/usr/bin:top_folder/buildroot/output/host/usr/sbin/:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/opt/montavista/pro/devkit/ppc/82xx/bin:/opt/montavista/pro/host/bin:/opt/iproc_3.4.4_RC3/buildroot/host/usr/bin/:/opt/freescale/usr/local/gcc-4.1.78-eglibc-2.5.78-1/powerpc-e300c3-linux-gnu/bin/:/opt/arm_linux_4.8/bin:ti-am335x-linux-devkit-08.00.00.00/bin/" PERLLIB="top_folder/buildroot/output/host/usr/lib/perl" /usr/bin/make -j4 HOSTCC="/usr/lib/ccache/gcc" HOSTCFLAGS="" ARCH=arm INSTALL_MOD_PATH=top_folder/buildroot/output/target CROSS_COMPILE=" top_folder/buildroot/output/host/usr/bin/arm-linux-" DEPMOD=top_folder/buildroot/output/host/usr/sbin/depmod -C top_folder/buildroot/output/build/linux-3.6.5 Image
 
 This program built for i386-redhat-linux-gnu
 Reading makefiles...
 make[1]: Entering directory `top_folder/kernel/linux-3.6.5'
 
 /*part 3*/
 
 This program built for i386-redhat-linux-gnu
 Reading makefiles...
 Updating goal targets....
 File `silentoldconfig' does not exist.
   File `scripts_basic' does not exist.
  Must remake target `scripts_basic'.
   File `outputmakefile' does not exist.
  Must remake target `outputmakefile'.
  Successfully remade target file `outputmakefile'.
   File `FORCE' does not exist.
 
 This program built for i386-redhat-linux-gnu
 Reading makefiles...
  Successfully remade target file `FORCE'.
 Updating goal targets....
 File `__build' does not exist.
  File `FORCE' does not exist.
 Must remake target `FORCE'.
 Successfully remade target file `FORCE'.
   Prerequisite `FORCE' of target `scripts/basic/fixdep' does not exist.
  Must remake target `scripts/basic/fixdep'.
  Successfully remade target file `scripts/basic/fixdep'.
 Must remake target `__build'.
 Successfully remade target file `__build'.
 File `silentoldconfig' does not exist.
 Must remake target `silentoldconfig'.
 
 This program built for i386-redhat-linux-gnu
 Reading makefiles...
 Updating goal targets....
 File `silentoldconfig' does not exist.
   File `FORCE' does not exist.
  Must remake target `FORCE'.
  Successfully remade target file `FORCE'.
  Prerequisite `FORCE' of target `scripts/kconfig/conf.o' does not exist.
 Must remake target `scripts/kconfig/conf.o'.
 Successfully remade target file `scripts/kconfig/conf.o'.
  Prerequisite `FORCE' of target `scripts/kconfig/zconf.tab.o' does not exist.
 Must remake target `scripts/kconfig/zconf.tab.o'.
 Successfully remade target file `scripts/kconfig/zconf.tab.o'.
   Prerequisite `FORCE' of target `scripts/kconfig/conf' does not exist.
  Must remake target `scripts/kconfig/conf'.
  Successfully remade target file `scripts/kconfig/conf'.
 Must remake target `silentoldconfig'.
 scripts/kconfig/conf --silentoldconfig Kconfig
 *
 * Restart config...
 *
 *
 * Linux/arm 3.6.5 Kernel Configuration
 *
 Patch physical to virtual translations at runtime (ARM_PATCH_PHYS_VIRT) [Y/n/?] (NEW) 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source