aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile50
1 files changed, 38 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 4dcf25d43fa6..11a850cffd3d 100644
--- a/Makefile
+++ b/Makefile
@@ -309,6 +309,9 @@ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
309 309
310CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 310CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
311 -fno-strict-aliasing -fno-common 311 -fno-strict-aliasing -fno-common
312# Force gcc to behave correct even for buggy distributions
313CFLAGS += $(call cc-option, -fno-stack-protector-all \
314 -fno-stack-protector)
312AFLAGS := -D__ASSEMBLY__ 315AFLAGS := -D__ASSEMBLY__
313 316
314# Read KERNELRELEASE from include/config/kernel.release (if it exists) 317# Read KERNELRELEASE from include/config/kernel.release (if it exists)
@@ -809,8 +812,8 @@ endif
809# prepare2 creates a makefile if using a separate output directory 812# prepare2 creates a makefile if using a separate output directory
810prepare2: prepare3 outputmakefile 813prepare2: prepare3 outputmakefile
811 814
812prepare1: prepare2 include/linux/version.h include/asm \ 815prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \
813 include/config/auto.conf 816 include/asm include/config/auto.conf
814ifneq ($(KBUILD_MODULES),) 817ifneq ($(KBUILD_MODULES),)
815 $(Q)mkdir -p $(MODVERDIR) 818 $(Q)mkdir -p $(MODVERDIR)
816 $(Q)rm -f $(MODVERDIR)/* 819 $(Q)rm -f $(MODVERDIR)/*
@@ -845,21 +848,26 @@ include/asm:
845# needs to be updated, so this check is forced on all builds 848# needs to be updated, so this check is forced on all builds
846 849
847uts_len := 64 850uts_len := 64
851define filechk_utsrelease.h
852 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \
853 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \
854 exit 1; \
855 fi; \
856 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";)
857endef
848 858
849define filechk_version.h 859define filechk_version.h
850 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ 860 (echo \#define LINUX_VERSION_CODE $(shell \
851 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ 861 expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
852 exit 1; \ 862 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
853 fi; \
854 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\"; \
855 echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)`; \
856 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))'; \
857 )
858endef 863endef
859 864
860include/linux/version.h: $(srctree)/Makefile include/config/kernel.release FORCE 865include/linux/version.h: $(srctree)/Makefile FORCE
861 $(call filechk,version.h) 866 $(call filechk,version.h)
862 867
868include/linux/utsrelease.h: include/config/kernel.release FORCE
869 $(call filechk,utsrelease.h)
870
863# --------------------------------------------------------------------------- 871# ---------------------------------------------------------------------------
864 872
865PHONY += depend dep 873PHONY += depend dep
@@ -867,6 +875,21 @@ depend dep:
867 @echo '*** Warning: make $@ is unnecessary now.' 875 @echo '*** Warning: make $@ is unnecessary now.'
868 876
869# --------------------------------------------------------------------------- 877# ---------------------------------------------------------------------------
878# Kernel headers
879INSTALL_HDR_PATH=$(MODLIB)/abi
880export INSTALL_HDR_PATH
881
882PHONY += headers_install
883headers_install: include/linux/version.h
884 $(Q)unifdef -Ux /dev/null
885 $(Q)rm -rf $(INSTALL_HDR_PATH)/include
886 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include
887
888PHONY += headers_check
889headers_check: headers_install
890 $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1
891
892# ---------------------------------------------------------------------------
870# Modules 893# Modules
871 894
872ifdef CONFIG_MODULES 895ifdef CONFIG_MODULES
@@ -952,7 +975,8 @@ CLEAN_FILES += vmlinux System.map \
952# Directories & files removed with 'make mrproper' 975# Directories & files removed with 'make mrproper'
953MRPROPER_DIRS += include/config include2 976MRPROPER_DIRS += include/config include2
954MRPROPER_FILES += .config .config.old include/asm .version .old_version \ 977MRPROPER_FILES += .config .config.old include/asm .version .old_version \
955 include/linux/autoconf.h include/linux/version.h \ 978 include/linux/autoconf.h include/linux/version.h \
979 include/linux/utsrelease.h \
956 Module.symvers tags TAGS cscope* 980 Module.symvers tags TAGS cscope*
957 981
958# clean - Delete most, but leave enough to build external modules 982# clean - Delete most, but leave enough to build external modules
@@ -1039,6 +1063,8 @@ help:
1039 @echo ' cscope - Generate cscope index' 1063 @echo ' cscope - Generate cscope index'
1040 @echo ' kernelrelease - Output the release version string' 1064 @echo ' kernelrelease - Output the release version string'
1041 @echo ' kernelversion - Output the version stored in Makefile' 1065 @echo ' kernelversion - Output the version stored in Makefile'
1066 @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'
1067 @echo ' (default: /lib/modules/$$VERSION/abi)'
1042 @echo '' 1068 @echo ''
1043 @echo 'Static analysers' 1069 @echo 'Static analysers'
1044 @echo ' checkstack - Generate a list of stack hogs' 1070 @echo ' checkstack - Generate a list of stack hogs'