-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (23 loc) · 1.01 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
mustache_cmd=mustach
SOURCES := $(shell find ./ -type f -name '*.mustache')
RESULTS := $(basename $(SOURCES))
INSTALLED :=$(shell echo $(RESULTS) | sed 's#\./#$(DESTDIR)/#g')
%: %.mustache
$(mustache_cmd) $(THEME) $^ > $@
.SECONDEXPANSION:
$(INSTALLED): $$(shell echo $$@ | sed "s\#$$(DESTDIR)\#./\#g" )# $$(shell echo $$@ | sed "s\#$$(DESTDIR)/[^/]*\#$$(DESTDIR)\#g" )
$(eval targetFile=$(shell echo $@ | sed 's!$(DESTDIR)/[^/]*!$(DESTDIR)!g') )
$(eval targetDir=$(shell dirname $(targetFile)))
mkdir -p $(targetDir)
cp $^ $(targetFile)
.PHONY: all
all: $(RESULTS)
$(info $(RESULTS))
.PHONY: install
install: $(INSTALLED)
$(info $(INSTALLED))
.PHONY: list
list:
@LC_ALL=C $(MAKE) -pRrq -f $(firstword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/(^|\n)# Files(\n|$$)/,/(^|\n)# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'
# IMPORTANT: The line above must be indented by (at least one)
# *actual TAB character* - *spaces* do *not* work.