Makefile.asm-generic 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # include/asm-generic contains a lot of files that are used
  2. # verbatim by several architectures.
  3. #
  4. # This Makefile reads the file arch/$(SRCARCH)/include/asm/Kbuild
  5. # and for each file listed in this file with generic-y creates
  6. # a small wrapper file in $(obj) (arch/$(SRCARCH)/include/generated/asm)
  7. kbuild-file := $(srctree)/arch/$(SRCARCH)/include/$(src)/Kbuild
  8. -include $(kbuild-file)
  9. include scripts/Kbuild.include
  10. # Create output directory if not already present
  11. _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
  12. # Stale wrappers when the corresponding files are removed from generic-y
  13. # need removing.
  14. generated-y := $(generic-y) $(genhdr-y) $(generated-y)
  15. all-files := $(patsubst %, $(obj)/%, $(generated-y))
  16. old-headers := $(wildcard $(obj)/*.h)
  17. unwanted := $(filter-out $(all-files),$(old-headers))
  18. quiet_cmd_wrap = WRAP $@
  19. cmd_wrap = echo "\#include <asm-generic/$*.h>" >$@
  20. quiet_cmd_remove = REMOVE $(unwanted)
  21. cmd_remove = rm -f $(unwanted)
  22. all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE
  23. $(if $(unwanted),$(call cmd,remove),)
  24. @:
  25. $(obj)/%.h:
  26. $(call cmd,wrap)
  27. PHONY += FORCE
  28. .PHONY: $(PHONY)
  29. FORCE: ;