copy.mak 741 B

1234567891011121314151617181920212223242526272829303132
  1. # -*- make -*-
  2. # This installs arbitrary files into a directory
  3. # Input
  4. # $(SOURCE) - The documents to use
  5. # $(TO) - The directory to put them in
  6. # $(TARGET) - The global target to add the local target as a dependency
  7. # to.
  8. # All output is writtin to files in the build/$(TO) directory
  9. # See defaults.mak for information about LOCAL
  10. # Some local definitions
  11. LOCAL := copy-$(firstword $(SOURCE))
  12. $(LOCAL)-LIST := $(addprefix $(TO)/,$(SOURCE))
  13. # Install generation hooks
  14. $(TARGET): $($(LOCAL)-LIST)
  15. veryclean: veryclean/$(LOCAL)
  16. MKDIRS += $(dir $($(LOCAL)-LIST))
  17. $($(LOCAL)-LIST) : $(TO)/% : %
  18. echo Installing $< to $(@D)
  19. cp $< $(@D)
  20. # Clean rule
  21. .PHONY: veryclean/$(LOCAL)
  22. veryclean/$(LOCAL):
  23. -rm -rf $($(@F)-LIST)