diff --git a/Main6/applejack-nohat.plain.txt b/Main6/applejack-nohat.txt similarity index 100% rename from Main6/applejack-nohat.plain.txt rename to Main6/applejack-nohat.txt diff --git a/Main6/fluttershy.plain.txt b/Main6/fluttershy.txt similarity index 100% rename from Main6/fluttershy.plain.txt rename to Main6/fluttershy.txt diff --git a/Main6/pinkie-pie.plain.txt b/Main6/pinkie-pie.txt similarity index 100% rename from Main6/pinkie-pie.plain.txt rename to Main6/pinkie-pie.txt diff --git a/Main6/rainbow-dash.plain.txt b/Main6/rainbow-dash.txt similarity index 100% rename from Main6/rainbow-dash.plain.txt rename to Main6/rainbow-dash.txt diff --git a/Main6/rarity.plain.txt b/Main6/rarity.txt similarity index 100% rename from Main6/rarity.plain.txt rename to Main6/rarity.txt diff --git a/Main6/twilight-alicorn.plain.txt b/Main6/twilight-alicorn.txt similarity index 100% rename from Main6/twilight-alicorn.plain.txt rename to Main6/twilight-alicorn.txt diff --git a/Main6/twilight-unicorn.plain.txt b/Main6/twilight-unicorn.txt similarity index 100% rename from Main6/twilight-unicorn.plain.txt rename to Main6/twilight-unicorn.txt diff --git a/Makefile b/Makefile index fe5d6f1..59012db 100644 --- a/Makefile +++ b/Makefile @@ -11,33 +11,46 @@ PONIES= Main6/applejack-nohat \ SCRIPT=$(PWD)/render_parts.php -OUT_PLAIN=$(addsuffix .plain.txt,$(PONIES)) -OUT_COLOR=$(addsuffix .colored.txt,$(PONIES)) -OUT_SVG=$(addsuffix .svg,$(PONIES)) -OUT_PNG=$(addsuffix .png,$(PONIES)) +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))) OUT_ALL= $(OUT_COLOR) $(OUT_PLAIN) $(OUT_SVG) $(OUT_PNG) +OUT_DIRS=$(sort $(dir $(OUT_ALL))) find_deps=$(subst ;,\\\;,$(wildcard $(1)/*)) all: $(OUT_ALL) define rule_template -$(1).colored.txt: $(call find_deps, $(1)) - $(SCRIPT) $(1) >$(1).colored.txt +$(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 -$(1).plain.txt: $(call find_deps, $(1)) - $(SCRIPT) $(1) >$(1).plain.txt nocolor +$(1).txt: $(call find_deps, $(1)) + $(SCRIPT) $(1) >$(1).txt nocolor -$(1).svg: $(call find_deps, $(1)) - $(SCRIPT) $(1) >$(1).svg svg +$(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) endef %.png : %.svg inkscape $*.svg -e $*.png $(foreach pony,$(PONIES),$(eval $(call rule_template,$(pony)))) +$(foreach directory,$(OUT_DIRS),$(eval $(call dir_rule_template,$(directory)))) show: $(PONY).colored.txt @cat $(PONY).colored.txt show_deps: - @$(foreach d,$(call find_deps,$(PONY)), echo $(d);) \ No newline at end of file + @$(foreach d,$(call find_deps,$(PONY)), echo $(d);) + +clean: + rm -f $(OUT_ALL) + rmdir --ignore-fail-on-non-empty $(OUT_DIRS) $(OUT_DIR) diff --git a/Other/derpy.plain.txt b/Other/derpy.txt similarity index 100% rename from Other/derpy.plain.txt rename to Other/derpy.txt diff --git a/Other/trixie-hat.plain.txt b/Other/trixie-hat.txt similarity index 100% rename from Other/trixie-hat.plain.txt rename to Other/trixie-hat.txt diff --git a/Main6/applejack-nohat.colored.txt b/rendered/Main6/applejack-nohat.colored.txt similarity index 100% rename from Main6/applejack-nohat.colored.txt rename to rendered/Main6/applejack-nohat.colored.txt diff --git a/Main6/applejack-nohat.png b/rendered/Main6/applejack-nohat.png similarity index 100% rename from Main6/applejack-nohat.png rename to rendered/Main6/applejack-nohat.png diff --git a/Main6/applejack-nohat.svg b/rendered/Main6/applejack-nohat.svg similarity index 100% rename from Main6/applejack-nohat.svg rename to rendered/Main6/applejack-nohat.svg diff --git a/Main6/fluttershy.colored.txt b/rendered/Main6/fluttershy.colored.txt similarity index 100% rename from Main6/fluttershy.colored.txt rename to rendered/Main6/fluttershy.colored.txt diff --git a/Main6/fluttershy.png b/rendered/Main6/fluttershy.png similarity index 100% rename from Main6/fluttershy.png rename to rendered/Main6/fluttershy.png diff --git a/Main6/fluttershy.svg b/rendered/Main6/fluttershy.svg similarity index 100% rename from Main6/fluttershy.svg rename to rendered/Main6/fluttershy.svg diff --git a/Main6/pinkie-pie.colored.txt b/rendered/Main6/pinkie-pie.colored.txt similarity index 100% rename from Main6/pinkie-pie.colored.txt rename to rendered/Main6/pinkie-pie.colored.txt diff --git a/Main6/pinkie-pie.png b/rendered/Main6/pinkie-pie.png similarity index 100% rename from Main6/pinkie-pie.png rename to rendered/Main6/pinkie-pie.png diff --git a/Main6/pinkie-pie.svg b/rendered/Main6/pinkie-pie.svg similarity index 100% rename from Main6/pinkie-pie.svg rename to rendered/Main6/pinkie-pie.svg diff --git a/Main6/rainbow-dash.colored.txt b/rendered/Main6/rainbow-dash.colored.txt similarity index 100% rename from Main6/rainbow-dash.colored.txt rename to rendered/Main6/rainbow-dash.colored.txt diff --git a/Main6/rainbow-dash.png b/rendered/Main6/rainbow-dash.png similarity index 100% rename from Main6/rainbow-dash.png rename to rendered/Main6/rainbow-dash.png diff --git a/Main6/rainbow-dash.svg b/rendered/Main6/rainbow-dash.svg similarity index 100% rename from Main6/rainbow-dash.svg rename to rendered/Main6/rainbow-dash.svg diff --git a/Main6/rarity.colored.txt b/rendered/Main6/rarity.colored.txt similarity index 100% rename from Main6/rarity.colored.txt rename to rendered/Main6/rarity.colored.txt diff --git a/Main6/rarity.png b/rendered/Main6/rarity.png similarity index 100% rename from Main6/rarity.png rename to rendered/Main6/rarity.png diff --git a/Main6/rarity.svg b/rendered/Main6/rarity.svg similarity index 100% rename from Main6/rarity.svg rename to rendered/Main6/rarity.svg diff --git a/Main6/twilight-alicorn.colored.txt b/rendered/Main6/twilight-alicorn.colored.txt similarity index 100% rename from Main6/twilight-alicorn.colored.txt rename to rendered/Main6/twilight-alicorn.colored.txt diff --git a/Main6/twilight-alicorn.png b/rendered/Main6/twilight-alicorn.png similarity index 100% rename from Main6/twilight-alicorn.png rename to rendered/Main6/twilight-alicorn.png diff --git a/Main6/twilight-alicorn.svg b/rendered/Main6/twilight-alicorn.svg similarity index 100% rename from Main6/twilight-alicorn.svg rename to rendered/Main6/twilight-alicorn.svg diff --git a/Main6/twilight-unicorn.colored.txt b/rendered/Main6/twilight-unicorn.colored.txt similarity index 100% rename from Main6/twilight-unicorn.colored.txt rename to rendered/Main6/twilight-unicorn.colored.txt diff --git a/Main6/twilight-unicorn.png b/rendered/Main6/twilight-unicorn.png similarity index 100% rename from Main6/twilight-unicorn.png rename to rendered/Main6/twilight-unicorn.png diff --git a/Main6/twilight-unicorn.svg b/rendered/Main6/twilight-unicorn.svg similarity index 100% rename from Main6/twilight-unicorn.svg rename to rendered/Main6/twilight-unicorn.svg diff --git a/Other/derpy.colored.txt b/rendered/Other/derpy.colored.txt similarity index 100% rename from Other/derpy.colored.txt rename to rendered/Other/derpy.colored.txt diff --git a/Other/derpy.png b/rendered/Other/derpy.png similarity index 100% rename from Other/derpy.png rename to rendered/Other/derpy.png diff --git a/Other/derpy.svg b/rendered/Other/derpy.svg similarity index 100% rename from Other/derpy.svg rename to rendered/Other/derpy.svg diff --git a/Other/trixie-hat.colored.txt b/rendered/Other/trixie-hat.colored.txt similarity index 100% rename from Other/trixie-hat.colored.txt rename to rendered/Other/trixie-hat.colored.txt diff --git a/Other/trixie-hat.png b/rendered/Other/trixie-hat.png similarity index 100% rename from Other/trixie-hat.png rename to rendered/Other/trixie-hat.png diff --git a/Other/trixie-hat.svg b/rendered/Other/trixie-hat.svg similarity index 100% rename from Other/trixie-hat.svg rename to rendered/Other/trixie-hat.svg