mmc: core: Convert mmc_regulator_get_ocrmask() to static
[linux/fpc-iii.git] / scripts / Makefile.asm-generic
bloba62d2823f6cfe6ffe7f269131fd3f19f78f2516c
1 # SPDX-License-Identifier: GPL-2.0
2 # include/asm-generic contains a lot of files that are used
3 # verbatim by several architectures.
5 # This Makefile reads the file arch/$(SRCARCH)/include/(uapi/)/asm/Kbuild
6 # and for each file listed in this file with generic-y creates
7 # a small wrapper file in arch/$(SRCARCH)/include/generated/(uapi/)/asm.
9 PHONY := all
10 all:
12 src := $(subst /generated,,$(obj))
13 -include $(src)/Kbuild
15 include scripts/Kbuild.include
17 # If arch does not implement mandatory headers, fallback to asm-generic ones.
18 mandatory-y := $(filter-out $(generated-y), $(mandatory-y))
19 generic-y   += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f)))
21 generic-y   := $(addprefix $(obj)/, $(generic-y))
22 generated-y := $(addprefix $(obj)/, $(generated-y))
24 # Remove stale wrappers when the corresponding files are removed from generic-y
25 old-headers := $(wildcard $(obj)/*.h)
26 unwanted    := $(filter-out $(generic-y) $(generated-y),$(old-headers))
28 quiet_cmd_wrap = WRAP    $@
29       cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
31 quiet_cmd_remove = REMOVE  $(unwanted)
32       cmd_remove = rm -f $(unwanted)
34 all: $(generic-y)
35         $(if $(unwanted),$(call cmd,remove))
36         @:
38 $(obj)/%.h:
39         $(call cmd,wrap)
41 # Create output directory. Skip it if at least one old header exists
42 # since we know the output directory already exists.
43 ifeq ($(old-headers),)
44 $(shell mkdir -p $(obj))
45 endif
47 .PHONY: $(PHONY)