-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtonc.mak
73 lines (50 loc) · 1.89 KB
/
tonc.mak
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
#
# Hub makefile for Tonc's demos
#
# === Variables =======================================================
export CROSS := arm-none-eabi-
LIBTONC := tonclib
GRPDIRS := basic ext adv lab
BINDIR := ../bin
# List all directories in the group dirs
# Yeah, there's probably a better way :/
PROJALL := $(foreach dir, $(GRPDIRS), $(shell ls -d $(dir)/*/))
EXCLUDE :=
PROJDIRS := $(filter-out $(foreach proj, $(EXCLUDE), %/$(proj)/), $(PROJALL))
DEMO := bigmap
DEMODIR := $(filter %/$(DEMO)/, $(PROJDIRS))
# Convert GCC lines to conform to the right IDE, feel free to add more
# GCC : {filename}:{line}: ...
# MSVS: {dir}\{filename}({line}): ...
ifeq ($(IDE),msvc)
# And switch is DEMO is not in 'basic' or 'ext',
# as the rest behaves differently :/
ifeq ($(filter basic/% ext/%, lab/%, $(DEMODIR)),)
ERRFIX := 2>&1 | sed -e 's|\(.\+\):\([0-9]\+\):|\1(\2):|'
else
ERRFIX := 2>&1 | sed -e 's|\(.\+\):\([0-9]\+\):|../$(DEMODIR)\1(\2):|'
endif
endif # /$(IDE)
.PHONY : build clean build_all clean_all
# === Build Single ====================================================
build:
$(MAKE) -C $(DEMODIR) $(ERRFIX)
# === Clean Single ====================================================
clean:
@$(MAKE) -C $(DEMODIR) clean
# === Build Single ====================================================
build_all: libtonc
@echo === Building all projects \(this could take a while\) ===
@for proj in $(PROJDIRS) ; \
do $(MAKE) -s -C $$proj ; done;
@[ -d $(BINDIR) ] || mkdir -p $(BINDIR)
@for proj in $(PROJDIRS); do cp $$proj*.gba $(BINDIR) ; done;
# === Clean Single ====================================================
clean_all:
@echo === Cleaning all projects \(this could take a while\) ===
# @$(MAKE) clean -C $(LIBTONC)
@for proj in $(PROJDIRS); \
do $(MAKE) clean -s -C $$proj ; done;
# === Build libtonc ===================================================
libtonc:
@$(MAKE) -C $(LIBTONC)