@@ -16,14 +16,31 @@ include $(DEVKITPPC)/gamecube_rules
16
16
export ELF2REL := $(TTYDTOOLS ) /bin/elf2rel
17
17
export GCIPACK := python $(TTYDTOOLS ) /gcipack/gcipack.py
18
18
19
+ ifeq ($(VERSION ) ,)
20
+ all : us jp eu
21
+ us :
22
+ @$(MAKE ) --no-print-directory VERSION=us
23
+ jp :
24
+ @$(MAKE ) --no-print-directory VERSION=jp
25
+ eu :
26
+ @$(MAKE ) --no-print-directory VERSION=eu
27
+
28
+ clean :
29
+ @$(MAKE ) --no-print-directory clean_target VERSION=us
30
+ @$(MAKE ) --no-print-directory clean_target VERSION=eu
31
+ @$(MAKE ) --no-print-directory clean_target VERSION=jp
32
+
33
+ .PHONY : all clean us jp eu
34
+ else
35
+
19
36
# ---------------------------------------------------------------------------------
20
37
# TARGET is the name of the output
21
38
# BUILD is the directory where object files & intermediate files will be placed
22
39
# SOURCES is a list of directories containing source code
23
40
# INCLUDES is a list of directories containing extra header files
24
41
# ---------------------------------------------------------------------------------
25
- TARGET := $(notdir $(CURDIR ) )
26
- BUILD := build
42
+ TARGET := $(notdir $(CURDIR ) ) . $( VERSION )
43
+ BUILD := build. $( VERSION )
27
44
SOURCES := source
28
45
DATA := data
29
46
INCLUDES := include
@@ -34,10 +51,20 @@ INCLUDES := include
34
51
35
52
MACHDEP = -mno-sdata -mgcn -DGEKKO -mcpu=750 -meabi -mhard-float
36
53
37
- CFLAGS = -nostdlib -ffunction-sections -fdata-sections -g -O3 -Wall $(MACHDEP ) $(INCLUDE )
54
+ CFLAGS = -nostdlib -ffreestanding - ffunction-sections -fdata-sections -g -O3 -Wall $(MACHDEP ) $(INCLUDE )
38
55
CXXFLAGS = -fno-exceptions -fno-rtti -std=gnu++17 $(CFLAGS )
39
56
40
- LDFLAGS = -r -s -e _prolog -u _prolog -u _epilog -u _unresolved -Wl,--gc-sections -nostartfiles -g $(MACHDEP ) -Wl,-Map,$(notdir $@ ) .map
57
+ LDFLAGS = -r -e _prolog -u _prolog -u _epilog -u _unresolved -Wl,--gc-sections -nostdlib -g $(MACHDEP ) -Wl,-Map,$(notdir $@ ) .map
58
+
59
+ # Platform options
60
+ ifeq ($(VERSION ) ,us)
61
+ $(CFLAGS) += -DTTYD_US
62
+ else ifeq ($(VERSION),jp)
63
+ $(CFLAGS) += -DTTYD_JP
64
+ else ifeq ($(VERSION),eu)
65
+ $(CFLAGS) += -DTTYD_EU
66
+ endif
67
+
41
68
42
69
# ---------------------------------------------------------------------------------
43
70
# any extra libraries we wish to link with the project
@@ -90,7 +117,7 @@ export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES)))
90
117
91
118
# For REL linking
92
119
export LDFILES := $(foreach dir,$(SOURCES ) ,$(notdir $(wildcard $(dir ) /* .ld) ) )
93
- export MAPFILE := $(CURDIR ) /include/ttyd.lst
120
+ export MAPFILE := $(CURDIR ) /include/ttyd.$( VERSION ) . lst
94
121
export BANNERFILE := $(CURDIR ) /banner.raw
95
122
export ICONFILE := $(CURDIR ) /icon.raw
96
123
@@ -109,16 +136,16 @@ export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
109
136
-L$(LIBOGC_LIB )
110
137
111
138
export OUTPUT := $(CURDIR ) /$(TARGET )
112
- .PHONY : $(BUILD ) clean
139
+ .PHONY : $(BUILD ) clean_target
113
140
114
141
# ---------------------------------------------------------------------------------
115
142
$(BUILD ) :
116
143
@[ -d $@ ] || mkdir -p $@
117
144
@$(MAKE ) --no-print-directory -C $(BUILD ) -f $(CURDIR ) /Makefile
118
145
119
146
# ---------------------------------------------------------------------------------
120
- clean :
121
- @echo clean ...
147
+ clean_target :
148
+ @echo clean ... $( VERSION )
122
149
@rm -fr $(BUILD ) $(OUTPUT ) .elf $(OUTPUT ) .dol $(OUTPUT ) .rel $(OUTPUT ) .gci
123
150
124
151
# ---------------------------------------------------------------------------------
@@ -129,8 +156,8 @@ DEPENDS := $(OFILES:.o=.d)
129
156
# ---------------------------------------------------------------------------------
130
157
# main targets
131
158
# ---------------------------------------------------------------------------------
132
- $(OUTPUT ) .gci : $(OUTPUT ) .rel
133
- $(OUTPUT ) .rel : $(OUTPUT ) .elf
159
+ $(OUTPUT ) .gci : $(OUTPUT ) .rel $( BANNERFILE ) $( ICONFILE )
160
+ $(OUTPUT ) .rel : $(OUTPUT ) .elf $( MAPFILE )
134
161
$(OUTPUT ) .elf : $(LDFILES ) $(OFILES )
135
162
136
163
$(OFILES_SOURCES ) : $(HFILES )
@@ -157,3 +184,4 @@ $(OFILES_SOURCES) : $(HFILES)
157
184
# ---------------------------------------------------------------------------------
158
185
endif
159
186
# ---------------------------------------------------------------------------------
187
+ endif
0 commit comments