Skip to content

Commit

Permalink
Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/li…
Browse files Browse the repository at this point in the history
…nux/kernel/git/tip/tip

Pull x86 build updates from Ingo Molnar:
 "A build system fix and a cleanup"

* 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  kbuild: Remove stale asm-generic wrappers
  kbuild, x86: Track generated headers with generated-y
  • Loading branch information
Linus Torvalds committed Jul 26, 2016
2 parents 77cd3d0 + cda2c65 commit 80f09cf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Documentation/kbuild/makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ This document describes the Linux kernel Makefiles.
--- 7.2 genhdr-y
--- 7.3 destination-y
--- 7.4 generic-y
--- 7.5 generated-y

=== 8 Kbuild Variables
=== 9 Makefile language
Expand Down Expand Up @@ -1319,6 +1320,19 @@ See subsequent chapter for the syntax of the Kbuild file.
Example: termios.h
#include <asm-generic/termios.h>

--- 7.5 generated-y

If an architecture generates other header files alongside generic-y
wrappers, and not included in genhdr-y, then generated-y specifies
them.

This prevents them being treated as stale asm-generic wrappers and
removed.

Example:
#arch/x86/include/asm/Kbuild
generated-y += syscalls_32.h

=== 8 Kbuild Variables

The top Makefile exports the following variables:
Expand Down
6 changes: 6 additions & 0 deletions arch/x86/include/asm/Kbuild
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@


generated-y += syscalls_32.h
generated-y += syscalls_64.h
generated-y += unistd_32_ia32.h
generated-y += unistd_64_x32.h
generated-y += xen-hypercalls.h

genhdr-y += unistd_32.h
genhdr-y += unistd_64.h
genhdr-y += unistd_x32.h
Expand Down
17 changes: 16 additions & 1 deletion scripts/Makefile.asm-generic
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,26 @@ include scripts/Kbuild.include
# Create output directory if not already present
_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))

# Stale wrappers when the corresponding files are removed from generic-y
# need removing.
generated-y := $(generic-y) $(genhdr-y) $(generated-y)
all-files := $(patsubst %, $(obj)/%, $(generated-y))
old-headers := $(wildcard $(obj)/*.h)
unwanted := $(filter-out $(all-files),$(old-headers))

quiet_cmd_wrap = WRAP $@
cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@

all: $(patsubst %, $(obj)/%, $(generic-y))
quiet_cmd_remove = REMOVE $(unwanted)
cmd_remove = rm -f $(unwanted)

all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE
$(if $(unwanted),$(call cmd,remove),)
@:

$(obj)/%.h:
$(call cmd,wrap)

PHONY += FORCE
.PHONY: $(PHONY)
FORCE: ;

0 comments on commit 80f09cf

Please sign in to comment.