6 TILE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(TILE_DIRS)) -name "*.svg")
7 TILE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(TILE_SVGS))
12 BTILE_SRC=$(shell find $(patsubst %, $(VPATH)/bitmap/%, $(BTILE_DIRS)) -name "*.png")
13 BTILE_PNGS=$(patsubst $(VPATH)/bitmap/%, %, $(BTILE_SRC))
15 # Vector images to rasterize without resizing
17 SIMPLE_DIRS=roach_management
18 SIMPLE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(SIMPLE_DIRS)) -name "*.svg")
19 SIMPLE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(SIMPLE_SVGS))
21 # Aggregate cockroach sprites
23 ROACH=$(filter roach/%, $(TILE_PNGS))
24 ROACH_32=$(patsubst roach/%, roach_32/%, $(ROACH))
25 ROACH_21=$(patsubst roach/%, roach_21/%, $(ROACH))
26 ROACH_QUARTET=$(patsubst roach/%, roach_quartet/%, $(ROACH))
27 ROACH_NONET=$(patsubst roach/%, roach_nonet/%, $(ROACH))
29 # Default target with everything
31 all: $(TILE_PNGS) $(BTILE_PNGS) $(SIMPLE_PNGS)\
32 $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET)
37 $(1)/%.png: vector/$(1)/%.svg
38 @mkdir -p `dirname $$@`
39 @inkscape -z -e $$@ -w 64 -h 64 $$<
42 $(foreach tiledir,$(TILE_DIRS),$(eval $(call tile,$(tiledir))))
47 $(1)/%.png: vector/$(1)/%.svg
48 @mkdir -p `dirname $$@`
49 @inkscape -z -e $$@ $$<
52 $(foreach simpledir,$(SIMPLE_DIRS),$(eval $(call simple,$(simpledir))))
57 $(1)/%.png: bitmap/$(1)/%.png
58 @mkdir -p `dirname $$@`
59 @convert $$< -resize 64x64 $$@
62 $(foreach tiledir,$(BTILE_DIRS),$(eval $(call btile,$(tiledir))))
66 roach_32/%.png: vector/roach/%.svg
67 @mkdir -p `dirname $@`
68 @inkscape -z -e $@ -w 32 -h 32 $<
70 roach_21/%.png: vector/roach/%.svg
71 @mkdir -p `dirname $@`
72 @inkscape -z -e $@ -w 21 -h 21 $<
76 roach_quartet/roach_%.png: $(foreach i, 1 2 3 4, roach_32/roach_$(i).png)
77 @mkdir -p roach_quartet
78 @montage $(foreach i, -1 0 1 2 , roach_32/roach_$$(( ( $(i) + $(patsubst roach_quartet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@
80 roach_quartet/eyes_%.png: $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png)
81 @mkdir -p roach_quartet
82 @montage $(foreach i, -1 0 1 2 , roach_32/eyes_$$(( ( $(i) + $(patsubst roach_quartet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@
86 roach_nonet/roach_%.png: $(foreach i, 1 2 3 4, roach_21/roach_$(i).png)
88 @montage $(foreach i, -1 0 1 2 3 4 5 6 7 , roach_21/roach_$$(( ( $(i) + $(patsubst roach_nonet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none - | convert - -background none -gravity southeast -splice 1x1 $@
90 roach_nonet/eyes_%.png: $(foreach i, 1 2 3 4, roach_21/eyes_$(i).png)
92 @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 $@