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 LIBWIIKEYB
:= $(BASEDIR
)/libwiikeyboard
53 export STUBSDIR
:= $(BASEDIR
)/lockstubs
54 export DEPS
:= $(BASEDIR
)/deps
55 export LIBS
:= $(BASEDIR
)/lib
57 export INCDIR
:= $(BASEDIR
)/include
59 #---------------------------------------------------------------------------------
61 #---------------------------------------------------------------------------------
63 export LIBDIR
:= $(LIBS
)/$(PLATFORM
)
64 export DEPSDIR
:= $(DEPS
)/$(PLATFORM
)
66 #---------------------------------------------------------------------------------
68 #---------------------------------------------------------------------------------
71 #---------------------------------------------------------------------------------
72 BBALIB
:= $(LIBDIR
)/libbba
73 OGCLIB
:= $(LIBDIR
)/libogc
74 MODLIB
:= $(LIBDIR
)/libmodplay
75 MADLIB
:= $(LIBDIR
)/libmad
76 DBLIB
:= $(LIBDIR
)/libdb
77 DILIB
:= $(LIBDIR
)/libdi
78 BTELIB
:= $(LIBDIR
)/libbte
79 WIIUSELIB
:= $(LIBDIR
)/libwiiuse
80 TINYSMBLIB
:= $(LIBDIR
)/libtinysmb
81 ZLIB
:= $(LIBDIR
)/libz
82 ASNDLIB
:= $(LIBDIR
)/libasnd
83 WIIKEYBLIB
:= $(LIBDIR
)/libwiikeyboard
84 STUBSLIB
:= $(LIBDIR
)/libgclibstubs
86 #---------------------------------------------------------------------------------
87 DEFINCS
:= -I
$(BASEDIR
) -I
$(BASEDIR
)/gc
88 INCLUDES
:= $(DEFINCS
) -I
$(BASEDIR
)/gc
/netif
-I
$(BASEDIR
)/gc
/ipv4 \
89 -I
$(BASEDIR
)/gc
/ogc
-I
$(BASEDIR
)/gc
/ogc
/machine \
90 -I
$(BASEDIR
)/gc
/modplay
-I
$(BASEDIR
)/gc
/mad \
91 -I
$(BASEDIR
)/gc
/z
-I
$(BASEDIR
)/gc
/bte \
92 -I
$(BASEDIR
)/gc
/sdcard
-I
$(BASEDIR
)/gc
/wiiuse \
95 MACHDEP
:= -DBIGENDIAN
-DGEKKO
-mcpu
=750 -meabi
-msdata
=eabi
-mhard-float
-fmodulo-sched
-ffunction-sections
-fdata-sections
97 ifeq ($(PLATFORM
),wii
)
101 ifeq ($(PLATFORM
),cube
)
105 CFLAGS
:= -DLIBOGC_INTERNAL
-DGAMECUBE
-O2
-Wall
$(MACHDEP
) -fno-strict-aliasing
$(INCLUDES
)
108 #---------------------------------------------------------------------------------
109 VPATH
:= $(LWIPDIR
) \
111 $(LWIPDIR
)/arch
/gc
/netif \
113 $(LWIPDIR
)/core
/ipv4 \
132 #---------------------------------------------------------------------------------
133 LWIPOBJ
:= network.o netio.o gcif.o \
134 inet.o mem.o dhcp.o raw.o \
135 memp.o netif.o pbuf.o stats.o \
136 sys.o tcp.o tcp_in.o tcp_out.o \
137 udp.o icmp.o ip.o ip_frag.o \
138 ip_addr.o etharp.o loopif.o
140 #---------------------------------------------------------------------------------
142 console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
143 lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
144 lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
145 exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
146 video_asm.o video.o pad.o dvd.o exi.o mutex.o arqueue.o arqmgr.o \
147 cache_asm.o system.o system_asm.o cond.o \
148 gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
149 message.o card.o aram.o depackrnc.o decrementer_handler.o \
150 depackrnc1.o dsp.o si.o tpl.o ipc.o ogc_crt0.o \
151 console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o \
152 sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
153 sdgecko_io.o sdgecko_buf.o gcsd.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
154 texconv.o wiilaunch.o
156 #---------------------------------------------------------------------------------
157 MODOBJ
:= freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
159 #---------------------------------------------------------------------------------
160 MADOBJ
:= mp3player.o bit.o decoder.o fixed.o frame.o huffman.o \
161 layer12.o layer3.o stream.o synth.o timer.o \
164 #---------------------------------------------------------------------------------
165 DBOBJ
:= uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
166 uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
167 debug_supp.o geckousb.o
168 #---------------------------------------------------------------------------------
169 DIOBJ
:= di.o di_read.o stubasm.o stubload.o di_iso9660.o
171 #---------------------------------------------------------------------------------
172 BTEOBJ
:= bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
174 #---------------------------------------------------------------------------------
175 WIIUSEOBJ
:= classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
176 nunchuk.o wiiboard.o wiiuse.o wpad.o
178 #---------------------------------------------------------------------------------
179 TINYSMBOBJ
:= des.o md4.o ntlm.o smb.o smb_devoptab.o
181 #---------------------------------------------------------------------------------
182 ZLIBOBJ
:= adler32.o compress.o crc32.o gzio.o uncompr.o \
183 deflate.o trees.o zutil.o inflate.o infback.o \
186 #---------------------------------------------------------------------------------
187 ASNDLIBOBJ
:= asndlib.o
189 #---------------------------------------------------------------------------------
190 WIIKEYBLIBOBJ
:= keyboard.o usbkeyboard.o
192 #---------------------------------------------------------------------------------
194 #---------------------------------------------------------------------------------
196 #---------------------------------------------------------------------------------
198 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
200 #---------------------------------------------------------------------------------
202 #---------------------------------------------------------------------------------
204 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
206 #---------------------------------------------------------------------------------
208 #---------------------------------------------------------------------------------
210 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -D_LANGUAGE_ASSEMBLY
-Wa
,-mgekko
-c
$< -o
$@
212 #---------------------------------------------------------------------------------
214 #---------------------------------------------------------------------------------
216 @
$(AS
) -mgekko
-Qy
$< -o
$@
218 #---------------------------------------------------------------------------------
220 #---------------------------------------------------------------------------------
225 #---------------------------------------------------------------------------------
226 wii
: gc
/ogc
/libversion.h
227 #---------------------------------------------------------------------------------
228 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
229 @
[ -d
$(LIBS
)/wii
] || mkdir
-p
$(LIBS
)/wii
230 @
[ -d
$(DEPS
)/wii
] || mkdir
-p
$(DEPS
)/wii
231 @
[ -d wii
] || mkdir
-p wii
232 @
$(MAKE
) PLATFORM
=wii libs
-C wii
-f
$(CURDIR
)/Makefile
234 #---------------------------------------------------------------------------------
235 cube
: gc
/ogc
/libversion.h
236 #---------------------------------------------------------------------------------
237 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
238 @
[ -d
$(LIBS
)/cube
] || mkdir
-p
$(LIBS
)/cube
239 @
[ -d
$(DEPS
)/cube
] || mkdir
-p
$(DEPS
)/cube
240 @
[ -d cube
] || mkdir
-p cube
241 @
$(MAKE
) PLATFORM
=cube libs
-C cube
-f
$(CURDIR
)/Makefile
244 #---------------------------------------------------------------------------------
245 gc
/ogc
/libversion.h
: Makefile
246 #---------------------------------------------------------------------------------
247 @echo
"#ifndef __LIBVERSION_H__" > $@
248 @echo
"#define __LIBVERSION_H__" >> $@
250 @echo
"#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
251 @echo
"#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
252 @echo
"#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
254 @echo
"#define _V_DATE_ __DATE__" >> $@
255 @echo
"#define _V_TIME_ __TIME__" >> $@
257 @echo
'#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)'"' >> $@
259 @echo
"#endif // __LIBVERSION_H__" >> $@
261 #---------------------------------------------------------------------------------
262 $(BBALIB
).a
: $(LWIPOBJ
)
263 #---------------------------------------------------------------------------------
264 $(OGCLIB
).a
: $(OGCOBJ
)
265 #---------------------------------------------------------------------------------
266 $(MP3LIB
).a
: $(MP3OBJ
)
267 #---------------------------------------------------------------------------------
268 $(MODLIB
).a
: $(MODOBJ
)
269 #---------------------------------------------------------------------------------
270 $(MADLIB
).a
: $(MADOBJ
)
271 #---------------------------------------------------------------------------------
273 #---------------------------------------------------------------------------------
275 #---------------------------------------------------------------------------------
276 $(TINYSMBLIB
).a
: $(TINYSMBOBJ
)
277 #---------------------------------------------------------------------------------
278 $(ZLIB
).a
: $(ZLIBOBJ
)
279 #---------------------------------------------------------------------------------
280 $(ASNDLIB
).a
: $(ASNDLIBOBJ
)
281 #---------------------------------------------------------------------------------
282 $(WIIKEYBLIB
).a
: $(WIIKEYBLIBOBJ
)
283 #---------------------------------------------------------------------------------
284 $(BTELIB
).a
: $(BTEOBJ
)
285 #---------------------------------------------------------------------------------
286 $(WIIUSELIB
).a
: $(WIIUSEOBJ
)
287 #---------------------------------------------------------------------------------
289 .PHONY
: libs wii cube install-headers
install dist docs
291 #---------------------------------------------------------------------------------
293 #---------------------------------------------------------------------------------
295 @mkdir
-p
$(INCDIR
)/ogc
/machine
296 @mkdir
-p
$(INCDIR
)/bte
297 @mkdir
-p
$(INCDIR
)/wiiuse
298 @mkdir
-p
$(INCDIR
)/modplay
299 @mkdir
-p
$(INCDIR
)/mad
300 @mkdir
-p
$(INCDIR
)/sdcard
301 @mkdir
-p
$(INCDIR
)/di
302 @mkdir
-p
$(INCDIR
)/wiikeyboard
303 @cp .
/gc
/*.h
$(INCDIR
)
304 @cp .
/gc
/ogc
/*.h
$(INCDIR
)/ogc
305 @cp .
/gc
/ogc
/machine
/*.h
$(INCDIR
)/ogc
/machine
306 @cp .
/gc
/bte
/*.h
$(INCDIR
)/bte
307 @cp .
/gc
/wiiuse
/*.h
$(INCDIR
)/wiiuse
308 @cp .
/gc
/modplay
/*.h
$(INCDIR
)/modplay
309 @cp .
/gc
/mad
/*.h
$(INCDIR
)/mad
310 @cp .
/gc
/sdcard
/*.h
$(INCDIR
)/sdcard
311 @cp .
/gc
/di
/*.h
$(INCDIR
)/di
312 @cp .
/gc
/wiikeyboard
/*.h
$(INCDIR
)/wiikeyboard
314 #---------------------------------------------------------------------------------
315 install: install-headers
316 #---------------------------------------------------------------------------------
317 @mkdir
-p
$(DEVKITPRO
)/libogc
318 @cp
-frv
include $(DEVKITPRO
)/libogc
319 @cp
-frv lib
$(DEVKITPRO
)/libogc
320 @cp
-frv libogc_license.txt
$(DEVKITPRO
)/libogc
323 #---------------------------------------------------------------------------------
324 dist: install-headers
325 #---------------------------------------------------------------------------------
326 @
tar --exclude
=*CVS
* --exclude
=wii
--exclude
=cube
--exclude
=*deps
* \
327 --exclude
=*.bz2
--exclude
=*include* --exclude
=*lib
/* --exclude
=*docs
/*\
328 -cvjf libogc-src-
$(VERSTRING
).
tar.bz2
*
329 @
tar -cvjf libogc-
$(VERSTRING
).
tar.bz2
include lib libogc_license.txt
332 LIBRARIES
:= $(OGCLIB
).a
$(MODLIB
).a
$(MADLIB
).a
$(DBLIB
).a
$(ZLIB
).a
$(TINYSMBLIB
).a
$(ASNDLIB
).a
334 ifeq ($(PLATFORM
),cube
)
335 LIBRARIES
+= $(BBALIB
).a
337 ifeq ($(PLATFORM
),wii
)
338 LIBRARIES
+= $(BTELIB
).a
$(WIIUSELIB
).a
$(DILIB
).a
$(WIIKEYBLIB
).a
341 #---------------------------------------------------------------------------------
343 #---------------------------------------------------------------------------------
345 #---------------------------------------------------------------------------------
347 #---------------------------------------------------------------------------------
354 #---------------------------------------------------------------------------------
355 docs
: install-headers
356 #---------------------------------------------------------------------------------
359 -include $(DEPSDIR
)/*.d