summaryrefslogtreecommitdiff
path: root/template/Makefile
blob: 32ce503fe165be6855b1db7d7366959286c874f7 (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
ASM=crt0.asm
SRC=bootloader.c

OBJ=$(ASM:%.asm=build/%.rel) $(SRC:%.c=build/%.rel)
IHX=output/bootloader.ihx
TARGET=bootloader.hex

CFLAGS=-mz80
LDFLAGS=-mz80 --no-std-crt0 --code-loc 0x4010 -Wl-b_GSINIT=0x4150

all : $(TARGET)

output/%.rel : %.asm
	sdasz80 -g -o $@ $<

output/%.rel : %.c
	sdcc $(CFLAGS) -c -o $@ $<

$(IHX) : $(OBJ)
	sdcc $(LDFLAGS) -o $@ $(OBJ)

$(TARGET) : $(IHX)
	hex2bin.py $< $@

.PHONY: upload
upload:
	z80up $(TARGET) -p /dev/ttyUSB0

.PHONY : clean
clean :
	@rm -rf output/* $(TARGET)