-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
51 lines (40 loc) · 890 Bytes
/
Makefile
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
PROG = graphics2
GBDK_N = ../gbdk-n
CC = $(GBDK_N)/bin/gbdk-n-compile.sh
LD = $(GBDK_N)/bin/gbdk-n-link.sh
MR = $(GBDK_N)/bin/gbdk-n-make-rom.sh
IMG2GB = img2gb
_OBJ = $(patsubst %.c,%.rel,$(wildcard src/*.c))
all: build
build: $(PROG).gb
$(PROG).gb: $(_OBJ)
$(LD) -o $(PROG).ihx $^
$(MR) $(PROG).ihx $(PROG).gb
%.rel: %.c
$(CC) -o $@ -c $<
assets:
$(IMG2GB) tileset \
--output-c-file=src/tileset.c \
--output-header-file=src/tileset.h \
--output-image=src/tileset.png \
--deduplicate \
./img.png
$(IMG2GB) tilemap \
--output-c-file=src/tilemap.c \
--output-header-file=src/tilemap.h \
src/tileset.png \
./img.png
.PHONY: gbdk-n
gbdk-n:
cd $(GBDK_N) && make
clean:
rm -rf src/*.rel
rm -rf src/*.lst
rm -rf src/*.sym
rm -rf src/*.asm
rm -rf $(PROG).gb
rm -rf $(PROG).ihx
rm -rf $(PROG).map
rm -rf $(PROG).sym
rm -rf $(PROG).noi
rm -rf $(PROG).lk