aboutsummaryrefslogtreecommitdiff
path: root/src/static/makefile
blob: 3caeb6e0f9e9046245252db538ee76e0a6546701 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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/hud_heart.hex \
			foreground/upgrades.hex \
			foreground/bullet.hex \
			foreground/gozer.hex \
			foreground/slime.hex \
			foreground/slime_jumpable.hex \
			foreground/bird.hex \
			foreground/boss1.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