1 #---------------------------------------------------------------------------------
3 #---------------------------------------------------------------------------------
5 ifeq ($(strip $(DEVKITPRO
)),)
6 $(error
"Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
9 ifeq ($(strip $(DEVKITPPC
)),)
10 $(error
"Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
13 export PATH
:= $(DEVKITPPC
)/bin
:$(PATH
)
15 export LIBOGC_MAJOR
:= 1
16 export LIBOGC_MINOR
:= 7
17 export LIBOGC_PATCH
:= 1
19 #---------------------------------------------------------------------------------
20 PREFIX
:= powerpc-gekko
21 #---------------------------------------------------------------------------------
28 OBJCOPY
:= $(PREFIX
)-objcopy
32 GCC_VERSION
:= $(shell $(DEVKITPPC
)/bin
/$(CC
) -dumpversion
)
33 DATESTRING
:= $(shell date
+%Y
%m
%d
)
34 VERSTRING
:= $(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)
36 #---------------------------------------------------------------------------------
37 ifeq ($(strip $(PLATFORM
)),)
38 #---------------------------------------------------------------------------------
39 export BASEDIR
:= $(CURDIR
)
40 export LWIPDIR
:= $(BASEDIR
)/lwip
41 export OGCDIR
:= $(BASEDIR
)/libogc
42 export MODDIR
:= $(BASEDIR
)/libmodplay
43 export MADDIR
:= $(BASEDIR
)/libmad
44 export SAMPLEDIR
:= $(BASEDIR
)/libsamplerate
45 export DBDIR
:= $(BASEDIR
)/libdb
46 export DIDIR
:= $(BASEDIR
)/libdi
47 export BTEDIR
:= $(BASEDIR
)/lwbt
48 export WIIUSEDIR
:= $(BASEDIR
)/wiiuse
49 export TINYSMBDIR
:= $(BASEDIR
)/libtinysmb
50 export LIBZDIR
:= $(BASEDIR
)/libz
51 export LIBASNDDIR
:= $(BASEDIR
)/libasnd
52 export STUBSDIR
:= $(BASEDIR
)/lockstubs
53 export DEPS
:= $(BASEDIR
)/deps
54 export LIBS
:= $(BASEDIR
)/lib
56 export INCDIR
:= $(BASEDIR
)/include
58 #---------------------------------------------------------------------------------
60 #---------------------------------------------------------------------------------
62 export LIBDIR
:= $(LIBS
)/$(PLATFORM
)
63 export DEPSDIR
:= $(DEPS
)/$(PLATFORM
)
65 #---------------------------------------------------------------------------------
67 #---------------------------------------------------------------------------------
70 #---------------------------------------------------------------------------------
71 BBALIB
:= $(LIBDIR
)/libbba
72 OGCLIB
:= $(LIBDIR
)/libogc
73 MODLIB
:= $(LIBDIR
)/libmodplay
74 MADLIB
:= $(LIBDIR
)/libmad
75 DBLIB
:= $(LIBDIR
)/libdb
76 DILIB
:= $(LIBDIR
)/libdi
77 BTELIB
:= $(LIBDIR
)/libbte
78 WIIUSELIB
:= $(LIBDIR
)/libwiiuse
79 TINYSMBLIB
:= $(LIBDIR
)/libtinysmb
80 ZLIB
:= $(LIBDIR
)/libz
81 ASNDLIB
:= $(LIBDIR
)/libasnd
82 STUBSLIB
:= $(LIBDIR
)/libgclibstubs
84 #---------------------------------------------------------------------------------
85 DEFINCS
:= -I
$(BASEDIR
) -I
$(BASEDIR
)/gc
86 INCLUDES
:= $(DEFINCS
) -I
$(BASEDIR
)/gc
/netif
-I
$(BASEDIR
)/gc
/ipv4 \
87 -I
$(BASEDIR
)/gc
/ogc
-I
$(BASEDIR
)/gc
/ogc
/machine \
88 -I
$(BASEDIR
)/gc
/modplay
-I
$(BASEDIR
)/gc
/mad \
89 -I
$(BASEDIR
)/gc
/z
-I
$(BASEDIR
)/gc
/bte \
90 -I
$(BASEDIR
)/gc
/sdcard
-I
$(BASEDIR
)/gc
/wiiuse \
93 MACHDEP
:= -DBIGENDIAN
-DGEKKO
-mcpu
=750 -meabi
-msdata
=eabi
-mhard-float
-fmodulo-sched
-ffunction-sections
-fdata-sections
95 ifeq ($(PLATFORM
),wii
)
99 ifeq ($(PLATFORM
),cube
)
103 CFLAGS
:= -DLIBOGC_INTERNAL
-DGAMECUBE
-O2
-Wall
$(MACHDEP
) -fno-strict-aliasing
$(INCLUDES
)
106 #---------------------------------------------------------------------------------
107 VPATH
:= $(LWIPDIR
) \
109 $(LWIPDIR
)/arch
/gc
/netif \
111 $(LWIPDIR
)/core
/ipv4 \
129 #---------------------------------------------------------------------------------
130 LWIPOBJ
:= network.o netio.o gcif.o \
131 inet.o mem.o dhcp.o raw.o \
132 memp.o netif.o pbuf.o stats.o \
133 sys.o tcp.o tcp_in.o tcp_out.o \
134 udp.o icmp.o ip.o ip_frag.o \
135 ip_addr.o etharp.o loopif.o
137 #---------------------------------------------------------------------------------
139 console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
140 lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
141 lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
142 exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
143 video_asm.o video.o pad.o dvd.o exi.o mutex.o arqueue.o arqmgr.o \
144 cache_asm.o system.o system_asm.o cond.o \
145 gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
146 message.o card.o aram.o depackrnc.o decrementer_handler.o \
147 depackrnc1.o dsp.o si.o tpl.o ipc.o ogc_crt0.o \
148 console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o \
149 sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
150 sdgecko_io.o sdgecko_buf.o gcsd.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
151 texconv.o wiilaunch.o
153 #---------------------------------------------------------------------------------
154 MODOBJ
:= freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
156 #---------------------------------------------------------------------------------
157 MADOBJ
:= mp3player.o bit.o decoder.o fixed.o frame.o huffman.o \
158 layer12.o layer3.o stream.o synth.o timer.o \
161 #---------------------------------------------------------------------------------
162 DBOBJ
:= uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
163 uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
164 debug_supp.o geckousb.o
165 #---------------------------------------------------------------------------------
166 DIOBJ
:= di.o di_read.o stubasm.o stubload.o
168 #---------------------------------------------------------------------------------
169 BTEOBJ
:= bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
171 #---------------------------------------------------------------------------------
172 WIIUSEOBJ
:= classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
173 nunchuk.o wiiboard.o wiiuse.o wpad.o
175 #---------------------------------------------------------------------------------
176 TINYSMBOBJ
:= des.o md4.o ntlm.o smb.o smb_devoptab.o
178 #---------------------------------------------------------------------------------
179 ZLIBOBJ
:= adler32.o compress.o crc32.o gzio.o uncompr.o \
180 deflate.o trees.o zutil.o inflate.o infback.o \
183 #---------------------------------------------------------------------------------
184 ASNDLIBOBJ
:= asndlib.o
186 #---------------------------------------------------------------------------------
188 #---------------------------------------------------------------------------------
190 #---------------------------------------------------------------------------------
192 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
194 #---------------------------------------------------------------------------------
196 #---------------------------------------------------------------------------------
198 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
200 #---------------------------------------------------------------------------------
202 #---------------------------------------------------------------------------------
204 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -D_LANGUAGE_ASSEMBLY
-Wa
,-mgekko
-c
$< -o
$@
206 #---------------------------------------------------------------------------------
208 #---------------------------------------------------------------------------------
210 @
$(AS
) -mgekko
-Qy
$< -o
$@
212 #---------------------------------------------------------------------------------
214 #---------------------------------------------------------------------------------
219 #---------------------------------------------------------------------------------
220 wii
: gc
/ogc
/libversion.h
221 #---------------------------------------------------------------------------------
222 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
223 @
[ -d
$(LIBS
)/wii
] || mkdir
-p
$(LIBS
)/wii
224 @
[ -d
$(DEPS
)/wii
] || mkdir
-p
$(DEPS
)/wii
225 @
[ -d wii
] || mkdir
-p wii
226 @
$(MAKE
) PLATFORM
=wii libs
-C wii
-f
$(CURDIR
)/Makefile
228 #---------------------------------------------------------------------------------
229 cube
: gc
/ogc
/libversion.h
230 #---------------------------------------------------------------------------------
231 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
232 @
[ -d
$(LIBS
)/cube
] || mkdir
-p
$(LIBS
)/cube
233 @
[ -d
$(DEPS
)/cube
] || mkdir
-p
$(DEPS
)/cube
234 @
[ -d cube
] || mkdir
-p cube
235 @
$(MAKE
) PLATFORM
=cube libs
-C cube
-f
$(CURDIR
)/Makefile
238 #---------------------------------------------------------------------------------
239 gc
/ogc
/libversion.h
: Makefile
240 #---------------------------------------------------------------------------------
241 @echo
"#ifndef __LIBVERSION_H__" > $@
242 @echo
"#define __LIBVERSION_H__" >> $@
244 @echo
"#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
245 @echo
"#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
246 @echo
"#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
248 @echo
"#define _V_DATE_ __DATE__" >> $@
249 @echo
"#define _V_TIME_ __TIME__" >> $@
251 @echo
'#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)'"' >> $@
253 @echo
"#endif // __LIBVERSION_H__" >> $@
255 #---------------------------------------------------------------------------------
256 $(BBALIB
).a
: $(LWIPOBJ
)
257 #---------------------------------------------------------------------------------
258 $(OGCLIB
).a
: $(OGCOBJ
)
259 #---------------------------------------------------------------------------------
260 $(MP3LIB
).a
: $(MP3OBJ
)
261 #---------------------------------------------------------------------------------
262 $(MODLIB
).a
: $(MODOBJ
)
263 #---------------------------------------------------------------------------------
264 $(MADLIB
).a
: $(MADOBJ
)
265 #---------------------------------------------------------------------------------
267 #---------------------------------------------------------------------------------
269 #---------------------------------------------------------------------------------
270 $(TINYSMBLIB
).a
: $(TINYSMBOBJ
)
271 #---------------------------------------------------------------------------------
272 $(ZLIB
).a
: $(ZLIBOBJ
)
273 #---------------------------------------------------------------------------------
274 $(ASNDLIB
).a
: $(ASNDLIBOBJ
)
275 #---------------------------------------------------------------------------------
276 $(BTELIB
).a
: $(BTEOBJ
)
277 #---------------------------------------------------------------------------------
278 $(WIIUSELIB
).a
: $(WIIUSEOBJ
)
279 #---------------------------------------------------------------------------------
281 .PHONY
: libs wii cube install-headers
install dist docs
283 #---------------------------------------------------------------------------------
285 #---------------------------------------------------------------------------------
287 @mkdir
-p
$(INCDIR
)/ogc
/machine
288 @mkdir
-p
$(INCDIR
)/bte
289 @mkdir
-p
$(INCDIR
)/wiiuse
290 @mkdir
-p
$(INCDIR
)/modplay
291 @mkdir
-p
$(INCDIR
)/mad
292 @mkdir
-p
$(INCDIR
)/sdcard
293 @mkdir
-p
$(INCDIR
)/di
294 @cp .
/gc
/*.h
$(INCDIR
)
295 @cp .
/gc
/ogc
/*.h
$(INCDIR
)/ogc
296 @cp .
/gc
/ogc
/machine
/*.h
$(INCDIR
)/ogc
/machine
297 @cp .
/gc
/bte
/*.h
$(INCDIR
)/bte
298 @cp .
/gc
/wiiuse
/*.h
$(INCDIR
)/wiiuse
299 @cp .
/gc
/modplay
/*.h
$(INCDIR
)/modplay
300 @cp .
/gc
/mad
/*.h
$(INCDIR
)/mad
301 @cp .
/gc
/sdcard
/*.h
$(INCDIR
)/sdcard
302 @cp .
/gc
/di
/*.h
$(INCDIR
)/di
304 #---------------------------------------------------------------------------------
305 install: install-headers
306 #---------------------------------------------------------------------------------
307 @mkdir
-p
$(DEVKITPRO
)/libogc
308 @cp
-frv
include $(DEVKITPRO
)/libogc
309 @cp
-frv lib
$(DEVKITPRO
)/libogc
310 @cp
-frv libogc_license.txt
$(DEVKITPRO
)/libogc
313 #---------------------------------------------------------------------------------
314 dist: install-headers
315 #---------------------------------------------------------------------------------
316 @
tar --exclude
=*CVS
* --exclude
=wii
--exclude
=cube
--exclude
=*deps
* \
317 --exclude
=*.bz2
--exclude
=*include* --exclude
=*lib
/* --exclude
=*docs
/*\
318 -cvjf libogc-src-
$(VERSTRING
).
tar.bz2
*
319 @
tar -cvjf libogc-
$(VERSTRING
).
tar.bz2
include lib libogc_license.txt
322 LIBRARIES
:= $(OGCLIB
).a
$(MODLIB
).a
$(MADLIB
).a
$(DBLIB
).a
$(ZLIB
).a
$(TINYSMBLIB
).a
$(ASNDLIB
).a
324 ifeq ($(PLATFORM
),cube
)
325 LIBRARIES
+= $(BBALIB
).a
327 ifeq ($(PLATFORM
),wii
)
328 LIBRARIES
+= $(BTELIB
).a
$(WIIUSELIB
).a
$(DILIB
).a
331 #---------------------------------------------------------------------------------
333 #---------------------------------------------------------------------------------
335 #---------------------------------------------------------------------------------
337 #---------------------------------------------------------------------------------
344 #---------------------------------------------------------------------------------
345 docs
: install-headers
346 #---------------------------------------------------------------------------------
349 -include $(DEPSDIR
)/*.d