aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile43
1 files changed, 27 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 846dd7607854..86eb6acb3978 100644
--- a/Makefile
+++ b/Makefile
@@ -350,12 +350,22 @@ AFLAGS_KERNEL =
350CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 350CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
351 351
352 352
353# Use USERINCLUDE when you must reference the UAPI directories only.
354USERINCLUDE := \
355 -I$(srctree)/arch/$(hdr-arch)/include/uapi \
356 -Iarch/$(hdr-arch)/include/generated/uapi \
357 -I$(srctree)/include/uapi \
358 -Iinclude/generated/uapi \
359 -include $(srctree)/include/linux/kconfig.h
360
353# Use LINUXINCLUDE when you must reference the include/ directory. 361# Use LINUXINCLUDE when you must reference the include/ directory.
354# Needed to be compatible with the O= option 362# Needed to be compatible with the O= option
355LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \ 363LINUXINCLUDE := \
356 -Iarch/$(hdr-arch)/include/generated -Iinclude \ 364 -I$(srctree)/arch/$(hdr-arch)/include \
357 $(if $(KBUILD_SRC), -I$(srctree)/include) \ 365 -Iarch/$(hdr-arch)/include/generated \
358 -include $(srctree)/include/linux/kconfig.h 366 $(if $(KBUILD_SRC), -I$(srctree)/include) \
367 -Iinclude \
368 $(USERINCLUDE)
359 369
360KBUILD_CPPFLAGS := -D__KERNEL__ 370KBUILD_CPPFLAGS := -D__KERNEL__
361 371
@@ -437,9 +447,11 @@ asm-generic:
437# Detect when mixed targets is specified, and make a second invocation 447# Detect when mixed targets is specified, and make a second invocation
438# of make so .config is not included in this case either (for *config). 448# of make so .config is not included in this case either (for *config).
439 449
450version_h := include/generated/uapi/linux/version.h
451
440no-dot-config-targets := clean mrproper distclean \ 452no-dot-config-targets := clean mrproper distclean \
441 cscope gtags TAGS tags help %docs check% coccicheck \ 453 cscope gtags TAGS tags help %docs check% coccicheck \
442 include/linux/version.h headers_% archheaders archscripts \ 454 $(version_h) headers_% archheaders archscripts \
443 kernelversion %src-pkg 455 kernelversion %src-pkg
444 456
445config-targets := 0 457config-targets := 0
@@ -809,7 +821,7 @@ endif
809# prepare2 creates a makefile if using a separate output directory 821# prepare2 creates a makefile if using a separate output directory
810prepare2: prepare3 outputmakefile asm-generic 822prepare2: prepare3 outputmakefile asm-generic
811 823
812prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ 824prepare1: prepare2 $(version_h) include/generated/utsrelease.h \
813 include/config/auto.conf 825 include/config/auto.conf
814 $(cmd_crmodverdir) 826 $(cmd_crmodverdir)
815 827
@@ -842,7 +854,7 @@ define filechk_version.h
842 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) 854 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
843endef 855endef
844 856
845include/linux/version.h: $(srctree)/Makefile FORCE 857$(version_h): $(srctree)/Makefile FORCE
846 $(call filechk,version.h) 858 $(call filechk,version.h)
847 859
848include/generated/utsrelease.h: include/config/kernel.release FORCE 860include/generated/utsrelease.h: include/config/kernel.release FORCE
@@ -887,7 +899,7 @@ PHONY += archscripts
887archscripts: 899archscripts:
888 900
889PHONY += __headers 901PHONY += __headers
890__headers: include/linux/version.h scripts_basic asm-generic archheaders archscripts FORCE 902__headers: $(version_h) scripts_basic asm-generic archheaders archscripts FORCE
891 $(Q)$(MAKE) $(build)=scripts build_unifdef 903 $(Q)$(MAKE) $(build)=scripts build_unifdef
892 904
893PHONY += headers_install_all 905PHONY += headers_install_all
@@ -896,10 +908,10 @@ headers_install_all:
896 908
897PHONY += headers_install 909PHONY += headers_install
898headers_install: __headers 910headers_install: __headers
899 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \ 911 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \
900 $(error Headers not exportable for the $(SRCARCH) architecture)) 912 $(error Headers not exportable for the $(SRCARCH) architecture))
901 $(Q)$(MAKE) $(hdr-inst)=include 913 $(Q)$(MAKE) $(hdr-inst)=include/uapi
902 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) 914 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst)
903 915
904PHONY += headers_check_all 916PHONY += headers_check_all
905headers_check_all: headers_install_all 917headers_check_all: headers_install_all
@@ -907,8 +919,8 @@ headers_check_all: headers_install_all
907 919
908PHONY += headers_check 920PHONY += headers_check
909headers_check: headers_install 921headers_check: headers_install
910 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1 922 $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
911 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1 923 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1
912 924
913# --------------------------------------------------------------------------- 925# ---------------------------------------------------------------------------
914# Modules 926# Modules
@@ -997,8 +1009,7 @@ CLEAN_DIRS += $(MODVERDIR)
997# Directories & files removed with 'make mrproper' 1009# Directories & files removed with 'make mrproper'
998MRPROPER_DIRS += include/config usr/include include/generated \ 1010MRPROPER_DIRS += include/config usr/include include/generated \
999 arch/*/include/generated 1011 arch/*/include/generated
1000MRPROPER_FILES += .config .config.old .version .old_version \ 1012MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
1001 include/linux/version.h \
1002 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS 1013 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
1003 1014
1004# clean - Delete most, but leave enough to build external modules 1015# clean - Delete most, but leave enough to build external modules