]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | # SPDX-License-Identifier: GPL-2.0 |
d8ecc5cd SR |
2 | # include/asm-generic contains a lot of files that are used |
3 | # verbatim by several architectures. | |
4 | # | |
64236e31 | 5 | # This Makefile reads the file arch/$(SRCARCH)/include/$(src)/Kbuild |
d8ecc5cd | 6 | # and for each file listed in this file with generic-y creates |
64236e31 | 7 | # a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/$(src)) |
d8ecc5cd | 8 | |
a7d34df3 MY |
9 | PHONY := all |
10 | all: | |
11 | ||
3c5994c8 | 12 | kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild |
7a04fc94 | 13 | -include $(kbuild-file) |
d8ecc5cd SR |
14 | |
15 | include scripts/Kbuild.include | |
16 | ||
17 | # Create output directory if not already present | |
18 | _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) | |
19 | ||
cda2c65f JH |
20 | # Stale wrappers when the corresponding files are removed from generic-y |
21 | # need removing. | |
ae3f4151 | 22 | generated-y := $(generic-y) $(generated-y) |
cda2c65f JH |
23 | all-files := $(patsubst %, $(obj)/%, $(generated-y)) |
24 | old-headers := $(wildcard $(obj)/*.h) | |
25 | unwanted := $(filter-out $(all-files),$(old-headers)) | |
26 | ||
d8ecc5cd SR |
27 | quiet_cmd_wrap = WRAP $@ |
28 | cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@ | |
29 | ||
cda2c65f JH |
30 | quiet_cmd_remove = REMOVE $(unwanted) |
31 | cmd_remove = rm -f $(unwanted) | |
32 | ||
33 | all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE | |
34 | $(if $(unwanted),$(call cmd,remove),) | |
181e9763 | 35 | @: |
d8ecc5cd SR |
36 | |
37 | $(obj)/%.h: | |
38 | $(call cmd,wrap) | |
cda2c65f JH |
39 | |
40 | PHONY += FORCE | |
41 | .PHONY: $(PHONY) | |
42 | FORCE: ; |