5 TILE_DIRS=roach serum vehicle_tiles fixtures weapons
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 grate
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 # Aggregate serum sprites
32 SERUM=$(filter serum/%, $(TILE_PNGS))
33 SERUM_BIG=$(patsubst serum/%, serum_big/%, $(SERUM))
37 VEHICLE=$(filter vehicle_tiles/%_1.png, $(TILE_PNGS))
38 VEHICLE_BIG=$(patsubst vehicle_tiles/%, vehicle_big/%, $(VEHICLE))
40 # Default target with everything
42 all: $(TILE_PNGS) $(BTILE_PNGS) $(SIMPLE_PNGS)\
43 $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET) $(ROACH_BIG)\
44 $(SERUM_BIG) $(VEHICLE_BIG)
49 $(1)/%.png: vector/$(1)/%.svg
50 @mkdir -p `dirname $$@`
51 @inkscape -z -e $$@ -w 64 -h 64 $$<
54 $(foreach tiledir,$(TILE_DIRS),$(eval $(call tile,$(tiledir))))
59 $(1)/%.png: vector/$(1)/%.svg
60 @mkdir -p `dirname $$@`
61 @inkscape -z -e $$@ $$<
64 $(foreach simpledir,$(SIMPLE_DIRS),$(eval $(call simple,$(simpledir))))
69 bunker/$(1)/%.png: bitmap/$(1)/%.png
70 @mkdir -p `dirname $$@`
71 @convert $$< -resize 64x64 $$@
74 $(foreach tiledir,$(BTILE_DIRS),$(eval $(call btile,$(tiledir))))
78 roach_32/%.png: vector/roach/%.svg
79 @mkdir -p `dirname $@`
80 @inkscape -z -e $@ -w 32 -h 32 $<
82 roach_21/%.png: vector/roach/%.svg
83 @mkdir -p `dirname $@`
84 @inkscape -z -e $@ -w 21 -h 21 $<
88 roach_big/%.png: vector/roach/%.svg
89 @mkdir -p `dirname $@`
90 @inkscape -z -e $@ -w 192 -h 192 $<
94 serum_big/%.png: vector/serum/%.svg
95 @mkdir -p `dirname $@`
96 @inkscape -z -e $@ -w 192 -h 192 $<
100 vehicle_big/%_1.png: vector/vehicle_tiles/%_1.svg
101 @mkdir -p `dirname $@`
102 @inkscape -z -e $@ -w 576 -h 576 $<
106 roach_quartet/roach_%.png: $(foreach i, 1 2 3 4, roach_32/roach_$(i).png)
107 @mkdir -p roach_quartet
108 @montage $(foreach i, -1 0 1 2 , roach_32/roach_$$(( ( $(i) + $(patsubst roach_quartet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@
110 roach_quartet/eyes_%.png: $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png)
111 @mkdir -p roach_quartet
112 @montage $(foreach i, -1 0 1 2 , roach_32/eyes_$$(( ( $(i) + $(patsubst roach_quartet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@
116 roach_nonet/roach_%.png: $(foreach i, 1 2 3 4, roach_21/roach_$(i).png)
117 @mkdir -p roach_nonet
118 @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 $@
120 roach_nonet/eyes_%.png: $(foreach i, 1 2 3 4, roach_21/eyes_$(i).png)
121 @mkdir -p roach_nonet
122 @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 $@