Rules for building roach_management PNGs.
authorSimon Cross <hodgestar@gmail.com>
Wed, 2 Mar 2016 20:12:45 +0000 (22:12 +0200)
committerSimon Cross <hodgestar@gmail.com>
Wed, 2 Mar 2016 20:12:45 +0000 (22:12 +0200)
koperkapel/images/Makefile

index bef40594d429d73bd8fdfe40db79f2f71d8501da..5a74a33c1f1a0591112e8385fdf93a2be2d5beef 100644 (file)
@@ -4,13 +4,18 @@ TILE_DIRS=roach
 TILE_SVGS=$(shell find $(patsubst %, $(VPATH)/%, $(TILE_DIRS)) -name "*.svg")
 TILE_PNGS=$(patsubst $(VPATH)/%.svg, %.png, $(TILE_SVGS))
 
+SIMPLE_DIRS=roach_management
+SIMPLE_SVGS=$(shell find $(patsubst %, $(VPATH)/%, $(SIMPLE_DIRS)) -name "*.svg")
+SIMPLE_PNGS=$(patsubst $(VPATH)/%.svg, %.png, $(SIMPLE_SVGS))
+
 ROACH=$(filter roach/%, $(TILE_PNGS))
 ROACH_32=$(patsubst roach/%, roach_32/%, $(ROACH))
 ROACH_21=$(patsubst roach/%, roach_21/%, $(ROACH))
 ROACH_QUARTET=$(patsubst roach/%, roach_quartet/%, $(ROACH))
 ROACH_NONET=$(patsubst roach/%, roach_nonet/%, $(ROACH))
 
-all: $(TILE_PNGS) $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET)
+all: $(TILE_PNGS) $(SIMPLE_PNGS)\
+       $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET)
 
 # Tile rules
 
@@ -22,6 +27,16 @@ endef
 
 $(foreach tiledir,$(TILE_DIRS),$(eval $(call tile,$(tiledir))))
 
+# Simple rules
+
+define simple
+$(1)/%.png: $(1)/%.svg
+       @mkdir -p `dirname $$@`
+       @inkscape -z -e $$@ $$<
+endef
+
+$(foreach simpledir,$(SIMPLE_DIRS),$(eval $(call simple,$(simpledir))))
+
 # Smaller roaches
 
 roach_32/%.png: roach/%.svg
@@ -51,5 +66,3 @@ roach_nonet/roach_%.png: $(foreach i, 1 2 3 4, roach_21/roach_$(i).png)
 roach_nonet/eyes_%.png: $(foreach i, 1 2 3 4, roach_21/eyes_$(i).png)
        @mkdir -p roach_nonet
        @montage $(foreach i, -1 0 1 2 3 4 5 6 7 , roach_21/eyes_$$(( ( $(i) + $(patsubst roach_nonet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 $@
-
-