Linux Audio

Check our new training course

Embedded Linux training

Mar 10-20, 2025, special US time zones
Register
Loading...
v6.9.4
 1# SPDX-License-Identifier: GPL-2.0
 2# include/asm-generic contains a lot of files that are used
 3# verbatim by several architectures.
 4#
 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.
 8
 9PHONY := all
10all:
11
12src := $(subst /generated,,$(obj))
13
14include $(srctree)/scripts/Kbuild.include
15-include $(kbuild-file)
16
17# $(generic)/Kbuild lists mandatory-y. Exclude um since it is a special case.
18ifneq ($(SRCARCH),um)
19include $(srctree)/$(generic)/Kbuild
20endif
21
22redundant := $(filter $(mandatory-y) $(generated-y), $(generic-y))
23redundant += $(foreach f, $(generic-y), $(if $(wildcard $(srctree)/$(src)/$(f)),$(f)))
24redundant := $(sort $(redundant))
25$(if $(redundant),\
26	$(warning redundant generic-y found in $(src)/Kbuild: $(redundant)))
27
28# If arch does not implement mandatory headers, fallback to asm-generic ones.
29mandatory-y := $(filter-out $(generated-y), $(mandatory-y))
30generic-y   += $(foreach f, $(mandatory-y), $(if $(wildcard $(srctree)/$(src)/$(f)),,$(f)))
31
32generic-y   := $(addprefix $(obj)/, $(generic-y))
33generated-y := $(addprefix $(obj)/, $(generated-y))
34
35# Remove stale wrappers when the corresponding files are removed from generic-y
36old-headers := $(wildcard $(obj)/*.h)
37unwanted    := $(filter-out $(generic-y) $(generated-y),$(old-headers))
38
39quiet_cmd_wrap = WRAP    $@
40      cmd_wrap = echo "\#include <asm-generic/$*.h>" > $@
41
42quiet_cmd_remove = REMOVE  $(unwanted)
43      cmd_remove = rm -f $(unwanted)
44
45all: $(generic-y)
46	$(if $(unwanted),$(call cmd,remove))
47	@:
48
49$(obj)/%.h:
50	$(call cmd,wrap)
51
52# Create output directory. Skip it if at least one old header exists
53# since we know the output directory already exists.
54ifeq ($(old-headers),)
55$(shell mkdir -p $(obj))
56endif
57
58.PHONY: $(PHONY)
v4.17
 1# SPDX-License-Identifier: GPL-2.0
 2# include/asm-generic contains a lot of files that are used
 3# verbatim by several architectures.
 4#
 5# This Makefile reads the file arch/$(SRCARCH)/include/$(src)/Kbuild
 6# and for each file listed in this file with generic-y creates
 7# a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src))
 8
 9PHONY := all
10all:
11
12kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
 
 
13-include $(kbuild-file)
14
15include scripts/Kbuild.include
16
17# Create output directory if not already present
18_dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
19
20# Stale wrappers when the corresponding files are removed from generic-y
21# need removing.
22generated-y   := $(generic-y) $(generated-y)
23all-files     := $(patsubst %, $(obj)/%, $(generated-y))
24old-headers   := $(wildcard $(obj)/*.h)
25unwanted      := $(filter-out $(all-files),$(old-headers))
 
 
 
 
 
 
 
 
 
 
26
27quiet_cmd_wrap = WRAP    $@
28cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@
29
30quiet_cmd_remove = REMOVE  $(unwanted)
31cmd_remove = rm -f $(unwanted)
32
33all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE
34	$(if $(unwanted),$(call cmd,remove),)
35	@:
36
37$(obj)/%.h:
38	$(call cmd,wrap)
39
40PHONY += FORCE
 
 
 
 
 
41.PHONY: $(PHONY)
42FORCE: ;