-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
49 lines (37 loc) · 925 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
DEBUG = FALSE
GCC = nspire-gcc
AS = nspire-as
GXX = nspire-g++
LD = nspire-ld
GENZEHN = genzehn
GCCFLAGS = -Wall -W -marm
LDFLAGS =
ZEHNFLAGS = --name "2048"
ifeq ($(DEBUG),FALSE)
GCCFLAGS += -Os
else
GCCFLAGS += -O0 -g
endif
OBJS = $(patsubst %.c, %.o, $(shell find . -name \*.c))
OBJS += $(patsubst %.cpp, %.o, $(shell find . -name \*.cpp))
OBJS += $(patsubst %.S, %.o, $(shell find . -name \*.S))
EXE = 2048
DISTDIR = .
vpath %.tns $(DISTDIR)
vpath %.elf $(DISTDIR)
all: $(EXE).prg.tns
%.o: %.c
$(GCC) $(GCCFLAGS) -c $<
%.o: %.cpp
$(GXX) $(GCCFLAGS) -c $<
%.o: %.S
$(AS) -c $<
$(EXE).elf: $(OBJS)
mkdir -p $(DISTDIR)
$(LD) $^ -o $(DISTDIR)/$@ $(LDFLAGS)
$(EXE).tns: $(EXE).elf
$(GENZEHN) --input $(DISTDIR)/$^ --output $(DISTDIR)/$@ $(ZEHNFLAGS)
$(EXE).prg.tns: $(EXE).tns
make-prg $(DISTDIR)/$^ $(DISTDIR)/$@
clean:
rm -f *.o $(DISTDIR)/$(EXE).tns $(DISTDIR)/$(EXE).elf $(DISTDIR)/$(EXE).prg.tns