VPATH=../../sources # Vector tiles TILE_DIRS=roach serum vehicle_tiles fixtures weapons rat TILE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(TILE_DIRS)) -name "*.svg") TILE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(TILE_SVGS)) # Bitmap tiles BTILE_DIRS=wall floor tunnel underground grate BTILE_SRC=$(shell find $(patsubst %, $(VPATH)/bitmap/%, $(BTILE_DIRS)) -name "*.png") BTILE_PNGS=$(patsubst $(VPATH)/bitmap/%, bunker/%, $(BTILE_SRC)) # Vector images to rasterize without resizing SIMPLE_DIRS=roach_management vehicles splash SIMPLE_SVGS=$(shell find $(patsubst %, $(VPATH)/vector/%, $(SIMPLE_DIRS)) -name "*.svg") SIMPLE_PNGS=$(patsubst $(VPATH)/vector/%.svg, %.png, $(SIMPLE_SVGS)) # Aggregate cockroach sprites 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)) ROACH_BIG=$(patsubst roach/%, roach_big/%, $(ROACH)) # Aggregate serum sprites SERUM=$(filter serum/%, $(TILE_PNGS)) SERUM_BIG=$(patsubst serum/%, serum_big/%, $(SERUM)) # Big vehicles VEHICLE=$(filter vehicle_tiles/%_1.png, $(TILE_PNGS)) VEHICLE_BIG=$(patsubst vehicle_tiles/%, vehicle_big/%, $(VEHICLE)) # Default target with everything all: $(TILE_PNGS) $(BTILE_PNGS) $(SIMPLE_PNGS)\ $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET) $(ROACH_BIG)\ $(SERUM_BIG) $(VEHICLE_BIG) # Vector tile rule define tile $(1)/%.png: vector/$(1)/%.svg @mkdir -p `dirname $$@` @inkscape -z -e $$@ -w 64 -h 64 $$< endef $(foreach tiledir,$(TILE_DIRS),$(eval $(call tile,$(tiledir)))) # No resize rule define simple $(1)/%.png: vector/$(1)/%.svg @mkdir -p `dirname $$@` @inkscape -z -e $$@ $$< endef $(foreach simpledir,$(SIMPLE_DIRS),$(eval $(call simple,$(simpledir)))) # Bitmap tile rule define btile bunker/$(1)/%.png: bitmap/$(1)/%.png @mkdir -p `dirname $$@` @convert $$< -resize 64x64 $$@ endef $(foreach tiledir,$(BTILE_DIRS),$(eval $(call btile,$(tiledir)))) # Smaller roaches roach_32/%.png: vector/roach/%.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 32 -h 32 $< roach_21/%.png: vector/roach/%.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 21 -h 21 $< # Big roaches roach_big/%.png: vector/roach/%.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 192 -h 192 $< # Big serums serum_big/%.png: vector/serum/%.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 192 -h 192 $< # Big vehicles vehicle_big/%_1.png: vector/vehicle_tiles/%_1.svg @mkdir -p `dirname $@` @inkscape -z -e $@ -w 576 -h 576 $< # Roach quartet roach_quartet/roach_%.png: $(foreach i, 1 2 3 4, roach_32/roach_$(i).png) @mkdir -p roach_quartet @montage $(foreach i, -1 0 1 2 , roach_32/roach_$$(( ( $(i) + $(patsubst roach_quartet/roach_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@ roach_quartet/eyes_%.png: $(foreach i, 1 2 3 4, roach_32/eyes_$(i).png) @mkdir -p roach_quartet @montage $(foreach i, -1 0 1 2 , roach_32/eyes_$$(( ( $(i) + $(patsubst roach_quartet/eyes_%.png,%, $@) ) % 4 + 1 )).png) -geometry +0+0 -background none $@ # Roach nonet roach_nonet/roach_%.png: $(foreach i, 1 2 3 4, roach_21/roach_$(i).png) @mkdir -p roach_nonet @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 $@ 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 $@