-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
34 lines (26 loc) · 920 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
SDCC ?= sdcc
STCCODESIZE ?= 13312
SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --idata-loc 0x70
#SDCCOPTS ?= --code-size $(STCCODESIZE) --xram-size 256 --stack-auto --model-large
FLASHFILE ?= main.hex
LARGE_LDFLAGS += -L/usr/share/sdcc/lib/large/
# CFLAGS += -DSTACK_DEBUG # write the stack pointer to P3_4
SRC = src/lcd.c src/key.c src/utils.c src/decn/decn.c src/calc.c src/stack_debug.c
OBJ=$(patsubst src%.c,build%.rel, $(SRC))
all: main
build/%.rel: src/%.c src/%.h
mkdir -p $(dir $@)
$(SDCC) $(SDCCOPTS) $(CFLAGS) -o $@ -c $<
main: $(OBJ)
$(SDCC) -o build/ src/[email protected] $(SDCCOPTS) $(CFLAGS) $^
# $(SDCC) -o build/ src/[email protected] $(SDCCOPTS) $(CFLAGS) $(LARGE_LDFLAGS) $^
@ tail -n 5 build/main.mem | head -n 2
@ tail -n 1 build/main.mem
cp build/[email protected] [email protected]
eeprom:
sed -ne '/:..1/ { s/1/0/2; p }' main.hex > eeprom.hex
clean:
rm -f *.ihx *.hex *.bin
rm -rf build/*
cpp: SDCCOPTS+=-E
cpp: main