📄 makefile
字号:
symlinks: rm -f include/asm ( cd include ; ln -sf asm-$(ARCH) asm) @if [ ! -d include/linux/modules ]; then \ mkdir include/linux/modules; \ fioldconfig: symlinks $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.inxconfig: symlinks $(MAKE) -C scripts kconfig.tk wish -f scripts/kconfig.tkmenuconfig: include/linux/version.h symlinks $(MAKE) -C scripts/lxdialog all $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.inconfig: symlinks $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.ininclude/config/MARKER: scripts/split-include include/linux/autoconf.h scripts/split-include include/linux/autoconf.h include/config @ touch include/config/MARKERlinuxsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))$(patsubst %, _dir_%, $(SUBDIRS)) : dummy include/linux/version.h include/config/MARKER $(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" -C $(patsubst _dir_%, %, $@)$(TOPDIR)/include/linux/version.h: include/linux/version.h$(TOPDIR)/include/linux/compile.h: include/linux/compile.hnewversion: . scripts/mkversion > .tmpversion @mv -f .tmpversion .versioninclude/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion @echo -n \#define UTS_VERSION \"\#`cat .version` > .ver @if [ -n "$(CONFIG_SMP)" ] ; then echo -n " SMP" >> .ver; fi @if [ -f .name ]; then echo -n \-`cat .name` >> .ver; fi @echo ' '`date`'"' >> .ver @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver @if [ -x /bin/dnsdomainname ]; then \ echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \ elif [ -x /bin/domainname ]; then \ echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \ else \ echo \#define LINUX_COMPILE_DOMAIN ; \ fi >> .ver @echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >> .ver @mv -f .ver $@include/linux/version.h: ./Makefile @echo \#define UTS_RELEASE \"$(KERNELRELEASE)\" > .ver @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver @echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' >>.ver @mv -f .ver $@comma := ,init/version.o: init/version.c include/linux/compile.h include/config/MARKER $(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DUTS_MACHINE='"$(ARCH)"' -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.cinit/main.o: init/main.c include/config/MARKER $(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $*.o $<fs lib mm ipc kernel drivers net: dummy $(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" $(subst $@, _dir_$@, $@)TAGS: dummy etags `find include/asm-$(ARCH) -name '*.h'` find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs etags -a find $(SUBDIRS) init -name '*.[ch]' | xargs etags -a# Exuberant ctags works better with -Itags: dummy CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \ ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \ find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \ find $(SUBDIRS) init -name '*.[ch]' | xargs ctags $$CTAGSF -aifdef CONFIG_MODULESifdef CONFIG_MODVERSIONSMODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.hendif.PHONY: modulesmodules: $(patsubst %, _mod_%, $(SUBDIRS)).PHONY: $(patsubst %, _mod_%, $(SUBDIRS))$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h include/config/MARKER $(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules.PHONY: modules_installmodules_install: _modinst_ $(patsubst %, _modinst_%, $(SUBDIRS)) _modinst_post.PHONY: _modinst__modinst_: @rm -rf $(MODLIB)/kernel @rm -f $(MODLIB)/build @mkdir -p $(MODLIB)/kernel @ln -s $(TOPDIR) $(MODLIB)/build# If System.map exists, run depmod. This deliberately does not have a# dependency on System.map since that would run the dependency tree on# vmlinux. This depmod is only for convenience to give the initial# boot a modules.dep even before / is mounted read-write. However the# boot script depmod is the master version.ifeq "$(strip $(INSTALL_MOD_PATH))" ""depmod_opts :=elsedepmod_opts := -b $(INSTALL_MOD_PATH) -rendif.PHONY: _modinst_post_modinst_post: _modinst_post_pcmcia# if [ -r System.map ]; then $(DEPMOD) -ae -F System.map $(depmod_opts) $(KERNELRELEASE); fi# Backwards compatibilty symlinks for people still using old versions# of pcmcia-cs with hard coded pathnames on insmod. Remove# _modinst_post_pcmcia for kernel 2.4.1..PHONY: _modinst_post_pcmcia_modinst_post_pcmcia: cd $(MODLIB); \ mkdir -p pcmcia; \ find kernel -path '*/pcmcia/*' -name '*.o' | xargs -i -r ln -sf ../{} pcmcia.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))$(patsubst %, _modinst_%, $(SUBDIRS)) : $(MAKE) -C $(patsubst _modinst_%, %, $@) modules_install# modules disabled....elsemodules modules_install: dummy @echo @echo "The present kernel configuration has modules disabled." @echo "Type 'make config' and enable loadable module support." @echo "Then build a kernel with module support enabled." @echo @exit 1endifclean: archclean find . \( -name '*.[oas]' -o -name core -o -name '.*.flags' \) -type f -print \ | grep -v lxdialog/ | xargs rm -f rm -f $(CLEAN_FILES) rm -rf $(CLEAN_DIRS) $(MAKE) -C Documentation/DocBook cleanmrproper: clean archmrproper find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f rm -f $(MRPROPER_FILES) rm -rf $(MRPROPER_DIRS) $(MAKE) -C Documentation/DocBook mrproperdistclean: mrproper rm -f core `find . \( -not -type d \) -and \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS tagsbackup: mrproper cd .. && tar cf - linux/ | gzip -9 > backup.gz syncsgmldocs: chmod 755 $(TOPDIR)/scripts/docgen chmod 755 $(TOPDIR)/scripts/gen-all-syms chmod 755 $(TOPDIR)/scripts/kernel-doc $(MAKE) -C $(TOPDIR)/Documentation/DocBook bookspsdocs: sgmldocs $(MAKE) -C Documentation/DocBook pspdfdocs: sgmldocs $(MAKE) -C Documentation/DocBook pdfhtmldocs: sgmldocs $(MAKE) -C Documentation/DocBook htmlsums: find . -type f -print | sort | xargs sum > .SUMSdep-files: scripts/mkdep archdep include/linux/version.h scripts/mkdep -- init/*.c > .depend scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend $(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"ifdef CONFIG_MODVERSIONS $(MAKE) update-modverfileendififdef CONFIG_MODVERSIONSMODVERFILE := $(TOPDIR)/include/linux/modversions.helseMODVERFILE :=endifexport MODVERFILEdepend dep: dep-filescheckconfig: find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkconfig.plcheckhelp: find * -name [cC]onfig.in -print | sort | xargs $(PERL) -w scripts/checkhelp.plcheckincludes: find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.plifdef CONFIGURATION..$(CONFIGURATION): @echo @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'" @echo $(MAKE) $(CONFIGURATION) @echo @echo "Successful. Try re-making (ignore the error that follows)" @echo exit 1#dummy: ..$(CONFIGURATION)dummy:elsedummy:endifinclude Rules.make## This generates dependencies for the .h files.#scripts/mkdep: scripts/mkdep.c $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.cscripts/split-include: scripts/split-include.c $(HOSTCC) $(HOSTCFLAGS) -o scripts/split-include scripts/split-include.c## RPM target## If you do a make spec before packing the tarball you can rpm -ta it#spec: . scripts/mkspec >kernel.spec## Build a tar ball, generate an rpm from it and pack the result# There arw two bits of magic here# 1) The use of /. to avoid tar packing just the symlink# 2) Removing the .dep files as they have source paths in them that# will become invalid#rpm: clean spec find . \( -size 0 -o -name .depend -o -name .hdepend \) -type f -print | xargs rm -f set -e; \ cd $(TOPDIR)/.. ; \ ln -sf $(TOPDIR) $(KERNELPATH) ; \ tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \ rm $(KERNELPATH) ; \ cd $(TOPDIR) ; \ . scripts/mkversion > .version ; \ rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \ rm $(TOPDIR)/../$(KERNELPATH).tar.gz
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -