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