SlideShare a Scribd company logo
MakefileMakefile 의 구조 및 기능의 구조 및 기능
(Linux-2.6.10 version)(Linux-2.6.10 version)
MakefileMakefile 의 구조의 구조
 OverviewOverview
 Who does whatWho does what
 Important check kbuild filesImportant check kbuild files
 Observe Makefiles sourceObserve Makefiles source
overviewoverview
 Top makefileTop makefile
 .config.config
 Arch/$(ARCH)/MakefileArch/$(ARCH)/Makefile
 Script/MakefileScript/Makefile
 Kbuild makefilesKbuild makefiles
Top makefileTop makefile
 The top makefile reads the .config fileThe top makefile reads the .config file
 Two major product :Two major product :
 Vmlinux(the resident kernel image)Vmlinux(the resident kernel image)
 Modules(any module files)Modules(any module files)
.config & arch makefile.config & arch makefile
 .config file.config file
 From kernel configuration processFrom kernel configuration process
 Get list of subderectoriesGet list of subderectories
 Arch makefileArch makefile
 Supplies architecture specific informationSupplies architecture specific information
Script & kbuild makefileScript & kbuild makefile
 Script makefileScript makefile
 Contains all the definitions/rules etcContains all the definitions/rules etc
 Kbuild makefileKbuild makefile
 Build any built-in or modular targetsBuild any built-in or modular targets
 Uses from the .config fileUses from the .config file
Who does whatWho does what
 Users : people(build kernels)Users : people(build kernels)
 Normal developersNormal developers
 Make features(device drivers, file systems,Make features(device drivers, file systems,
network protocols)network protocols)
 Arch developersArch developers
 Make entire architecture(sparc or ia64..etc)Make entire architecture(sparc or ia64..etc)
 Kbuild developersKbuild developers
 Make kernel build system itselfMake kernel build system itself
Check important kbuild filesCheck important kbuild files
 Goal definitionsGoal definitions
 Contain files to built, compilation options,Contain files to built, compilation options,
and any subdirectories..etcand any subdirectories..etc
 Built-in object goals(obj-y)Built-in object goals(obj-y)
 Object file to compileObject file to compile
 Loadable module goals(obj-m)Loadable module goals(obj-m)
 Library file goals(lib-y)Library file goals(lib-y)
 Library to built-in object files for modulesLibrary to built-in object files for modules
and combineand combine
Makefiles source 1Makefiles source 1
 MRPROPER_DIRS += include/config include2MRPROPER_DIRS += include/config include2
 MRPROPER_FILES += .config .config.old include/asm .version MRPROPER_FILES += .config .config.old include/asm .version 
 include/linux/autoconf.h include/linux/version.h include/linux/autoconf.h include/linux/version.h 
 Module.symvers tags TAGS cscope*Module.symvers tags TAGS cscope*
 mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
 mrproper: rm-files := $(wildcard $(MRPROPER_FILES))mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
 mrproper-dirs := $(addprefix_mrproper_,Documentation/DocBook scripts)mrproper-dirs := $(addprefix_mrproper_,Documentation/DocBook scripts)
 .PHONY: $(mrproper-dirs) mrproper archmrproper.PHONY: $(mrproper-dirs) mrproper archmrproper
 $(mrproper-dirs):$(mrproper-dirs):
 $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
 mrproper: clean archmrproper $(mrproper-dirs)mrproper: clean archmrproper $(mrproper-dirs)
 $(call cmd,rmdirs)$(call cmd,rmdirs)
 $(call cmd,rmfiles)$(call cmd,rmfiles)
Makefile source 2Makefile source 2
 include/config/MARKER: include/linux/autoconf.hinclude/config/MARKER: include/linux/autoconf.h
 include $(srctree)/arch/$(ARCH)/Makefile export KBUILD_DEFCONFIGinclude $(srctree)/arch/$(ARCH)/Makefile export KBUILD_DEFCONFIG
 init-yinit-y := init/:= init/
 drivers-ydrivers-y := drivers/ sound/:= drivers/ sound/
 net-ynet-y := net/:= net/
 libs-ylibs-y := lib/:= lib/
 core-ycore-y := usr/:= usr/
 CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-+= $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-
functions)functions)
 CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)+= $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)
 CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)+= $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)
 CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)+= $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)
 CFLAGSCFLAGS += -fno-omit-frame-pointer+= -fno-omit-frame-pointer
 elseelse
 CFLAGSCFLAGS += -fomit-frame-pointer+= -fomit-frame-pointer
 CFLAGSCFLAGS += -g+= -g
