mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 03:20:55 +07:00
10b63956fc
Plumb the UAPI Kbuilds into the user header installation and checking system. As the headers are split the entries will be transferred across from the old Kbuild files to the UAPI Kbuild files. The changes made in this commit are: (1) Exported generated files (of which there are currently four) are moved to uapi/ directories under the appropriate generated/ directory, thus we get: include/generated/uapi/linux/version.h arch/x86/include/generated/uapi/asm/unistd_32.h arch/x86/include/generated/uapi/asm/unistd_64.h arch/x86/include/generated/uapi/asm/unistd_x32.h These paths were added to the build as -I flags in a previous patch. (2) scripts/Makefile.headersinst is now given the UAPI path to install from rather than the old path. It then determines the old path from that and includes that Kbuild also if it exists, thus permitting the headers to exist in either directory during the changeover. I also renamed the "install" variable to "installdir" as it refers to a directory not the install program. (3) scripts/headers_install.pl is altered to take a list of source file paths instead of just their names so that the makefile can tell it exactly where to find each file. For the moment, files can be obtained from one of four places for each output directory: .../include/uapi/foo/ .../include/generated/uapi/foo/ .../include/foo/ .../include/generated/foo/ The non-UAPI paths will be dropped later. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Acked-by: Dave Jones <davej@redhat.com>
132 lines
4.1 KiB
Makefile
132 lines
4.1 KiB
Makefile
# ==========================================================================
|
|
# Installing headers
|
|
#
|
|
# header-y - list files to be installed. They are preprocessed
|
|
# to remove __KERNEL__ section of the file
|
|
# genhdr-y - Same as header-y but in a generated/ directory
|
|
#
|
|
# ==========================================================================
|
|
|
|
# called may set destination dir (when installing to asm/)
|
|
_dst := $(or $(destination-y),$(dst),$(obj))
|
|
|
|
# generated header directory
|
|
gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
|
|
|
|
kbuild-file := $(srctree)/$(obj)/Kbuild
|
|
include $(kbuild-file)
|
|
|
|
old-kbuild-file := $(srctree)/$(subst uapi/,,$(obj))/Kbuild
|
|
ifneq ($(wildcard $(old-kbuild-file)),)
|
|
include $(old-kbuild-file)
|
|
endif
|
|
|
|
include scripts/Kbuild.include
|
|
|
|
installdir := $(INSTALL_HDR_PATH)/$(subst uapi/,,$(_dst))
|
|
|
|
header-y := $(sort $(header-y))
|
|
subdirs := $(patsubst %/,%,$(filter %/, $(header-y)))
|
|
header-y := $(filter-out %/, $(header-y))
|
|
|
|
# files used to track state of install/check
|
|
install-file := $(installdir)/.install
|
|
check-file := $(installdir)/.check
|
|
|
|
# generic-y list all files an architecture uses from asm-generic
|
|
# Use this to build a list of headers which require a wrapper
|
|
wrapper-files := $(filter $(header-y), $(generic-y))
|
|
|
|
srcdir := $(srctree)/$(obj)
|
|
gendir := $(objtree)/$(gen)
|
|
|
|
oldsrcdir := $(srctree)/$(subst /uapi,,$(obj))
|
|
|
|
# all headers files for this dir
|
|
header-y := $(filter-out $(generic-y), $(header-y))
|
|
all-files := $(header-y) $(genhdr-y) $(wrapper-files)
|
|
output-files := $(addprefix $(installdir)/, $(all-files))
|
|
|
|
input-files := $(foreach hdr, $(header-y), \
|
|
$(or \
|
|
$(wildcard $(srcdir)/$(hdr)), \
|
|
$(wildcard $(oldsrcdir)/$(hdr)), \
|
|
$(error Missing UAPI file $(srcdir)/$(hdr)) \
|
|
)) \
|
|
$(foreach hdr, $(genhdr-y), \
|
|
$(or \
|
|
$(wildcard $(gendir)/$(hdr)), \
|
|
$(error Missing generated UAPI file $(gendir)/$(hdr)) \
|
|
))
|
|
|
|
# Work out what needs to be removed
|
|
oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
|
|
unwanted := $(filter-out $(all-files),$(oldheaders))
|
|
|
|
# Prefix unwanted with full paths to $(INSTALL_HDR_PATH)
|
|
unwanted-file := $(addprefix $(installdir)/, $(unwanted))
|
|
|
|
printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
|
|
|
|
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
|
|
file$(if $(word 2, $(all-files)),s))
|
|
cmd_install = \
|
|
$(PERL) $< $(installdir) $(SRCARCH) $(input-files); \
|
|
for F in $(wrapper-files); do \
|
|
echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
|
|
done; \
|
|
touch $@
|
|
|
|
quiet_cmd_remove = REMOVE $(unwanted)
|
|
cmd_remove = rm -f $(unwanted-file)
|
|
|
|
quiet_cmd_check = CHECK $(printdir) ($(words $(all-files)) files)
|
|
# Headers list can be pretty long, xargs helps to avoid
|
|
# the "Argument list too long" error.
|
|
cmd_check = for f in $(all-files); do \
|
|
echo "$(installdir)/$${f}"; done \
|
|
| xargs \
|
|
$(PERL) $< $(INSTALL_HDR_PATH)/include $(SRCARCH); \
|
|
touch $@
|
|
|
|
PHONY += __headersinst __headerscheck
|
|
|
|
ifndef HDRCHECK
|
|
# Rules for installing headers
|
|
__headersinst: $(subdirs) $(install-file)
|
|
@:
|
|
|
|
targets += $(install-file)
|
|
$(install-file): scripts/headers_install.pl $(input-files) FORCE
|
|
$(if $(unwanted),$(call cmd,remove),)
|
|
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
|
|
$(call if_changed,install)
|
|
|
|
else
|
|
__headerscheck: $(subdirs) $(check-file)
|
|
@:
|
|
|
|
targets += $(check-file)
|
|
$(check-file): scripts/headers_check.pl $(output-files) FORCE
|
|
$(call if_changed,check)
|
|
|
|
endif
|
|
|
|
# Recursion
|
|
hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
|
|
.PHONY: $(subdirs)
|
|
$(subdirs):
|
|
$(Q)$(MAKE) $(hdr-inst)=$(obj)/$@ dst=$(_dst)/$@
|
|
|
|
targets := $(wildcard $(sort $(targets)))
|
|
cmd_files := $(wildcard \
|
|
$(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
|
|
|
|
ifneq ($(cmd_files),)
|
|
include $(cmd_files)
|
|
endif
|
|
|
|
.PHONY: $(PHONY)
|
|
PHONY += FORCE
|
|
FORCE: ;
|