aboutsummaryrefslogtreecommitdiff
path: root/src/static/makefile
diff options
context:
space:
mode:
authorUnavailableDev <69792062+UnavailableDev@users.noreply.github.com>2023-04-06 12:32:23 +0200
committerGitHub <noreply@github.com>2023-04-06 12:32:23 +0200
commitd1c00c98ca0f2ca498284e60fa057a610cc5c461 (patch)
treea2efebcb9917d7f4f3666a722338f50b9590e843 /src/static/makefile
parent1771aaa12736b4dbc24419270cf595de6d345969 (diff)
parent93e9426d5642dfab7a13d5a34873b296de1d9642 (diff)
Merge pull request #58 from UnavailableDev/dev
Dynamic tilemap
Diffstat (limited to 'src/static/makefile')
-rw-r--r--src/static/makefile49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/static/makefile b/src/static/makefile
new file mode 100644
index 0000000..ba9b304
--- /dev/null
+++ b/src/static/makefile
@@ -0,0 +1,49 @@
+XXD := xxd
+TILEPACK := ../../scripts/tilepack
+MANIFEST2HEADER := ../../scripts/manifest2header.awk
+TILEDMK := ../../scripts/tiled.mk.awk
+TILEMAP2TILED := ../../scripts/tilemap2tiled
+
+INPUT += background/air.hex \
+ background/bricks.hex \
+ background/crates.hex \
+ background/shop_stall.hex \
+ background/title_screen_icon.hex \
+ foreground/title_screen_letteres_large.hex\
+ foreground/bullet.hex \
+ foreground/gozer.hex \
+ foreground/slime.hex \
+ foreground/font.hex
+ # world.hex
+USER_META += world.h
+
+OUT_BIN := $(patsubst %.hex,%.bin, $(INPUT))
+OUT_META := $(patsubst %.hex,%.meta, $(INPUT))
+
+.PHONY: all clean
+
+all: tilemap.bin tilemap.h
+
+%.bin: %.hex
+ sed 's/;.*//g' $< | $(XXD) -r | $(TILEPACK) > $@
+
+%.meta: %.bin
+ wc -c $< | tr '.' ' ' | awk '1 { print $$2" "$$1 / 104 }' > $@
+
+manifest.txt: $(OUT_BIN) $(OUT_META)
+ cat $(OUT_META) > $@
+
+tilemap.bin: manifest.txt $(OUT_BIN)
+ awk '1 { print $$1".bin" }' $< | xargs cat > $@
+
+tilemap.h: manifest.txt
+ $(MANIFEST2HEADER) $< > $@
+ cat $(USER_META) >> $@
+
+tiled.mk: manifest.txt
+ $(TILEDMK) < $< > $@
+
+include tiled.mk
+
+clean:
+ $(RM) -r $(OUT_BIN) $(OUT_META) manifest.txt tilemap.h tilemap.bin tiled.mk tiled