ASCII-Pony/Makefile

57 lines
1.4 KiB
Makefile
Raw Normal View History

2013-11-08 17:07:35 +01:00
PONIES= Main6/applejack-nohat \
Main6/fluttershy \
Main6/pinkie-pie \
Main6/rainbow-dash \
Main6/rarity \
Main6/twilight-alicorn \
Main6/twilight-unicorn \
Other/derpy \
Other/trixie-hat
SCRIPT=$(PWD)/render_parts.php
2013-11-08 22:28:04 +01:00
OUT_DIR=rendered
OUT_PLAIN=$(addsuffix .txt,$(PONIES))
OUT_COLOR=$(addprefix $(OUT_DIR)/,$(addsuffix .colored.txt,$(PONIES)))
OUT_SVG=$(addprefix $(OUT_DIR)/,$(addsuffix .svg,$(PONIES)))
OUT_PNG=$(addprefix $(OUT_DIR)/,$(addsuffix .png,$(PONIES)))
2013-11-08 19:48:53 +01:00
OUT_ALL= $(OUT_COLOR) $(OUT_PLAIN) $(OUT_SVG) $(OUT_PNG)
2013-11-08 22:28:04 +01:00
OUT_DIRS=$(sort $(dir $(OUT_ALL)))
2013-11-08 18:42:21 +01:00
find_deps=$(subst ;,\\\;,$(wildcard $(1)/*))
2013-11-08 17:36:09 +01:00
2013-11-08 19:48:53 +01:00
all: $(OUT_ALL)
2013-11-08 17:07:35 +01:00
2013-11-08 18:42:21 +01:00
define rule_template
2013-11-08 22:28:04 +01:00
$(OUT_DIR)/$(1).colored.txt: $(dir $(OUT_DIR)/$(1))
$(OUT_DIR)/$(1).colored.txt: $(call find_deps, $(1))
$(SCRIPT) $(1) >$(OUT_DIR)/$(1).colored.txt
2013-11-08 17:07:35 +01:00
2013-11-08 22:28:04 +01:00
$(1).txt: $(call find_deps, $(1))
$(SCRIPT) $(1) >$(1).txt nocolor
2013-11-08 19:48:53 +01:00
2013-11-08 22:28:04 +01:00
$(OUT_DIR)/$(1).svg: $(dir $(OUT_DIR)/$(1))
$(OUT_DIR)/$(1).svg: $(call find_deps, $(1))
$(SCRIPT) $(1) >$(OUT_DIR)/$(1).svg svg
endef
define dir_rule_template
$(1) :
mkdir -p $(1)
2013-11-08 18:42:21 +01:00
endef
2013-11-08 17:07:35 +01:00
2013-11-08 19:48:53 +01:00
%.png : %.svg
inkscape $*.svg -e $*.png
2013-11-08 18:42:21 +01:00
$(foreach pony,$(PONIES),$(eval $(call rule_template,$(pony))))
2013-11-08 22:28:04 +01:00
$(foreach directory,$(OUT_DIRS),$(eval $(call dir_rule_template,$(directory))))
2013-11-08 17:36:09 +01:00
show: $(PONY).colored.txt
2013-11-08 18:42:21 +01:00
@cat $(PONY).colored.txt
show_deps:
2013-11-08 22:28:04 +01:00
@$(foreach d,$(call find_deps,$(PONY)), echo $(d);)
clean:
rm -f $(OUT_ALL)
rmdir --ignore-fail-on-non-empty $(OUT_DIRS) $(OUT_DIR)