path: root/Makefile
diff options
authorSam Ravnborg <>2011-04-27 22:29:49 +0200
committerMichal Marek <>2011-04-28 18:01:41 +0200
commitd8ecc5cd8e227bc318513b5306ae88a474b8886d (patch)
treef05fe662c000b8219923b8c464c9c186b599190e /Makefile
parent28bc20dccadc610c56e27255aeef2938141a0cd3 (diff)
kbuild: asm-generic support
There is an increasing amount of header files shared between individual architectures in asm-generic. To avoid a lot of dummy wrapper files that just include the corresponding file in asm-generic provide some basic support in kbuild for this. With the following patch an architecture can maintain a list of files in the file arch/$(ARCH)/include/asm/Kbuild To use a generic file just add: generic-y += <name-of-header-file.h> For each file listed kbuild will generate the necessary wrapper in arch/$(ARCH)/include/generated/asm. When installing userspace headers a wrapper is likewise created. The original inspiration for this came from the unicore32 patchset - although a different method is used. The patch includes several improvements from Arnd Bergmann. Michael Marek contributed Makefile.asm-generic. Remis Baima did an intial implementation along to achive the same - see Signed-off-by: Sam Ravnborg <> Acked-by: Guan Xuetao <> Tested-by: Guan Xuetao <> Acked-by: Arnd Bergmann <> Cc: Remis Lima Baima <> Signed-off-by: Michal Marek <>
Diffstat (limited to 'Makefile')
1 files changed, 12 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index d43429f4ced8..e509cc704968 100644
--- a/Makefile
+++ b/Makefile
@@ -349,7 +349,8 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
-LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include -Iinclude \
+LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \
+ -Iarch/$(hdr-arch)/include/generated -Iinclude \
$(if $(KBUILD_SRC), -I$(srctree)/include) \
-include include/generated/autoconf.h
@@ -417,6 +418,12 @@ ifneq ($(KBUILD_SRC),)
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
+# Support for using generic headers in asm-generic
+PHONY += asm-generic
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
+ obj=arch/$(SRCARCH)/include/generated/asm
# To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to scripts/kconfig/Makefile
# It is allowed to specify more targets when calling make, including
@@ -954,7 +961,7 @@ ifneq ($(KBUILD_SRC),)
# prepare2 creates a makefile if using a separate output directory
-prepare2: prepare3 outputmakefile
+prepare2: prepare3 outputmakefile asm-generic
prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
@@ -1028,7 +1035,7 @@ hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
PHONY += __headers
-__headers: include/linux/version.h scripts_basic FORCE
+__headers: include/linux/version.h scripts_basic asm-generic FORCE
$(Q)$(MAKE) $(build)=scripts build_unifdef
PHONY += headers_install_all
@@ -1143,7 +1150,8 @@ CLEAN_FILES += vmlinux \
.tmp_kallsyms* .tmp_version .tmp_vmlinux*
# Directories & files removed with 'make mrproper'
-MRPROPER_DIRS += include/config usr/include include/generated
+MRPROPER_DIRS += include/config usr/include include/generated \
+ arch/*/include/generated
MRPROPER_FILES += .config .config.old .version .old_version \
include/linux/version.h \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS