-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (36 loc) · 769 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
DEBUG = FALSE
GCC = nspire-gcc
AS = nspire-as
GXX=nspire-g++
LD = nspire-ld-bflt
GCCFLAGS = -Wall -W -marm
LDFLAGS =
ifeq ($(DEBUG),FALSE)
GCCFLAGS += -Os
else
GCCFLAGS += -O0 -g
LDFLAGS += --debug
endif
CPPOBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp))
OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) $(patsubst %.S,%.o,$(wildcard *.S)) $(CPPOBJS) n2Dlib/n2DLib.o
ifneq ($(strip $(CPPOBJS)),)
LDFLAGS += --cpp
endif
EXE = nReuben.tns
DISTDIR = .
vpath %.tns $(DISTDIR)
all: $(EXE)
%.o: %.c
$(GCC) $(GCCFLAGS) -c $<
%.o: %.cpp
$(GXX) $(GCCFLAGS) -c $<
%.o: %.S
$(AS) -c $<
$(EXE): $(OBJS)
mkdir -p $(DISTDIR)
$(LD) $^ -o $(DISTDIR)/$@ $(LDFLAGS)
ifeq ($(DEBUG),FALSE)
@rm -f $(DISTDIR)/*.gdb
endif
clean:
rm -f *.o *.elf $(DISTDIR)/*.gdb $(DISTDIR)/$(EXE)