-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (96 loc) · 4.99 KB
/
Makefile
File metadata and controls
150 lines (96 loc) · 4.99 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
ifneq "$(wildcard config.mk)" "config.mk"
$(error Error: could not find file `config.mk`. Please make a copy of `config.mk.template`, rename the copy to `config.mk`, and adjust the copy as necessary before attempting to build again.)
endif
# Get all of the locations for dependencies
# Modify dependencies.mk to set the locations/commands for each tool
include config.mk
# Local prefixes
INCLUDE_PREFIX := ./include/
SOURCE_PREFIX := ./source/
OBJ_PREFIX := ./obj/
BIN_PREFIX := ./bin/
DEBUG_PREFIX := $(BIN_PREFIX)/Debug/
RELEASE_PREFIX := $(BIN_PREFIX)/Release/
DOLPHIN_PREFIX := Dolphin/
DOLPHIN_OBJ_PREFIX := $(OBJ_PREFIX)/$(DOLPHIN_PREFIX)
OUTPUT_PREFIX := $(DEBUG_PREFIX)
DEFINES :=
DOLPHIN_DEFINES := -DDOLPHIN
debug: DEFINES += -DDEBUG
# Add more target prefixes here
release: OUTPUT_PREFIX := $(RELEASE_PREFIX)
ifneq ($(COMPLETE_PREREQUISITES), true) #1
COMPLETE_PREREQUISITES := false
endif #1
ifeq ($(COMPLETE_PREREQUISITES), true) #1
AUTO_GENERATE_FLAG := -MM
ifeq ($(SYSTEM_INCLUDE_PREREQUISITE), true) #2
AUTO_GENERATE_FLAG := -M
endif #2
endif #1
INCLUDE := -nodefaults -i $(INCLUDE_PREFIX) -I- -i $(PATH_TO_GAME) -i $(PATH_TO_RFL) -i $(PATH_TO_RVL) -I- -i $(PATH_TO_TRK) -I- -i $(PATH_TO_RUNTIME) -I- -i $(PATH_TO_MSL_C) -I- -i $(PATH_TO_MSL_CPP) -I- -i $(PATH_TO_JSYS) -I- -i $(PATH_TO_NW4R) -I- -i $(BUSSUN_INCLUDE)
# Do not warn over consistent redeclarations, empty declarations
WARNFLAGS := -w all -pragma "warning off (10122)" -pragma "warning off (10216)"
CXXFLAGS := -c -Cpp_exceptions off -proc gekko -fp hard -ipa file -inline auto,level=2 -O4,s -rtti off -sdata 0 -sdata2 0 -align powerpc -enum int $(INCLUDE)
CFLAGS := -lang c99 $(CXXFLAGS) $(WARNFLAGS)
#ASMFLAGS := -c -proc gecko
O_FILES := net.o packets.o multimodel.o transmission.o packetProcessor.o multiplayer.o debug.o netActor.o alignment.o StarPieceSync.o uiIpFsTool.o
O_FILES := $(foreach obj, $(O_FILES), $(OBJ_PREFIX)/$(obj))
DOLPHIN_DEPENDENT_O_FILES := beacon.o
DOLPHIN_INSTANCE_O_FILES := $(foreach obj, $(DOLPHIN_DEPENDENT_O_FILES), $(DOLPHIN_OBJ_PREFIX)/$(obj))
NONDOLPHIN_INSTANCE_O_FILES := $(foreach obj, $(DOLPHIN_DEPENDENT_O_FILES), $(OBJ_PREFIX)/$(obj))
ifndef SYMBOL_MAP
$(error Error: no symbol map specified)
endif
export SYMBOL_MAP
SYMBOL_OSEV_ADDR = $(shell export SYMBOL_MAP="$(SYMBOL_MAP)" ; line=`grep OSExceptionVector $$SYMBOL_MAP` ; echo $${line#*=})
.PHONY: clean all debug release cleandeps
debug: all
release: all
dolphinDebug: | $(DEBUG_PREFIX)/$(DOLPHIN_PREFIX)
dolphinDebug: OUTPUT_PREFIX := $(DEBUG_PREFIX)
dolphinDebug: $(DEBUG_PREFIX)/$(DOLPHIN_PREFIX)/interrupts.xml $(DEBUG_PREFIX)/$(DOLPHIN_PREFIX)/CustomCode_USA.bin
dolphinRelease: | $(RELEASE_PREFIX)/$(DOLPHIN_PREFIX)
dolphinRelease: OUTPUT_PREFIX := $(RELEASE_PREFIX)
dolphinRelease: $(RELEASE_PREFIX)/$(DOLPHIN_PREFIX)/interrupts.xml $(RELEASE_PREFIX)/$(DOLPHIN_PREFIX)/CustomCode_USA.bin
all: | $(OUTPUT_PREFIX)
all: $(OUTPUT_PREFIX)/interrupts.xml $(OUTPUT_PREFIX)/CustomCode_USA.bin
clean:
rm -f $(OBJ_PREFIX)/* $(DEBUG_PREFIX)/* $(RELEASE_PREFIX)/*
cleandeps:
rm -f $(OBJ_PREFIX)/*.d
#%.o: %.s
# $(AS) $(ASMFLAGS) -o $@ $<
$(OBJ_PREFIX):
mkdir -p $(OBJ_PREFIX)
$(DEBUG_PREFIX):
mkdir -p $(DEBUG_PREFIX)
$(RELEASE_PREFIX):
mkdir -p $(RELEASE_PREFIX)
$(DOLPHIN_OBJ_PREFIX):
mkdir -p $(DOLPHIN_OBJ_PREFIX)
$(DEBUG_PREFIX)/$(DOLPHIN_PREFIX):
mkdir -p $(DEBUG_PREFIX)/$(DOLPHIN_PREFIX)
$(RELEASE_PREFIX)/$(DOLPHIN_PREFIX):
mkdir -p $(RELEASE_PREFIX)/$(DOLPHIN_PREFIX)
$(DOLPHIN_OBJ_PREFIX)/%.o: $(SOURCE_PREFIX)/%.cpp | $(DOLPHIN_OBJ_PREFIX)
$(CXX) $(CXXFLAGS) $(DEFINES) $(DOLPHIN_DEFINES) -c -o $@ $<
$(OBJ_PREFIX)/%.o: $(SOURCE_PREFIX)/%.cpp | $(OBJ_PREFIX)
$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
$(OBJ_PREFIX)/%.o: $(SOURCE_PREFIX)/%.c | $(OBJ_PREFIX)
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(OUTPUT_PREFIX)/interrupts.xml: $(OBJ_PREFIX)/interruptSubs.o
$(KAMEK) -static=$(SYMBOL_OSEV_ADDR) -externals=$(SYMBOL_MAP) -output-riiv=$@ $(OBJ_PREFIX)/interruptSubs.o
$(OUTPUT_PREFIX)/$(DOLPHIN_PREFIX)/interrupts.xml: $(OBJ_PREFIX)/interruptSubs.o
$(KAMEK) -static=$(SYMBOL_OSEV_ADDR) -externals=$(SYMBOL_MAP) -output-riiv=$@ $(OBJ_PREFIX)/interruptSubs.o
$(OUTPUT_PREFIX)/CustomCode_USA.bin: $(O_FILES) $(NONDOLPHIN_INSTANCE_O_FILES)
$(KAMEK) -externals=$(SYMBOL_MAP) -output-kamek=$@ $(O_FILES) $(NONDOLPHIN_INSTANCE_O_FILES)
$(OUTPUT_PREFIX)/$(DOLPHIN_PREFIX)/CustomCode_USA.bin: $(O_FILES) $(DOLPHIN_INSTANCE_O_FILES)
$(KAMEK) -externals=$(SYMBOL_MAP) -output-kamek=$@ $(O_FILES) $(DOLPHIN_INSTANCE_O_FILES)
ifeq ($(COMPLETE_PREREQUISITES), true) #1
$(OBJ_PREFIX)/%.d: $(SOURCE_PREFIX)/%.c* | $(OBJ_PREFIX)
@$(CC) $(INCLUDE) $(AUTO_GENERATE_FLAG) $< | sed 's/Z:\\/\//;s?^[^:]*:?$@ $(@:.d=.o):?;s/\\/\//g;s/\/\x0D$$/\\/' > $@
$(DOLPHIN_OBJ_PREFIX)/%.d: $(SOURCE_PREFIX)/%.c* | $(DOLPHIN_OBJ_PREFIX)
@$(CC) $(INCLUDE) $(AUTO_GENERATE_FLAG) $< | sed 's/Z:\\/\//;s?^[^:]*:?$@ $(@:.d=.o):?;s/\\/\//g;s/\/\x0D$$/\\/' > $@
include $(O_FILES:.o=.d) $(OBJ_PREFIX)/interruptSubs.d $(DOLPHIN_INSTANCE_O_FILES:.o=.d) $(NONDOLPHIN_INSTANCE_O_FILES:.o=.d)
endif #1