diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 50 |
1 files changed, 38 insertions, 12 deletions
@@ -309,6 +309,9 @@ CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | |||
309 | 309 | ||
310 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 310 | CFLAGS := -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 | ||
313 | CFLAGS += $(call cc-option, -fno-stack-protector-all \ | ||
314 | -fno-stack-protector) | ||
312 | AFLAGS := -D__ASSEMBLY__ | 315 | AFLAGS := -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 |
810 | prepare2: prepare3 outputmakefile | 813 | prepare2: prepare3 outputmakefile |
811 | 814 | ||
812 | prepare1: prepare2 include/linux/version.h include/asm \ | 815 | prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ |
813 | include/config/auto.conf | 816 | include/asm include/config/auto.conf |
814 | ifneq ($(KBUILD_MODULES),) | 817 | ifneq ($(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 | ||
847 | uts_len := 64 | 850 | uts_len := 64 |
851 | define 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)\";) | ||
857 | endef | ||
848 | 858 | ||
849 | define filechk_version.h | 859 | define 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 | ) | ||
858 | endef | 863 | endef |
859 | 864 | ||
860 | include/linux/version.h: $(srctree)/Makefile include/config/kernel.release FORCE | 865 | include/linux/version.h: $(srctree)/Makefile FORCE |
861 | $(call filechk,version.h) | 866 | $(call filechk,version.h) |
862 | 867 | ||
868 | include/linux/utsrelease.h: include/config/kernel.release FORCE | ||
869 | $(call filechk,utsrelease.h) | ||
870 | |||
863 | # --------------------------------------------------------------------------- | 871 | # --------------------------------------------------------------------------- |
864 | 872 | ||
865 | PHONY += depend dep | 873 | PHONY += 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 | ||
879 | INSTALL_HDR_PATH=$(MODLIB)/abi | ||
880 | export INSTALL_HDR_PATH | ||
881 | |||
882 | PHONY += headers_install | ||
883 | headers_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 | |||
888 | PHONY += headers_check | ||
889 | headers_check: headers_install | ||
890 | $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.headersinst obj=include HDRCHECK=1 | ||
891 | |||
892 | # --------------------------------------------------------------------------- | ||
870 | # Modules | 893 | # Modules |
871 | 894 | ||
872 | ifdef CONFIG_MODULES | 895 | ifdef 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' |
953 | MRPROPER_DIRS += include/config include2 | 976 | MRPROPER_DIRS += include/config include2 |
954 | MRPROPER_FILES += .config .config.old include/asm .version .old_version \ | 977 | MRPROPER_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' |