Makefiles source 3Makefiles source 3
 clean: rm-dirs := $(CLEAN_DIRS)clean: rm-dirs := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)clean: rm-files := $(CLEAN_FILES)
 clean-dirs := $(addprefix _clean_,$(vmlinux-clean-dirs := $(addprefix _clean_,$(vmlinux-
alldirs))alldirs))
 .PHONY: $(clean-dirs) clean archclean.PHONY: $(clean-dirs) clean archclean
 $(clean-dirs):$(clean-dirs):
 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,
%,$@)%,$@)
 clean: archclean $(clean-dirs)clean: archclean $(clean-dirs)
Makefile source 4Makefile source 4
 core-ycore-y += kernel/ mm/ fs/ ipc/ security/ crypto/+= kernel/ mm/ fs/ ipc/ security/ crypto/
 vmlinux-dirsvmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) 
 $(core-y) $(core-m) $(drivers-y) $(drivers-m) $(core-y) $(core-m) $(drivers-y) $(drivers-m) 
 $(net-y) $(net-m) $(libs-y) $(libs-m)))$(net-y) $(net-m) $(libs-y) $(libs-m)))
 vmlinux-alldirsvmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, 
 $(init-n) $(init-) $(init-n) $(init-) 
 $(core-n) $(core-) $(drivers-n) $(drivers-) $(core-n) $(core-) $(drivers-n) $(drivers-) 
 $(net-n) $(net-) $(libs-n) $(libs-))))$(net-n) $(net-) $(libs-n) $(libs-))))
 init-yinit-y := $(patsubst %/, %/built-in.o, $(init-y)):= $(patsubst %/, %/built-in.o, $(init-y))
 core-ycore-y := $(patsubst %/, %/built-in.o, $(core-y)):= $(patsubst %/, %/built-in.o, $(core-y))
 drivers-ydrivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)):= $(patsubst %/, %/built-in.o, $(drivers-y))
 net-ynet-y := $(patsubst %/, %/built-in.o, $(net-y)):= $(patsubst %/, %/built-in.o, $(net-y))
 libs-y1libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)):= $(patsubst %/, %/lib.a, $(libs-y))
 libs-y2libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)):= $(patsubst %/, %/built-in.o, $(libs-y))
 libs-ylibs-y := $(libs-y1) $(libs-y2):= $(libs-y1) $(libs-y2)
 vmlinux-init := $(head-y) $(init-y)vmlinux-init := $(head-y) $(init-y)
 vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
 vmlinux-all := $(vmlinux-init) $(vmlinux-main)vmlinux-all := $(vmlinux-init) $(vmlinux-main)
 vmlinux-lds := arch/$(ARCH)/kernel/vmlinux.ldsvmlinux-lds := arch/$(ARCH)/kernel/vmlinux.lds
 kallsyms.o := .tmp_kallsyms$(last_kallsyms).okallsyms.o := .tmp_kallsyms$(last_kallsyms).o
Makefile source 5Makefile source 5
 vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCEvmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
 $(call if_changed_rule,vmlinux__)$(call if_changed_rule,vmlinux__)
 $(vmlinux-dirs): prepare-all scripts$(vmlinux-dirs): prepare-all scripts
 $(Q)$(MAKE) $(build)=$@$(Q)$(MAKE) $(build)=$@
 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)
 @echo ' Building modules, stage 2.';@echo ' Building modules, stage 2.';
 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost
 @rm -rf $(MODLIB)/kernel@rm -rf $(MODLIB)/kernel
 @rm -f $(MODLIB)/source@rm -f $(MODLIB)/source
 @mkdir -p $(MODLIB)/kernel@mkdir -p $(MODLIB)/kernel
 @ln -s $(srctree) $(MODLIB)/source@ln -s $(srctree) $(MODLIB)/source
 @if [ ! $(objtree) -ef $(MODLIB)/build ]; then @if [ ! $(objtree) -ef $(MODLIB)/build ]; then 
 rm -f $(MODLIB)/build ; rm -f $(MODLIB)/build ; 
 ln -s $(objtree) $(MODLIB)/build ; ln -s $(objtree) $(MODLIB)/build ; 
 fifi
 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile
2005_Structures and functions of Makefile

More Related Content

What's hot (18)

PDF
High Performance tDiary
Hiroshi SHIBATA
 
TXT
Logrotate sh
Ben Pope
 
PDF
Debugging: Rules & Tools
Ian Barber
 
PDF
Ansible leveraging 2.0
bcoca
 
PPTX
DevOps with Fabric
Simone Federici
 
PDF
GHCソースコード読みのススメ
Kiwamu Okabe
 
PPT
eZ Publish Cluster Unleashed
Bertrand Dunogier
 
