forked from Vogtinator/crafti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (37 loc) · 1.66 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
GCC = nspire-gcc
GPP = nspire-g++
LD = nspire-ld
GENZEHN = genzehn
OPTIMIZE ?= fast
GCCFLAGS = -O$(OPTIMIZE) -I nGL -I . -Wall -W -marm -ffast-math -mcpu=arm926ej-s -fno-math-errno -fomit-frame-pointer -flto -fno-rtti -fgcse-sm -fgcse-las -funsafe-loop-optimizations -fno-fat-lto-objects -frename-registers -fprefetch-loop-arrays -Wold-style-cast -mno-thumb-interwork -ffunction-sections -fdata-sections -fno-exceptions -D NDEBUG $(if $(filter true,${DEBUG}),-DDEBUG -g)
LDFLAGS = -lm -Wl,--gc-sections
ZEHNFLAGS = --name "Crafti" --version 13 --author "Fabian Vogt & Bluebotlaboratories" --notice "3D Minecraft" --compress
# release with "make all" debug with "make all DEBUG=true"
BUILDPATH=$(if $(filter true,${DEBUG}),debug,release)
EXE = $(BUILDPATH)/crafti
OBJS = $(patsubst ./%.c, ./$(BUILDPATH)/%.o, $(shell find . -name \*.c -not -path './.*/*'))
OBJS += $(patsubst ./%.cpp, ./$(BUILDPATH)/%.o, $(shell find . -name \*.cpp -not -path './.*/*'))
OBJS += $(patsubst ./%.S, ./$(BUILDPATH)/%.o, $(shell find . -name \*.S -not -path './.*/*'))
.PHONY: prep
prep:
@mkdir -p $(BUILDPATH) $(BUILDPATH)/nGL
.PHONY: all
all: prep $(EXE).tns
test:
@echo $(if $(filter true,${DEBUG}),-DDEBUG)
.PHONY: help
help:
@echo run "make all" to build release
@echo run "make all DEBUG=true" to build debug
./$(BUILDPATH)/%.o: ./%.cpp
@echo Compiling $<...
@$(GPP) -std=c++11 $(GCCFLAGS) -c $< -o $@
$(EXE).elf: $(OBJS)
+$(LD) $^ -o $@ $(GCCFLAGS) $(LDFLAGS)
$(EXE).tns: $(EXE).elf
+$(GENZEHN) --input $^ --output [email protected] $(ZEHNFLAGS)
+make-prg [email protected] $@
.PHONY: clean
clean:
rm -rf `find . -name \*.o -o -name \*.elf -o -name \*.tns -not -path './.*/*'` release/ debug/