-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (43 loc) · 1.16 KB
/
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
50
51
52
53
54
55
DEBUG = FALSE
GCC = nspire-gcc
AS = nspire-as
GXX = nspire-g++
LD = nspire-ld
GENZEHN = genzehn
GCCFLAGS = -W -marm -Wall -Wextra -Wno-narrowing -Wno-sign-compare -Wno-unused-variable -Wno-missing-field-initializers
LDFLAGS =
ZEHNFLAGS = --name "BloonsTD5"
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 = BloonsTD5
DISTDIR = .
vpath %.tns $(DISTDIR)
vpath %.elf $(DISTDIR)
bold := $(shell tput bold)
sgr0 := $(shell tput sgr0)
all: $(EXE).tns
%.o: %.c
$(info $(bold)Compiling $< $(sgr0))
$(GCC) $(GCCFLAGS) -c $< -o $@
%.o: %.cpp
$(info $(bold)Compiling $< $(sgr0))
$(GXX) $(GCCFLAGS) -c $< -o $@
%.o: %.S
$(AS) -c $< -o $@
$(EXE).elf: $(OBJS)
$(info $(bold)Linking $(sgr0))
mkdir -p $(DISTDIR)
$(LD) $^ $(LDFLAGS) -o $@
$(EXE).tns: $(EXE).elf
$(info $(bold)Making Executable $@ $(sgr0))
$(GENZEHN) --input $^ --output [email protected] $(ZEHNFLAGS)
make-prg [email protected] $@
clean:
rm -f $(OBJS) $(DISTDIR)/$(EXE).tns $(DISTDIR)/$(EXE).elf $(DISTDIR)/$(EXE).zehn