6 TILE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(TILE_DIRS)) -name "*.svg")
7 TILE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(TILE_SVGS))
11 BTILE_DIRS=wall floor tunnel underground
12 BTILE_SRC=$(shell find $(patsubst %, $(VPATH)/bitmap/%, $(BTILE_DIRS)) -name "*.png")
13 BTILE_PNGS=$(patsubst $(VPATH)/bitmap/%, bunker/%, $(BTILE_SRC))
15 # Vector images to rasterize without resizing
17 SIMPLE_DIRS=roach_management vehicles
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))
28 ROACH_BIG=$(patsubst roach/%, roach_big/%, $(ROACH))
30 # Default target with everything
32 all: $(TILE_PNGS) $(BTILE_PNGS) $(SIMPLE_PNGS)\
33 $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET) $(ROACH_BIG)
38 $(1)/%.png: vector/$(1)/%.svg
39 @mkdir -p `dirname $$@`
40 @inkscape -z -e $$@ -w 64 -h 64 $$<
43 $(foreach tiledir,$(TILE_DIRS),$(eval $(call tile,$(tiledir))))
48 $(1)/%.png: vector/$(1)/%.svg
49 @mkdir -p `dirname $$@`
50 @inkscape -z -e $$@ $$<
53 $(foreach simpledir,$(SIMPLE_DIRS),$(eval $(call simple,$(simpledir))))
58 bunker/$(1)/%.png: bitmap/$(1)/%.png
59 @mkdir -p `dirname $$@`
60 @convert $$< -resize 64x64 $$@
63 $(foreach tiledir,$(BTILE_DIRS),$(eval $(call btile,$(tiledir))))
67 roach_32/%.png: vector/roach/%.svg
68 @mkdir -p `dirname $@`
69 @inkscape -z -e $@ -w 32 -h 32 $<
71 roach_21/%.png: vector/roach/%.svg
72 @mkdir -p `dirname $@`
73 @inkscape -z -e $@ -w 21 -h 21 $<
77 roach_big/%.png: vector/roach/%.svg
78 @mkdir -p `dirname $@`
79 @inkscape -z -e $@ -w 192 -h 192 $<
83 roach_quartet/roach_%.png: $(foreach i, 1 2 3 4, roach_32/roach_$(i).png)
84 @mkdir -p roach_quartet
85 @montage $(foreach i, -1 0 1 2 , roach_32/roach_$$(( ( $(i) + $(patsubst roach_quartet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@
87 roach_quartet/eyes_%.png: $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png)
88 @mkdir -p roach_quartet
89 @montage $(foreach i, -1 0 1 2 , roach_32/eyes_$$(( ( $(i) + $(patsubst roach_quartet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@
93 roach_nonet/roach_%.png: $(foreach i, 1 2 3 4, roach_21/roach_$(i).png)
95 @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 $@
97 roach_nonet/eyes_%.png: $(foreach i, 1 2 3 4, roach_21/eyes_$(i).png)
99 @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 $@