forked from libretro/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.libogc
268 lines (219 loc) · 9.86 KB
/
Makefile.libogc
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
#---------------------------------------------------------------------------------
.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 := 1
export LIBOGC_MINOR := 8
export LIBOGC_PATCH := 17
include $(DEVKITPPC)/base_rules
BUILD := build
BUILD_LITE = 1
DATESTRING := $(shell date +%Y%m%d)
VERSTRING := $(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)
#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
export DBDIR := $(BASEDIR)/wii/libogc/libdb
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
export LIBS := $(BASEDIR)/wii/libogc/libs
export INCDIR := $(BASEDIR)/wii/libogc/include
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
BBALIB := $(LIBDIR)/libbba
OGCLIB := $(LIBDIR)/libogc
DBLIB := $(LIBDIR)/libdb
BTELIB := $(LIBDIR)/libbte
WIIUSELIB := $(LIBDIR)/libwiiuse
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
STUBSLIB := $(LIBDIR)/libgclibstubs
#---------------------------------------------------------------------------------
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
DEFINCS := -I$(DEFAULTINCDIR)
INCLUDES := $(DEFINCS) \
-I$(BASEDIR)/wii/libogc \
-I$(DEFAULTINCDIR)/netif \
-I$(DEFAULTINCDIR)/ipv4 \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/ogc \
-I$(DEFAULTINCDIR)/ogc/machine \
-I$(DEFAULTINCDIR)/bte \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/wiikeyboard \
-I$(DEFAULTINCDIR)/wiiuse \
-I$(DEFAULTINCDIR)/di
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
MACHDEP += -DHW_RVL
endif
ifeq ($(PLATFORM),cube)
MACHDEP += -DHW_DOL
endif
CFLAGS := -DLIBOGC_INTERNAL -g -O2 -fno-strict-aliasing -mregnames -Wall $(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) \
$(DBDIR) \
$(DBDIR)/uIP \
$(BTEDIR) \
$(WIIUSEDIR) \
$(SDCARDDIR) \
$(LIBWIIKEYB) \
$(STUBSDIR)
#---------------------------------------------------------------------------------
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
#---------------------------------------------------------------------------------
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 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
ifneq ($(BUILD_LITE), 1)
OGCOBJ += dvd.o
endif
#---------------------------------------------------------------------------------
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
#---------------------------------------------------------------------------------
BTEOBJ := bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
#---------------------------------------------------------------------------------
WIIUSEOBJ := classic.o dynamics.o events.o io.o io_wii.o ir.o \
nunchuk.o wiiuse.o speaker.o wpad.o motion_plus.o
#---------------------------------------------------------------------------------
WIIKEYBLIBOBJ := usbkeyboard.o keyboard.o ukbdmap.o wskbdutil.o
all: wii cube
#---------------------------------------------------------------------------------
wii: $(BASEDIR)/wii/libogc/include/ogc/libversion.h
#---------------------------------------------------------------------------------
@[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
@[ -d $(LIBS)/wii ] || mkdir -p $(LIBS)/wii
@[ -d wii ] || mkdir -p wii
@$(MAKE) PLATFORM=wii libs -C wii -f $(CURDIR)/Makefile.libogc
#---------------------------------------------------------------------------------
cube: $(BASEDIR)/wii/libogc/include/ogc/libversion.h
#---------------------------------------------------------------------------------
@[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
@[ -d $(LIBS)/cube ] || mkdir -p $(LIBS)/cube
@[ -d cube ] || mkdir -p cube
@$(MAKE) PLATFORM=cube libs -C cube -f $(CURDIR)/Makefile.libogc
#---------------------------------------------------------------------------------
$(BASEDIR)/wii/libogc/include/ogc/libversion.h : Makefile.libogc
#---------------------------------------------------------------------------------
@echo "#ifndef __LIBVERSION_H__" > $@
@echo "#define __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 // __LIBVERSION_H__" >> $@
#---------------------------------------------------------------------------------
$(BBALIB).a: $(LWIPOBJ)
#---------------------------------------------------------------------------------
$(OGCLIB).a: $(OGCOBJ)
#---------------------------------------------------------------------------------
$(DBLIB).a: $(DBOBJ)
#---------------------------------------------------------------------------------
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
#---------------------------------------------------------------------------------
$(BTELIB).a: $(BTEOBJ)
#---------------------------------------------------------------------------------
$(WIIUSELIB).a: $(WIIUSEOBJ)
#---------------------------------------------------------------------------------
.PHONY: libs wii cube install-headers install dist docs
#---------------------------------------------------------------------------------
install-headers:
#---------------------------------------------------------------------------------
@mkdir -p $(INCDIR)
@mkdir -p $(INCDIR)/ogc/machine
@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/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 $(DEVKITPRO)/libogc
@cp -frv include $(DEVKITPRO)/libogc
@cp -frv lib $(DEVKITPRO)/libogc
@cp -frv libogc_license.txt $(DEVKITPRO)/libogc
#---------------------------------------------------------------------------------
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 libogc-src-$(VERSTRING).tar.bz2 *
@tar -cvjf libogc-$(VERSTRING).tar.bz2 include lib libogc_license.txt
LIBRARIES := $(OGCLIB).a $(DBLIB).a
ifeq ($(PLATFORM),cube)
LIBRARIES += $(BBALIB).a
endif
ifeq ($(PLATFORM),wii)
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
endif
#---------------------------------------------------------------------------------
libs: $(LIBRARIES)
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
rm -fr $(BASEDIR)/wii/*.o
rm -f *.map
#---------------------------------------------------------------------------------
docs: install-headers
#---------------------------------------------------------------------------------
doxygen libogc.dox