+# Vector images to rasterize without resizing
+
+SIMPLE_DIRS=roach_management vehicles
+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))
+
+# Default target with everything
+
+all: $(TILE_PNGS) $(BTILE_PNGS) $(SIMPLE_PNGS)\
+ $(ROACH_32) $(ROACH_21) $(ROACH_QUARTET) $(ROACH_NONET)
+
+# 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
+$(1)/%.png: bitmap/$(1)/%.png
+ @mkdir -p `dirname $$@`
+ @convert $$< -resize 64x64 $$@
+endef
+
+$(foreach tiledir,$(BTILE_DIRS),$(eval $(call btile,$(tiledir))))