2013-11-09 08:58:29 +01:00
|
|
|
PONIES= applejack-nohat \
|
|
|
|
fluttershy \
|
|
|
|
pinkie-pie \
|
|
|
|
rainbow-dash \
|
|
|
|
rarity \
|
|
|
|
twilight-alicorn \
|
|
|
|
twilight-unicorn \
|
|
|
|
derpy \
|
2013-11-09 10:23:42 +01:00
|
|
|
trixie-hat \
|
2013-11-09 10:52:49 +01:00
|
|
|
rose \
|
|
|
|
lyra
|
2013-11-09 08:58:29 +01:00
|
|
|
|
2013-11-12 16:02:03 +01:00
|
|
|
MAKEFILE=$(lastword $(MAKEFILE_LIST))
|
|
|
|
MAKEFILE_DIR=$(dir $(MAKEFILE))
|
2013-11-09 08:58:29 +01:00
|
|
|
PONY_DIR=$(MAKEFILE_DIR)Ponies
|
|
|
|
SCRIPT=$(MAKEFILE_DIR)render_parts.php
|
|
|
|
OUT_DIR=$(MAKEFILE_DIR)rendered
|
|
|
|
OUT_PLAIN=$(addprefix $(PONY_DIR)/,$(addsuffix .txt,$(PONIES)))
|
2013-11-08 22:28:04 +01:00
|
|
|
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-09 08:58:29 +01:00
|
|
|
OUT_BASH=$(addprefix $(OUT_DIR)/,$(addsuffix .sh,$(PONIES)))
|
|
|
|
OUT_ALL= $(OUT_COLOR) $(OUT_PLAIN) $(OUT_SVG) $(OUT_PNG) $(OUT_BASH)
|
2013-11-08 22:28:04 +01:00
|
|
|
OUT_DIRS=$(sort $(dir $(OUT_ALL)))
|
2013-11-09 08:58:29 +01:00
|
|
|
find_deps=$(addprefix $(PONY_DIR)/,$(subst ;,\\\;,$(wildcard $(1)/*)))
|
2013-11-08 17:36:09 +01:00
|
|
|
|
2013-11-12 16:02:03 +01:00
|
|
|
.PHONY: show show_deps cleans list random
|
2013-11-09 10:23:42 +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-09 08:58:29 +01:00
|
|
|
$(OUT_DIR)/$(1).colored.txt: | $(dir $(OUT_DIR)/$(1))
|
2013-11-08 22:28:04 +01:00
|
|
|
$(OUT_DIR)/$(1).colored.txt: $(call find_deps, $(1))
|
2013-11-09 10:23:42 +01:00
|
|
|
$(OUT_DIR)/$(1).colored.txt: $(PONY_DIR)/$(1)
|
2013-11-09 08:58:29 +01:00
|
|
|
$(SCRIPT) $(PONY_DIR)/$(1) >$(OUT_DIR)/$(1).colored.txt
|
2013-11-08 17:07:35 +01:00
|
|
|
|
2013-11-09 08:58:29 +01:00
|
|
|
$(PONY_DIR)/$(1).txt: $(call find_deps, $(1))
|
2013-11-09 10:23:42 +01:00
|
|
|
$(PONY_DIR)/$(1).txt: $(PONY_DIR)/$(1)
|
2013-11-09 08:58:29 +01:00
|
|
|
$(SCRIPT) $(PONY_DIR)/$(1) >$(PONY_DIR)/$(1).txt nocolor
|
2013-11-08 19:48:53 +01:00
|
|
|
|
2013-11-09 08:58:29 +01:00
|
|
|
$(OUT_DIR)/$(1).svg: | $(dir $(OUT_DIR)/$(1))
|
2013-11-08 22:28:04 +01:00
|
|
|
$(OUT_DIR)/$(1).svg: $(call find_deps, $(1))
|
2013-11-09 10:23:42 +01:00
|
|
|
$(OUT_DIR)/$(1).svg: $(PONY_DIR)/$(1)
|
2013-11-09 08:58:29 +01:00
|
|
|
$(SCRIPT) $(PONY_DIR)/$(1) >$(OUT_DIR)/$(1).svg svg
|
|
|
|
|
|
|
|
$(OUT_DIR)/$(1).sh: | $(dir $(OUT_DIR)/$(1))
|
|
|
|
$(OUT_DIR)/$(1).sh: $(call find_deps, $(1))
|
2013-11-09 10:23:42 +01:00
|
|
|
$(OUT_DIR)/$(1).sh: $(PONY_DIR)/$(1)
|
2013-11-09 08:58:29 +01:00
|
|
|
$(SCRIPT) $(PONY_DIR)/$(1) >$(OUT_DIR)/$(1).sh bash
|
|
|
|
chmod a+x $(OUT_DIR)/$(1).sh
|
2013-11-08 22:28:04 +01:00
|
|
|
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
|
|
|
|
2013-11-09 08:58:29 +01:00
|
|
|
show: $(OUT_DIR)/$(PONY).colored.txt
|
|
|
|
@cat $(OUT_DIR)/$(PONY).colored.txt
|
2013-11-08 18:42:21 +01:00
|
|
|
|
|
|
|
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)
|
2013-11-12 16:02:03 +01:00
|
|
|
|
|
|
|
list:
|
|
|
|
@$(foreach pony,$(PONIES), echo $(pony);)
|
|
|
|
|
|
|
|
random: PONY=$(shell make -f $(MAKEFILE) list | shuf | head -n 1)
|
|
|
|
random:
|
|
|
|
@make -f $(MAKEFILE) show PONY=$(PONY)
|
|
|
|
|