-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
107 lines (83 loc) · 2.6 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# uncomment out to compile with GCC
# COMPILE_WITH_LLVM=1
ifdef COMPILE_WITH_LLVM
ifeq ($(strip $(GBA_LLVM)),)
$(error Please set GBA_LLVM in your environment. export GBA_LLVM=<path to gba-llvm installation>)
endif
# gba tools helpers directory that includes gbafix
# For example, if you use devkitpro, the default path is:
# /opt/devkitpro/tools/bin/
export TOOLS = $(GBA_LLVM)/bin/
# compiler tools prefix used by makefiles for conv2aas executable
# for example, the empty prefix below will use the system gcc tools
export PREFIX =
else
# GCC based toolchain
export CROSS = arm-none-eabi-
export TOOLS =
export PREFIX =
endif
# example names
export EXAMPLE_PREFIX=AASExample
export EXAMPLE2_PREFIX=AASExample2
export EXAMPLE_CPP_PREFIX=AASExamplePlusPlus
BUILD = build
AAS_DIR = src/aas
CONV2AAS_DIR = src/conv2aas
EXAMPLE_DIR = examples/AASExample
EXAMPLE2_DIR = examples/AASExample2
EXAMPLE_CPP_DIR = examples/AASExample_c++
CONV2AAS_FILE = conv2aas
ifeq ($(OS),Windows_NT)
CONV2AAS_FILE = conv2aas.exe
endif
LIB = $(BUILD)/aas/lib
INCLUDE = $(BUILD)/aas/include
BUILD_AAS = $(LIB)/libAAS.a
BUILD_CONV2AAS_DIR = $(BUILD)/conv2aas
BUILD_CONV2AAS = $(BUILD_CONV2AAS_DIR)/$(CONV2AAS_FILE)
BUILD_EXAMPLES = $(BUILD)/examples
AAS = $(AAS_DIR)/libAAS.a
CONV2AAS = $(CONV2AAS_DIR)/$(CONV2AAS_FILE)
EXAMPLE = $(EXAMPLE_DIR)/$(EXAMPLE_PREFIX).gba
EXAMPLE2 = $(EXAMPLE2_DIR)/$(EXAMPLE2_PREFIX).gba
EXAMPLE_CPP = $(EXAMPLE_CPP_DIR)/$(EXAMPLE_CPP_PREFIX).gba
.PHONY: all aas conv2aas example example2 example_cpp
all: aas conv2aas example example2 example_cpp
$(AAS):
$(MAKE) -e -C $(AAS_DIR)
$(BUILD_AAS): $(AAS)
mkdir -p $(LIB)
mkdir -p $(INCLUDE)
cp $(AAS) $(LIB)
cp $(AAS_DIR)/AAS.h $(INCLUDE)
cp $(AAS_DIR)/AAS_Mixer.h $(INCLUDE)
aas: $(BUILD_AAS)
$(CONV2AAS):
$(MAKE) -e -C $(CONV2AAS_DIR)
$(BUILD_CONV2AAS): $(CONV2AAS)
mkdir -p $(BUILD_CONV2AAS_DIR)
cp $(CONV2AAS) $(BUILD_CONV2AAS_DIR)
conv2aas: $(BUILD_CONV2AAS)
$(EXAMPLE): $(BUILD_AAS) $(BUILD_CONV2AAS)
$(MAKE) -e -C $(EXAMPLE_DIR)
example: $(EXAMPLE)
mkdir -p $(BUILD_EXAMPLES)
cp $(EXAMPLE) $(BUILD_EXAMPLES)
$(EXAMPLE2): $(BUILD_AAS) $(BUILD_CONV2AAS)
$(MAKE) -e -C $(EXAMPLE2_DIR)
example2: $(EXAMPLE2)
mkdir -p $(BUILD_EXAMPLES)
cp $(EXAMPLE2) $(BUILD_EXAMPLES)
$(EXAMPLE_CPP): $(BUILD_AAS) $(BUILD_CONV2AAS)
$(MAKE) -e -C $(EXAMPLE_CPP_DIR)
example_cpp: $(EXAMPLE_CPP)
mkdir -p $(BUILD_EXAMPLES)
cp $(EXAMPLE_CPP) $(BUILD_EXAMPLES)
clean:
$(MAKE) -C $(AAS_DIR) clean
$(MAKE) -C $(CONV2AAS_DIR) clean
$(MAKE) -C $(EXAMPLE_DIR) clean
$(MAKE) -C $(EXAMPLE2_DIR) clean
$(MAKE) -C $(EXAMPLE_CPP_DIR) clean
rm -r build