aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile62
1 files changed, 27 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 63e5c9f0bc7a..382298f37adf 100644
--- a/Makefile
+++ b/Makefile
@@ -334,7 +334,7 @@ KALLSYMS = scripts/kallsyms
334PERL = perl 334PERL = perl
335CHECK = sparse 335CHECK = sparse
336 336
337CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ 337CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ $(CF)
338MODFLAGS = -DMODULE 338MODFLAGS = -DMODULE
339CFLAGS_MODULE = $(MODFLAGS) 339CFLAGS_MODULE = $(MODFLAGS)
340AFLAGS_MODULE = $(MODFLAGS) 340AFLAGS_MODULE = $(MODFLAGS)
@@ -382,6 +382,9 @@ RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CV
382scripts_basic: 382scripts_basic:
383 $(Q)$(MAKE) $(build)=scripts/basic 383 $(Q)$(MAKE) $(build)=scripts/basic
384 384
385# To avoid any implicit rule to kick in, define an empty command.
386scripts/basic/%: scripts_basic ;
387
385.PHONY: outputmakefile 388.PHONY: outputmakefile
386# outputmakefile generate a Makefile to be placed in output directory, if 389# outputmakefile generate a Makefile to be placed in output directory, if
387# using a seperate output directory. This allows convinient use 390# using a seperate output directory. This allows convinient use
@@ -444,9 +447,8 @@ ifeq ($(config-targets),1)
444include $(srctree)/arch/$(ARCH)/Makefile 447include $(srctree)/arch/$(ARCH)/Makefile
445export KBUILD_DEFCONFIG 448export KBUILD_DEFCONFIG
446 449
447config: scripts_basic outputmakefile FORCE 450config %config: scripts_basic outputmakefile FORCE
448 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 451 $(Q)mkdir -p include/linux
449%config: scripts_basic outputmakefile FORCE
450 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 452 $(Q)$(MAKE) $(build)=scripts/kconfig $@
451 453
452else 454else
@@ -641,8 +643,13 @@ quiet_cmd_vmlinux__ ?= LD $@
641# Generate new vmlinux version 643# Generate new vmlinux version
642quiet_cmd_vmlinux_version = GEN .version 644quiet_cmd_vmlinux_version = GEN .version
643 cmd_vmlinux_version = set -e; \ 645 cmd_vmlinux_version = set -e; \
644 . $(srctree)/scripts/mkversion > .tmp_version; \ 646 if [ ! -r .version ]; then \
645 mv -f .tmp_version .version; \ 647 rm -f .version; \
648 echo 1 >.version; \
649 else \
650 mv .version .old_version; \
651 expr 0$$(cat .old_version) + 1 >.version; \
652 fi; \
646 $(MAKE) $(build)=init 653 $(MAKE) $(build)=init
647 654
648# Generate System.map 655# Generate System.map
@@ -756,6 +763,7 @@ endif # ifdef CONFIG_KALLSYMS
756# vmlinux image - including updated kernel symbols 763# vmlinux image - including updated kernel symbols
757vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE 764vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
758 $(call if_changed_rule,vmlinux__) 765 $(call if_changed_rule,vmlinux__)
766 $(Q)rm -f .old_version
759 767
760# The actual objects are generated when descending, 768# The actual objects are generated when descending,
761# make sure no implicit rule kicks in 769# make sure no implicit rule kicks in
@@ -776,14 +784,14 @@ $(vmlinux-dirs): prepare-all scripts
776# A multi level approach is used. prepare1 is updated first, then prepare0. 784# A multi level approach is used. prepare1 is updated first, then prepare0.
777# prepare-all is the collection point for the prepare targets. 785# prepare-all is the collection point for the prepare targets.
778 786
779.PHONY: prepare-all prepare prepare0 prepare1 prepare2 787.PHONY: prepare-all prepare prepare0 prepare1 prepare2 prepare3
780 788
781# prepare2 is used to check if we are building in a separate output directory, 789# prepare3 is used to check if we are building in a separate output directory,
782# and if so do: 790# and if so do:
783# 1) Check that make has not been executed in the kernel src $(srctree) 791# 1) Check that make has not been executed in the kernel src $(srctree)
784# 2) Create the include2 directory, used for the second asm symlink 792# 2) Create the include2 directory, used for the second asm symlink
785 793
786prepare2: 794prepare3:
787ifneq ($(KBUILD_SRC),) 795ifneq ($(KBUILD_SRC),)
788 @echo ' Using $(srctree) as source for kernel' 796 @echo ' Using $(srctree) as source for kernel'
789 $(Q)if [ -f $(srctree)/.config ]; then \ 797 $(Q)if [ -f $(srctree)/.config ]; then \
@@ -795,18 +803,21 @@ ifneq ($(KBUILD_SRC),)
795 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm 803 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
796endif 804endif
797 805
798# prepare1 creates a makefile if using a separate output directory 806# prepare2 creates a makefile if using a separate output directory
799prepare1: prepare2 outputmakefile 807prepare2: prepare3 outputmakefile
800 808
801prepare0: prepare1 include/linux/version.h include/asm \ 809prepare1: prepare2 include/linux/version.h include/asm \
802 include/config/MARKER 810 include/config/MARKER
803ifneq ($(KBUILD_MODULES),) 811ifneq ($(KBUILD_MODULES),)
804 $(Q)rm -rf $(MODVERDIR) 812 $(Q)rm -rf $(MODVERDIR)
805 $(Q)mkdir -p $(MODVERDIR) 813 $(Q)mkdir -p $(MODVERDIR)
806endif 814endif
807 815
816prepare0: prepare prepare1 FORCE
817 $(Q)$(MAKE) $(build)=.
818
808# All the preparing.. 819# All the preparing..
809prepare-all: prepare0 prepare 820prepare-all: prepare0
810 821
811# Leave this as default for preprocessing vmlinux.lds.S, which is now 822# Leave this as default for preprocessing vmlinux.lds.S, which is now
812# done in arch/$(ARCH)/kernel/Makefile 823# done in arch/$(ARCH)/kernel/Makefile
@@ -845,7 +856,7 @@ include/asm:
845 856
846# Split autoconf.h into include/linux/config/* 857# Split autoconf.h into include/linux/config/*
847 858
848include/config/MARKER: include/linux/autoconf.h 859include/config/MARKER: scripts/basic/split-include include/linux/autoconf.h
849 @echo ' SPLIT include/linux/autoconf.h -> include/config/*' 860 @echo ' SPLIT include/linux/autoconf.h -> include/config/*'
850 @scripts/basic/split-include include/linux/autoconf.h include/config 861 @scripts/basic/split-include include/linux/autoconf.h include/config
851 @touch $@ 862 @touch $@
@@ -949,26 +960,6 @@ modules modules_install: FORCE
949 960
950endif # CONFIG_MODULES 961endif # CONFIG_MODULES
951 962
952# Generate asm-offsets.h
953# ---------------------------------------------------------------------------
954
955define filechk_gen-asm-offsets
956 (set -e; \
957 echo "#ifndef __ASM_OFFSETS_H__"; \
958 echo "#define __ASM_OFFSETS_H__"; \
959 echo "/*"; \
960 echo " * DO NOT MODIFY."; \
961 echo " *"; \
962 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
963 echo " *"; \
964 echo " */"; \
965 echo ""; \
966 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
967 echo ""; \
968 echo "#endif" )
969endef
970
971
972### 963###
973# Cleaning is done on three levels. 964# Cleaning is done on three levels.
974# make clean Delete most generated files 965# make clean Delete most generated files
@@ -991,7 +982,7 @@ MRPROPER_FILES += .config .config.old include/asm .version \
991# 982#
992clean: rm-dirs := $(CLEAN_DIRS) 983clean: rm-dirs := $(CLEAN_DIRS)
993clean: rm-files := $(CLEAN_FILES) 984clean: rm-files := $(CLEAN_FILES)
994clean-dirs := $(addprefix _clean_,$(vmlinux-alldirs)) 985clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))
995 986
996.PHONY: $(clean-dirs) clean archclean 987.PHONY: $(clean-dirs) clean archclean
997$(clean-dirs): 988$(clean-dirs):
@@ -1070,6 +1061,7 @@ help:
1070 @echo ' rpm - Build a kernel as an RPM package' 1061 @echo ' rpm - Build a kernel as an RPM package'
1071 @echo ' tags/TAGS - Generate tags file for editors' 1062 @echo ' tags/TAGS - Generate tags file for editors'
1072 @echo ' cscope - Generate cscope index' 1063 @echo ' cscope - Generate cscope index'
1064 @echo ' kernelrelease - Output the release version string'
1073 @echo '' 1065 @echo ''
1074 @echo 'Static analysers' 1066 @echo 'Static analysers'
1075 @echo ' buildcheck - List dangling references to vmlinux discarded sections' 1067 @echo ' buildcheck - List dangling references to vmlinux discarded sections'