summaryrefslogtreecommitdiff
path: root/stn/Makefile
blob: 861b45971ac0da05cd831d697bb965946e873c9f (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
ASM=crt0.asm
SRC=stn.c

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

CFLAGS=-mz80 -I../dev/include -I. --Werror
LDFLAGS=-mz80 --no-std-crt0 --code-loc 0x4100 --data-loc 0xC000 -Wl-b_GSINIT=0x4080

all : $(TARGET)

build/%.rel : %.asm
	@echo '  (AS)' $<
	@sdcpp -P -I. -I../dev/include -DASSEMBLY $< > build/$<
	@sdasz80 -g -o $@ build/$<

build/%.rel : %.c
	@echo '  (CC)' $<
	@sdcc $(CFLAGS) -c -o $@ $<

$(IHX) : $(OBJ)
	@echo '  (LD)' $(OBJ)
	@sdcc $(LDFLAGS) -o $@ $(OBJ)

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

.PHONY : upload
upload :


.PHONE : flash
flash :
	@zup -a 5 -P -b38400 -p /dev/ttyUSB0 "w:0:4000:$(TARGET)"
#	zup -a 5 -P -p /dev/ttyUSB0 "w:0:4000:$(TARGET)"

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