PPT
On UnQLite
charsbar
 
PDF
Apache Hive Hook
Minwoo Kim
 
PDF
mapserver_install_linux
tutorialsruby
 
PPTX
Dtalk shell
Miha Mencin
 
PDF
Installing Apache Hive, internal and external table, import-export
Rupak Roy
 
PDF
はじめてのSymfony2
Tomohiro MITSUMUNE
 
PDF
Hypers and Gathers and Takes! Oh my!
Workhorse Computing
 
PDF
Memory Manglement in Raku
Workhorse Computing
 
PDF
WordPress 運用を支える Perl
鉄次 尾形
 
DOC
Function Call Optimization
ppd1961
 
PDF
BSDM with BASH: Command Interpolation
Workhorse Computing
 
High Performance tDiary
Hiroshi SHIBATA
 
Logrotate sh
Ben Pope
 
Debugging: Rules & Tools
Ian Barber
 
Ansible leveraging 2.0
bcoca
 
DevOps with Fabric
Simone Federici
 
GHCソースコード読みのススメ
Kiwamu Okabe
 
eZ Publish Cluster Unleashed
Bertrand Dunogier
 
On UnQLite
charsbar
 
Apache Hive Hook
Minwoo Kim
 
mapserver_install_linux
tutorialsruby
 
Dtalk shell
Miha Mencin
 
Installing Apache Hive, internal and external table, import-export
Rupak Roy
 
はじめてのSymfony2
Tomohiro MITSUMUNE
 
Hypers and Gathers and Takes! Oh my!
Workhorse Computing
 
Memory Manglement in Raku
Workhorse Computing
 
WordPress 運用を支える Perl
鉄次 尾形
 
Function Call Optimization
ppd1961
 
BSDM with BASH: Command Interpolation
Workhorse Computing
 

Viewers also liked (6)

PDF
technical report
NakCheon Jung
 
PDF
KCC2007_VoIP
NakCheon Jung
 
PDF
ce_grad
NakCheon Jung
 
PPT
programming with GDB
NakCheon Jung
 
PDF
ice_grad
NakCheon Jung
 
PPT
2004_P2P chatting program
NakCheon Jung
 
technical report
NakCheon Jung
 
KCC2007_VoIP
NakCheon Jung
 
ce_grad
NakCheon Jung
 
programming with GDB
NakCheon Jung
 
ice_grad
NakCheon Jung
 
2004_P2P chatting program
NakCheon Jung
 
Ad

Similar to 2005_Structures and functions of Makefile (20)

PDF
Performance Profiling in Rust
InfluxData
 
KEY
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
PPT
OpenWRT guide and memo
家榮 吳
 
PDF
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
Puppet
 
PDF
Challenges of container configuration
lutter
 
PDF
CMake Tutorial
Fu Haiping
 
PDF
SANS @Night There's Gold in Them Thar Package Management Databases
Phil Hagen
 
PDF
LOSS_C11- Programming Linux 20221006.pdf
Thninh2
 
PDF
Composer for busy developers - DPC13
Rafael Dohms
 
PDF
All I Need to Know I Learned by Writing My Own Web Framework
Ben Scofield
 
PDF
Frontend JS workflow - Gulp 4 and the like
Damien Seguin
 
PDF
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
PDF
infra-as-code
Itamar Hassin
 
ODP
Asian Spirit 3 Day Dba On Ubl
newrforce
 
PDF
Practical Chef and Capistrano for Your Rails App
SmartLogic
 
KEY
Crafting Beautiful CLI Applications in Ruby
Nikhil Mungel
 
KEY
Composer
Tom Corrigan
 
DOC
X64服务器 lnmp服务器部署标准 new
Yiwei Ma
 
PPT
Linux
Hema Prasanth
 
PPT
Ant
Manav Prasad
 
Performance Profiling in Rust
InfluxData
 
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
OpenWRT guide and memo
家榮 吳
 
PuppetConf 2016: The Challenges with Container Configuration – David Lutterko...
Puppet
 
Challenges of container configuration
lutter
 
CMake Tutorial
Fu Haiping
 
SANS @Night There's Gold in Them Thar Package Management Databases
Phil Hagen
 
LOSS_C11- Programming Linux 20221006.pdf
Thninh2
 
Composer for busy developers - DPC13
Rafael Dohms
 
All I Need to Know I Learned by Writing My Own Web Framework
Ben Scofield
 
Frontend JS workflow - Gulp 4 and the like
Damien Seguin
 
Dependencies Managers in C/C++. Using stdcpp 2014
biicode
 
infra-as-code
Itamar Hassin
 
