-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (48 loc) · 1.57 KB
/
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
52
53
54
55
56
57
58
59
60
ifeq ($(OS), Windows_NT)
RM = del /f /q
CP = copy /Y
ifdef ComSpec
SHELL := $(ComSpec)
endif
ifdef COMSPEC
SHELL := $(COMSPEC)
endif
else
RM = rm -rf
CP = cp -f
endif
CC = sdcc
IHX2SMS = ihx2sms
ROM = ./dist/da-invasion.sms
IHXFILE = ./dist/da-invasion.ihx
# Note: May need to consider -DPAL_MACHINE there if wanting to make an NTSC ver.
CFLAGS = --std-sdcc11 -c -mz80 --peep-file ./compile/smslib/peep-rules.txt --opt-code-speed -DPAL_MACHINE
LDFLAGS = -mz80 --no-std-crt0 --data-loc 0xC000 -Wl-b_BANK2=0x8000 -Wl-b_BANK3=0x8000
ASSETS = $(addprefix ./src/, assets2banks.h)
OBJS = $(addprefix ./compile/, smslib/crt0_sms.rel main.rel check_keys.rel init_console.rel init_scenes.rel palettes.rel update_scenes.rel clear_tilemap.rel memcpy_expand_byte.rel ps_rand.rel screen_buffer.rel sintab.rel default.rel fire.rel grid.rel intro.rel particles.rel plasma.rel scroller.rel sphere.rel sineline.rel type.rel)
BANKS = $(addprefix ./compile/, bank2.rel bank3.rel)
LIBS = SMSlib.lib
all: CFLAGS += --debug
all: LDFLAGS += --debug
all: build
dist: clean
dist: build
build: $(ROM)
$(ROM): $(IHXFILE)
$(IHX2SMS) $(IHXFILE) $(ROM)
$(IHXFILE): $(OBJS)
$(CC) -o $(IHXFILE) $(LDFLAGS) $(OBJS) $(LIBS) $(BANKS)
%.rel: ./src/%.c
$(CC) -c $(CFLAGS) $<
%.rel: ./src/engine/%.c
$(CC) -c $(CFLAGS) $<
%.rel: ./src/helpers/%.c
$(CC) -c $(CFLAGS) $<
%.rel: ./src/scenes/%.c
$(CC) -c $(CFLAGS) $<
# This isn't working yet on Windows
# clean:
# $(RM) $(ROM) $(addprefix ./compile/, *.sym *.lnk *.ihx *.map *.lst *.asm *.bin *.lk *.noi)
help:
echo Usage:
echo make = builds all