-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
340 lines (282 loc) · 13.1 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
export PATH := $(DEVKITPPC)/bin:$(PATH)
export LIBOGC_MAJOR := 2
export LIBOGC_MINOR := 1
export LIBOGC_PATCH := 0
include $(DEVKITPPC)/base_rules
BUILD := build
DATESTRING := $(shell date +%Y%m%d)
VERSTRING := $(shell printf "r%s.%s" "$$(git rev-list --count HEAD)" "$$(git rev-parse --short=7 HEAD)")
#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export LWIPDIR := $(BASEDIR)/lwip
export OGCDIR := $(BASEDIR)/libogc
export MODDIR := $(BASEDIR)/libmodplay
export DBDIR := $(BASEDIR)/libdb
export DIDIR := $(BASEDIR)/libdi
export BTEDIR := $(BASEDIR)/lwbt
export WIIUSEDIR := $(BASEDIR)/wiiuse
export TINYSMBDIR := $(BASEDIR)/libtinysmb
export LIBASNDDIR := $(BASEDIR)/libasnd
export LIBAESNDDIR := $(BASEDIR)/libaesnd
export LIBISODIR := $(BASEDIR)/libiso9660
export LIBWIIKEYB := $(BASEDIR)/libwiikeyboard
export DEPS := $(BASEDIR)/deps
export LIBS := $(BASEDIR)/lib
export INCDIR := $(BASEDIR)/include
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
export DEPSDIR := $(DEPS)/$(PLATFORM)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
BBALIB := $(LIBDIR)/libbba
OGCLIB := $(LIBDIR)/libogc
MODLIB := $(LIBDIR)/libmodplay
DBLIB := $(LIBDIR)/libdb
DILIB := $(LIBDIR)/libdi
BTELIB := $(LIBDIR)/libbte
WIIUSELIB := $(LIBDIR)/libwiiuse
TINYSMBLIB := $(LIBDIR)/libtinysmb
ASNDLIB := $(LIBDIR)/libasnd
AESNDLIB := $(LIBDIR)/libaesnd
ISOLIB := $(LIBDIR)/libiso9660
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
#---------------------------------------------------------------------------------
DEFINCS := -I$(BASEDIR) -I$(BASEDIR)/gc
INCLUDES := $(DEFINCS) -I$(BASEDIR)/gc/netif -I$(BASEDIR)/gc/ipv4 \
-I$(BASEDIR)/gc/ogc -I$(BASEDIR)/gc/ogc/machine \
-I$(BASEDIR)/gc/modplay \
-I$(BASEDIR)/gc/bte \
-I$(BASEDIR)/gc/sdcard -I$(BASEDIR)/gc/wiiuse \
-I$(BASEDIR)/gc/di
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
INCLUDES += -I$(BASEDIR)/wii \
-I$(PORTLIBS_PATH)/wii/include
MACHDEP += -DHW_RVL -Wa,-mbroadway
endif
ifeq ($(PLATFORM),cube)
INCLUDES += -I$(BASEDIR)/cube \
-I$(PORTLIBS_PATH)/gamecube/include
MACHDEP += -DHW_DOL -Wa,-mgekko
endif
INCLUDES += -I$(PORTLIBS_PATH)/ppc/include
CFLAGS := -DLIBOGC_INTERNAL -g -O2 -fno-strict-aliasing -Wall -Wno-address-of-packed-member $(MACHDEP) $(INCLUDES)
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
#---------------------------------------------------------------------------------
VPATH := $(LWIPDIR) \
$(LWIPDIR)/arch/gc \
$(LWIPDIR)/arch/gc/netif \
$(LWIPDIR)/core \
$(LWIPDIR)/core/ipv4 \
$(LWIPDIR)/netif \
$(OGCDIR) \
$(MODDIR) \
$(DBDIR) \
$(DBDIR)/uIP \
$(DIDIR) \
$(BTEDIR) \
$(WIIUSEDIR) \
$(TINYSMBDIR) \
$(LIBASNDDIR) \
$(LIBAESNDDIR) \
$(LIBISODIR) \
$(LIBWIIKEYB)
#---------------------------------------------------------------------------------
LWIPOBJ := network.o netio.o gcif.o \
inet.o mem.o dhcp.o raw.o \
memp.o netif.o pbuf.o stats.o \
sys.o tcp.o tcp_in.o tcp_out.o \
udp.o icmp.o ip.o ip_frag.o \
ip_addr.o etharp.o loopif.o \
enc28j60if.o w5500if.o w6100if.o
#---------------------------------------------------------------------------------
OGCOBJ := \
console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
video_asm.o video.o pad.o dvd.o exi.o mutex.o arqueue.o arqmgr.o \
cache_asm.o system.o system_asm.o cond.o \
gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
message.o card.o aram.o depackrnc.o decrementer_handler.o \
depackrnc1.o dsp.o si.o tpl.o ipc.o ogc_crt0.o \
console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o usbmouse.o \
sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
sdgecko_io.o sdgecko_buf.o gcsd.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
texconv.o wiilaunch.o
#---------------------------------------------------------------------------------
MODOBJ := freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
#---------------------------------------------------------------------------------
DBOBJ := uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
debug_supp.o geckousb.o
#---------------------------------------------------------------------------------
DIOBJ := di.o
#---------------------------------------------------------------------------------
BTEOBJ := bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
#---------------------------------------------------------------------------------
WIIUSEOBJ := classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
nunchuk.o wiiboard.o wiiuse.o speaker.o wpad.o motion_plus.o
#---------------------------------------------------------------------------------
TINYSMBOBJ := des.o md4.o ntlm.o smb.o smb_devoptab.o
#---------------------------------------------------------------------------------
ASNDLIBOBJ := asndlib.o mp3player.o
#---------------------------------------------------------------------------------
AESNDLIBOBJ := aesndlib.o aesndmp3player.o
#---------------------------------------------------------------------------------
ISOLIBOBJ := iso9660.o
#---------------------------------------------------------------------------------
WIIKEYBLIBOBJ := usbkeyboard.o keyboard.o ukbdmap.o wskbdutil.o
all: wii cube
#---------------------------------------------------------------------------------
wii: gc/ogc/libversion.h
#---------------------------------------------------------------------------------
@[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
@[ -d $(LIBS)/wii ] || mkdir -p $(LIBS)/wii
@[ -d $(DEPS)/wii ] || mkdir -p $(DEPS)/wii
@[ -d wii ] || mkdir -p wii
@$(MAKE) PLATFORM=wii libs -C wii -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
cube: gc/ogc/libversion.h
#---------------------------------------------------------------------------------
@[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
@[ -d $(LIBS)/cube ] || mkdir -p $(LIBS)/cube
@[ -d $(DEPS)/cube ] || mkdir -p $(DEPS)/cube
@[ -d cube ] || mkdir -p cube
@$(MAKE) PLATFORM=cube libs -C cube -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
gc/ogc/libversion.h : Makefile
#---------------------------------------------------------------------------------
@echo "#ifndef __OGC_LIBVERSION_H__" > $@
@echo "#define __OGC_LIBVERSION_H__" >> $@
@echo >> $@
@echo "#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
@echo "#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
@echo "#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
@echo >> $@
@echo "#define _V_DATE_ __DATE__" >> $@
@echo "#define _V_TIME_ __TIME__" >> $@
@echo >> $@
@echo '#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)'"' >> $@
@echo >> $@
@echo "#endif // __OGC_LIBVERSION_H__" >> $@
#---------------------------------------------------------------------------------
asndlib.o: asnd_dsp_mixer.h
#---------------------------------------------------------------------------------
aesndlib.o: aesnddspmixer.h
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
asnd_dsp_mixer.h: $(LIBASNDDIR)/dsp_mixer/dsp_mixer.s
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@gcdsptool -c $< -o $@
#---------------------------------------------------------------------------------
aesnddspmixer.h: $(LIBAESNDDIR)/dspcode/dspmixer.s
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@gcdsptool -c $< -o $@
#---------------------------------------------------------------------------------
$(BBALIB).a: $(LWIPOBJ)
#---------------------------------------------------------------------------------
$(OGCLIB).a: $(OGCOBJ)
#---------------------------------------------------------------------------------
$(MODLIB).a: $(MODOBJ)
#---------------------------------------------------------------------------------
$(DBLIB).a: $(DBOBJ)
#---------------------------------------------------------------------------------
$(DILIB).a: $(DIOBJ)
#---------------------------------------------------------------------------------
$(TINYSMBLIB).a: $(TINYSMBOBJ)
#---------------------------------------------------------------------------------
$(ASNDLIB).a: $(ASNDLIBOBJ)
#---------------------------------------------------------------------------------
$(AESNDLIB).a: $(AESNDLIBOBJ)
#---------------------------------------------------------------------------------
$(ISOLIB).a: $(ISOLIBOBJ)
#---------------------------------------------------------------------------------
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
#---------------------------------------------------------------------------------
$(BTELIB).a: $(BTEOBJ)
#---------------------------------------------------------------------------------
$(WIIUSELIB).a: $(WIIUSEOBJ)
#---------------------------------------------------------------------------------
.PHONY: libs wii cube install-headers install uninstall dist docs
#---------------------------------------------------------------------------------
install-headers:
#---------------------------------------------------------------------------------
@mkdir -p $(INCDIR)
@mkdir -p $(INCDIR)/ogc/machine
@mkdir -p $(INCDIR)/sys
@mkdir -p $(INCDIR)/bte
@mkdir -p $(INCDIR)/wiiuse
@mkdir -p $(INCDIR)/modplay
@mkdir -p $(INCDIR)/sdcard
@mkdir -p $(INCDIR)/di
@mkdir -p $(INCDIR)/wiikeyboard
@cp ./gc/*.h $(INCDIR)
@cp ./gc/ogc/*.h $(INCDIR)/ogc
@cp ./gc/ogc/machine/*.h $(INCDIR)/ogc/machine
@cp ./gc/sys/*.h $(INCDIR)/sys
@cp ./gc/bte/*.h $(INCDIR)/bte
@cp ./gc/wiiuse/*.h $(INCDIR)/wiiuse
@cp ./gc/modplay/*.h $(INCDIR)/modplay
@cp ./gc/sdcard/*.h $(INCDIR)/sdcard
@cp ./gc/di/*.h $(INCDIR)/di
@cp ./gc/wiikeyboard/*.h $(INCDIR)/wiikeyboard
#---------------------------------------------------------------------------------
install: wii cube install-headers
#---------------------------------------------------------------------------------
@mkdir -p $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv include $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv lib $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv libogc_license.txt $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv gamecube_rules wii_rules $(DESTDIR)$(DEVKITPRO)/libogc2
#---------------------------------------------------------------------------------
uninstall:
#---------------------------------------------------------------------------------
@rm -frv $(DESTDIR)$(DEVKITPRO)/libogc2
#---------------------------------------------------------------------------------
dist: wii cube install-headers
#---------------------------------------------------------------------------------
@tar --exclude=*CVS* --exclude=.svn --exclude=wii --exclude=cube --exclude=*deps* \
--exclude=*.bz2 --exclude=*include* --exclude=*lib/* --exclude=*docs/*\
-cvjf libogc2-src-$(VERSTRING).tar.bz2 *
@tar -cvjf libogc2-$(VERSTRING).tar.bz2 include lib libogc_license.txt gamecube_rules wii_rules
LIBRARIES := $(OGCLIB).a $(MODLIB).a $(DBLIB).a $(TINYSMBLIB).a $(ASNDLIB).a $(AESNDLIB).a $(ISOLIB).a
ifeq ($(PLATFORM),cube)
LIBRARIES += $(BBALIB).a
endif
ifeq ($(PLATFORM),wii)
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(DILIB).a $(WIIKEYBLIB).a
endif
#---------------------------------------------------------------------------------
libs: $(LIBRARIES)
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
rm -fr wii cube
rm -fr $(DEPS)
rm -fr $(LIBS)
rm -fr $(INCDIR)
rm -f *.map
#---------------------------------------------------------------------------------
docs: install-headers
#---------------------------------------------------------------------------------
VERSTRING="$(VERSTRING)" doxygen Doxyfile
-include $(DEPSDIR)/*.d