-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
155 lines (126 loc) · 4.34 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
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
151
152
153
154
155
#==============================================================================
# makefile by Alex Chadwick
# 'SZSTOOLSDIR' extention by Dirk Clemens (Wiimm)
#
# makefile script for the CTGP-R Mario Kart Wii modification software.
#==============================================================================
#==============================================================================
# Settings
#==============================================================================
ONLINE_REGION ?= 255
ENABLE_CTWW ?= 1
ENABLE_FILTER ?= 1
ENABLE_BSHELL ?= 1
ENABLE_SOM ?= 1
ENABLE_CTS ?= 1
#==============================================================================
# Programs
#==============================================================================
ifneq ($(strip $(DEVKITPPC)),)
PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
endif
PREFIX ?= powerpc-eabi-
AS = $(PREFIX)as
CC = $(PREFIX)gcc
LD = $(PREFIX)ld
OD = $(PREFIX)objdump
OC = $(PREFIX)objcopy
MKDIR = test -d $@ || mkdir $@
Q ?= @
LOG ?= @echo $@
.SECONDARY:
#==============================================================================
# Output configuration
#==============================================================================
region ?= *
BAD0 ?= bad0
BAD1 ?= bad1
TARGETS ?= bad0 bad1
GAMES ?= rmce rmcj rmck rmcp
SFLAGS += -mregnames
ifeq ("$(region)","E")
game := rmce
ALL := $(BUILD) $(TARGETS)
else ifeq ("$(region)","J")
game := rmcj
ALL := $(BUILD) $(TARGETS)
else ifeq ("$(region)","K")
game := rmck
ALL := $(BUILD) $(TARGETS)
else ifeq ("$(region)","P")
game := rmcp
ALL := $(BUILD) $(TARGETS)
else ifeq ("$(region)","*")
game := dummy
# TODO: Add rmck when it works.
ALL := rmce rmcj rmcp
else
$(error 'region' is not 'E', 'J', 'K', 'P' or '*')
endif
TARGETDIR ?= bin/$(game)
SZSTOOLSDIR ?= szs-tools/$(game)
BUILD ?= build/$(game)
BUILD_ALL ?= build
SFLAGS += --defsym region=$(region) -I $(BUILD)
SETTINGS := GAME=$(game) REGION=$(region) ONLINE_REGION=$(ONLINE_REGION) \
ENABLE_CTWW=$(ENABLE_CTWW) \
ENABLE_FILTER=$(ENABLE_FILTER) ENABLE_BSHELL=$(ENABLE_BSHELL) \
ENABLE_SOM=$(ENABLE_SOM) ENABLE_CTS=$(ENABLE_CTS)
SFLAGS += $(addprefix --defsym ,$(SETTINGS))
#==============================================================================
#==============================================================================
# Rules
#==============================================================================
#==============================================================================
# Overall
#==============================================================================
.PHONY: help all clean allregions rmcp rmce rmck rmcj
help:
$Qecho "CT-CODE build system."
$Qecho " by Chadderz & Wiimm"
$Qecho ""
$Qecho "make all : Make all files for all regions (rmce,rmcj,rmcp)."
$Qecho "make rmc[ejp] : Make just the files for RMC[EJP]."
$Qecho "make rmck : Make the files for RMCK (not included in all)."
$Qecho "make clean : Remove all generated files."
$Qecho ""
$Qecho "All outputs go into the bin/ and szs-tools/ directories."
$Qecho "Temprorary files go into the build/ directory."
all: $(ALL)
rmce: bin/rmce build/rmce szs-tools/rmce
$(LOG)
+$Q-$(MAKE) --no-print-directory region=E all
rmcj: bin/rmcj build/rmcj szs-tools/rmcj
$(LOG)
+$Q-$(MAKE) --no-print-directory region=J all
rmck: bin/rmck build/rmck szs-tools/rmck
$(LOG)
+$Q-$(MAKE) --no-print-directory region=K all
rmcp: bin/rmcp build/rmcp szs-tools/rmcp
$(LOG)
+$Q-$(MAKE) --no-print-directory region=P all
#--- create directories
$(GAMES:%=bin/%) : bin
$(LOG)
$Q-$(MKDIR)
$(GAMES:%=build/%) : build
$(LOG)
$Q-$(MKDIR)
$(GAMES:%=szs-tools/%) : szs-tools
$(LOG)
$Q-$(MKDIR)
bin build szs-tools:
$(LOG)
$Q-$(MKDIR)
#--- clean
clean:
$(LOG)
$Q-rm -rf build bin szs-tools
#==============================================================================
# bad0
#==============================================================================
include $(BAD0)/makefile.mk
#==============================================================================
# bad1
#==============================================================================
include $(BAD1)/makefile.mk