aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 22 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 673148e07603..c3a727126d26 100644
--- a/Makefile
+++ b/Makefile
@@ -106,12 +106,13 @@ KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
106$(if $(KBUILD_OUTPUT),, \ 106$(if $(KBUILD_OUTPUT),, \
107 $(error output directory "$(saved-output)" does not exist)) 107 $(error output directory "$(saved-output)" does not exist))
108 108
109.PHONY: $(MAKECMDGOALS) 109.PHONY: $(MAKECMDGOALS) cdbuilddir
110$(MAKECMDGOALS) _all: cdbuilddir
110 111
111$(filter-out _all,$(MAKECMDGOALS)) _all: 112cdbuilddir:
112 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ 113 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
113 KBUILD_SRC=$(CURDIR) \ 114 KBUILD_SRC=$(CURDIR) \
114 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $@ 115 KBUILD_EXTMOD="$(KBUILD_EXTMOD)" -f $(CURDIR)/Makefile $(MAKECMDGOALS)
115 116
116# Leave processing to above invocation of make 117# Leave processing to above invocation of make
117skip-makefile := 1 118skip-makefile := 1
@@ -262,6 +263,13 @@ export quiet Q KBUILD_VERBOSE
262# cc support functions to be used (only) in arch/$(ARCH)/Makefile 263# cc support functions to be used (only) in arch/$(ARCH)/Makefile
263# See documentation in Documentation/kbuild/makefiles.txt 264# See documentation in Documentation/kbuild/makefiles.txt
264 265
266# as-option
267# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)
268
269as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
270 -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
271 else echo "$(2)"; fi ;)
272
265# cc-option 273# cc-option
266# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) 274# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
267 275
@@ -337,8 +345,9 @@ AFLAGS := -D__ASSEMBLY__
337 345
338# Read KERNELRELEASE from .kernelrelease (if it exists) 346# Read KERNELRELEASE from .kernelrelease (if it exists)
339KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null) 347KERNELRELEASE = $(shell cat .kernelrelease 2> /dev/null)
348KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
340 349
341export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE \ 350export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION \
342 ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ 351 ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
343 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ 352 CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
344 HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 353 HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
@@ -433,6 +442,7 @@ export KBUILD_DEFCONFIG
433config %config: scripts_basic outputmakefile FORCE 442config %config: scripts_basic outputmakefile FORCE
434 $(Q)mkdir -p include/linux 443 $(Q)mkdir -p include/linux
435 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 444 $(Q)$(MAKE) $(build)=scripts/kconfig $@
445 $(Q)$(MAKE) .kernelrelease
436 446
437else 447else
438# =========================================================================== 448# ===========================================================================
@@ -542,7 +552,7 @@ export INSTALL_PATH ?= /boot
542# makefile but the arguement can be passed to make if needed. 552# makefile but the arguement can be passed to make if needed.
543# 553#
544 554
545MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) 555MODLIB = $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE)
546export MODLIB 556export MODLIB
547 557
548 558
@@ -783,12 +793,10 @@ endif
783localver-full = $(localver)$(localver-auto) 793localver-full = $(localver)$(localver-auto)
784 794
785# Store (new) KERNELRELASE string in .kernelrelease 795# Store (new) KERNELRELASE string in .kernelrelease
786kernelrelease = \ 796kernelrelease = $(KERNELVERSION)$(localver-full)
787 $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(localver-full)
788.kernelrelease: FORCE 797.kernelrelease: FORCE
789 $(Q)rm -f .kernelrelease 798 $(Q)rm -f $@
790 $(Q)echo $(kernelrelease) > .kernelrelease 799 $(Q)echo $(kernelrelease) > $@
791 $(Q)echo " Building kernel $(kernelrelease)"
792 800
793 801
794# Things we need to do before we recursively start building the kernel 802# Things we need to do before we recursively start building the kernel
@@ -898,7 +906,7 @@ define filechk_version.h
898 ) 906 )
899endef 907endef
900 908
901include/linux/version.h: $(srctree)/Makefile FORCE 909include/linux/version.h: $(srctree)/Makefile .config FORCE
902 $(call filechk,version.h) 910 $(call filechk,version.h)
903 911
904# --------------------------------------------------------------------------- 912# ---------------------------------------------------------------------------
@@ -1301,9 +1309,10 @@ checkstack:
1301 $(PERL) $(src)/scripts/checkstack.pl $(ARCH) 1309 $(PERL) $(src)/scripts/checkstack.pl $(ARCH)
1302 1310
1303kernelrelease: 1311kernelrelease:
1304 @echo $(KERNELRELEASE) 1312 $(if $(wildcard .kernelrelease), $(Q)echo $(KERNELRELEASE), \
1313 $(error kernelrelease not valid - run 'make *config' to update it))
1305kernelversion: 1314kernelversion:
1306 @echo $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) 1315 @echo $(KERNELVERSION)
1307 1316
1308# FIXME Should go into a make.lib or something 1317# FIXME Should go into a make.lib or something
1309# =========================================================================== 1318# ===========================================================================