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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
MCU:=24FJ256DA206
IDIR=.
ODIR=build
CC:=xc16-gcc
CFLAGS:=\
-Wall\
-I$(IDIR)\
-mcpu=$(MCU)\
-msmart-io=1\
-Wl,--script=p$(MCU).gld\
-Wl,--gc-sections\
-Wl,--stack=16\
-Wl,--heap=16384\
-Wl,--local-stack\
-Wl,--check-sections\
-Wl,--data-init\
-Wl,--pack-data\
-Wl,--handles\
-Wl,--isr\
-Wl,--no-gc-sections\
-Wl,--fill-upper=0\
-Wl,--stackguard=16\
-Wl,--no-force-link\
-Wl,--smart-io
BIN2HEX:=xc16-bin2hex
_HEX:=main.hex
HEX:=$(patsubst %,$(ODIR)/%,$(_HEX))
_DEPS:=\
init.h\
t6963c_specific.h\
t6963c/t6963c.h\
t6963c/terminal.h\
fuspel/interpreter/code.h\
fuspel/interpreter/eval.h\
fuspel/interpreter/graphs.h\
fuspel/interpreter/lex.h\
fuspel/interpreter/log.h\
fuspel/interpreter/mem.h\
fuspel/interpreter/parse.h\
fuspel/interpreter/print.h\
fuspel/interpreter/syntax.h
DEPS:=$(patsubst %,$(IDIR)/%,$(_DEPS))
_OBJ:=main.o $(subst .h,.o,$(_DEPS))
OBJ:=$(patsubst %,$(ODIR)/%,$(_OBJ))
_ASM:=$(subst .o,.s,$(_OBJ))
ASM:=$(patsubst %,$(ODIR)/%,$(_ASM))
.PHONY: all all_hex all_assembly clean
all: all_hex
all_hex: $(HEX)
all_assembly: $(ASM)
$(ODIR)/%.hex: $(ODIR)/%.out
$(BIN2HEX) $<
$(ODIR)/%.out: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)\
-Wl,-Map -Wl,$(ODIR)/$(notdir $(basename $@)).map
$(ODIR)/%.o: %.c $(DEPS)
mkdir -p $(dir $@)
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.s: %.c
mkdir -p $(dir $@)
$(CC) -S -o $@ $< $(CFLAGS)
clean:
$(RM) -r $(ODIR)
|