Asian Spirit 3 Day Dba On Ubl
newrforce
 
Practical Chef and Capistrano for Your Rails App
SmartLogic
 
Crafting Beautiful CLI Applications in Ruby
Nikhil Mungel
 
Composer
Tom Corrigan
 
X64服务器 lnmp服务器部署标准 new
Yiwei Ma
 
Ad

2005_Structures and functions of Makefile

  • 1. MakefileMakefile 의 구조 및 기능의 구조 및 기능 (Linux-2.6.10 version)(Linux-2.6.10 version)
  • 2. MakefileMakefile 의 구조의 구조  OverviewOverview  Who does whatWho does what  Important check kbuild filesImportant check kbuild files  Observe Makefiles sourceObserve Makefiles source
  • 3. overviewoverview  Top makefileTop makefile  .config.config  Arch/$(ARCH)/MakefileArch/$(ARCH)/Makefile  Script/MakefileScript/Makefile  Kbuild makefilesKbuild makefiles
  • 4. Top makefileTop makefile  The top makefile reads the .config fileThe top makefile reads the .config file  Two major product :Two major product :  Vmlinux(the resident kernel image)Vmlinux(the resident kernel image)  Modules(any module files)Modules(any module files)
  • 5. .config & arch makefile.config & arch makefile  .config file.config file  From kernel configuration processFrom kernel configuration process  Get list of subderectoriesGet list of subderectories  Arch makefileArch makefile  Supplies architecture specific informationSupplies architecture specific information
  • 6. Script & kbuild makefileScript & kbuild makefile  Script makefileScript makefile  Contains all the definitions/rules etcContains all the definitions/rules etc  Kbuild makefileKbuild makefile  Build any built-in or modular targetsBuild any built-in or modular targets  Uses from the .config fileUses from the .config file
  • 7. Who does whatWho does what  Users : people(build kernels)Users : people(build kernels)  Normal developersNormal developers  Make features(device drivers, file systems,Make features(device drivers, file systems, network protocols)network protocols)  Arch developersArch developers  Make entire architecture(sparc or ia64..etc)Make entire architecture(sparc or ia64..etc)  Kbuild developersKbuild developers  Make kernel build system itselfMake kernel build system itself
  • 8. Check important kbuild filesCheck important kbuild files  Goal definitionsGoal definitions  Contain files to built, compilation options,Contain files to built, compilation options, and any subdirectories..etcand any subdirectories..etc  Built-in object goals(obj-y)Built-in object goals(obj-y)  Object file to compileObject file to compile  Loadable module goals(obj-m)Loadable module goals(obj-m)  Library file goals(lib-y)Library file goals(lib-y)  Library to built-in object files for modulesLibrary to built-in object files for modules and combineand combine
  • 9. Makefiles source 1Makefiles source 1  MRPROPER_DIRS += include/config include2MRPROPER_DIRS += include/config include2  MRPROPER_FILES += .config .config.old include/asm .version MRPROPER_FILES += .config .config.old include/asm .version  include/linux/autoconf.h include/linux/version.h include/linux/autoconf.h include/linux/version.h  Module.symvers tags TAGS cscope*Module.symvers tags TAGS cscope*  mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))  mrproper: rm-files := $(wildcard $(MRPROPER_FILES))mrproper: rm-files := $(wildcard $(MRPROPER_FILES))  mrproper-dirs := $(addprefix_mrproper_,Documentation/DocBook scripts)mrproper-dirs := $(addprefix_mrproper_,Documentation/DocBook scripts)  .PHONY: $(mrproper-dirs) mrproper archmrproper.PHONY: $(mrproper-dirs) mrproper archmrproper  $(mrproper-dirs):$(mrproper-dirs):  $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)  mrproper: clean archmrproper $(mrproper-dirs)mrproper: clean archmrproper $(mrproper-dirs)  $(call cmd,rmdirs)$(call cmd,rmdirs)  $(call cmd,rmfiles)$(call cmd,rmfiles)
  • 10. Makefile source 2Makefile source 2  include/config/MARKER: include/linux/autoconf.hinclude/config/MARKER: include/linux/autoconf.h  include $(srctree)/arch/$(ARCH)/Makefile export KBUILD_DEFCONFIGinclude $(srctree)/arch/$(ARCH)/Makefile export KBUILD_DEFCONFIG  init-yinit-y := init/:= init/  drivers-ydrivers-y := drivers/ sound/:= drivers/ sound/  net-ynet-y := net/:= net/  libs-ylibs-y := lib/:= lib/  core-ycore-y := usr/:= usr/  CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-+= $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,- functions)functions)  CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)+= $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels)  CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)+= $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops)  CFLAGSCFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)+= $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps)  CFLAGSCFLAGS += -fno-omit-frame-pointer+= -fno-omit-frame-pointer  elseelse  CFLAGSCFLAGS += -fomit-frame-pointer+= -fomit-frame-pointer  CFLAGSCFLAGS += -g+= -g
  • 11. Makefiles source 3Makefiles source 3  clean: rm-dirs := $(CLEAN_DIRS)clean: rm-dirs := $(CLEAN_DIRS)  clean: rm-files := $(CLEAN_FILES)clean: rm-files := $(CLEAN_FILES)  clean-dirs := $(addprefix _clean_,$(vmlinux-clean-dirs := $(addprefix _clean_,$(vmlinux- alldirs))alldirs))  .PHONY: $(clean-dirs) clean archclean.PHONY: $(clean-dirs) clean archclean  $(clean-dirs):$(clean-dirs):  $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,$(Q)$(MAKE) $(clean)=$(patsubst _clean_%, %,$@)%,$@)  clean: archclean $(clean-dirs)clean: archclean $(clean-dirs)
  • 12. Makefile source 4Makefile source 4  core-ycore-y += kernel/ mm/ fs/ ipc/ security/ crypto/+= kernel/ mm/ fs/ ipc/ security/ crypto/  vmlinux-dirsvmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m)  $(core-y) $(core-m) $(drivers-y) $(drivers-m) $(core-y) $(core-m) $(drivers-y) $(drivers-m)  $(net-y) $(net-m) $(libs-y) $(libs-m)))$(net-y) $(net-m) $(libs-y) $(libs-m)))  vmlinux-alldirsvmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/,  $(init-n) $(init-) $(init-n) $(init-)  $(core-n) $(core-) $(drivers-n) $(drivers-) $(core-n) $(core-) $(drivers-n) $(drivers-)  $(net-n) $(net-) $(libs-n) $(libs-))))$(net-n) $(net-) $(libs-n) $(libs-))))  init-yinit-y := $(patsubst %/, %/built-in.o, $(init-y)):= $(patsubst %/, %/built-in.o, $(init-y))  core-ycore-y := $(patsubst %/, %/built-in.o, $(core-y)):= $(patsubst %/, %/built-in.o, $(core-y))  drivers-ydrivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)):= $(patsubst %/, %/built-in.o, $(drivers-y))  net-ynet-y := $(patsubst %/, %/built-in.o, $(net-y)):= $(patsubst %/, %/built-in.o, $(net-y))  libs-y1libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)):= $(patsubst %/, %/lib.a, $(libs-y))  libs-y2libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)):= $(patsubst %/, %/built-in.o, $(libs-y))  libs-ylibs-y := $(libs-y1) $(libs-y2):= $(libs-y1) $(libs-y2)  vmlinux-init := $(head-y) $(init-y)vmlinux-init := $(head-y) $(init-y)  vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)  vmlinux-all := $(vmlinux-init) $(vmlinux-main)vmlinux-all := $(vmlinux-init) $(vmlinux-main)  vmlinux-lds := arch/$(ARCH)/kernel/vmlinux.ldsvmlinux-lds := arch/$(ARCH)/kernel/vmlinux.lds  kallsyms.o := .tmp_kallsyms$(last_kallsyms).okallsyms.o := .tmp_kallsyms$(last_kallsyms).o
  • 13. Makefile source 5Makefile source 5  vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCEvmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE  $(call if_changed_rule,vmlinux__)$(call if_changed_rule,vmlinux__)  $(vmlinux-dirs): prepare-all scripts$(vmlinux-dirs): prepare-all scripts  $(Q)$(MAKE) $(build)=$@$(Q)$(MAKE) $(build)=$@  modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux)  @echo ' Building modules, stage 2.';@echo ' Building modules, stage 2.';  $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modpost  @rm -rf $(MODLIB)/kernel@rm -rf $(MODLIB)/kernel  @rm -f $(MODLIB)/source@rm -f $(MODLIB)/source  @mkdir -p $(MODLIB)/kernel@mkdir -p $(MODLIB)/kernel  @ln -s $(srctree) $(MODLIB)/source@ln -s $(srctree) $(MODLIB)/source  @if [ ! $(objtree) -ef $(MODLIB)/build ]; then @if [ ! $(objtree) -ef $(MODLIB)/build ]; then  rm -f $(MODLIB)/build ; rm -f $(MODLIB)/build ;  ln -s $(objtree) $(MODLIB)/build ; ln -s $(objtree) $(MODLIB)/build ;  fifi  $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst