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
:= 6
17 export LIBOGC_PATCH
:= 0
19 #---------------------------------------------------------------------------------
20 PREFIX
:= powerpc-gekko
21 #---------------------------------------------------------------------------------
28 OBJCOPY
:= $(PREFIX
)-objcopy
32 GCC_VERSION
:= $(shell $(DEVKITPPC
)/bin
/$(CC
) -dumpversion
)
33 DATESTRING
:= $(shell date
+%Y
)$(shell date
+%m
)$(shell date
+%d
)
35 #---------------------------------------------------------------------------------
36 ifeq ($(strip $(PLATFORM
)),)
37 #---------------------------------------------------------------------------------
38 export BASEDIR
:= $(CURDIR
)
39 export LWIPDIR
:= $(BASEDIR
)/lwip
40 export OGCDIR
:= $(BASEDIR
)/libogc
41 export MODDIR
:= $(BASEDIR
)/libmodplay
42 export MADDIR
:= $(BASEDIR
)/libmad
43 export SAMPLEDIR
:= $(BASEDIR
)/libsamplerate
44 export DBDIR
:= $(BASEDIR
)/libdb
45 export BTEDIR
:= $(BASEDIR
)/lwbt
46 export WIIUSEDIR
:= $(BASEDIR
)/wiiuse
47 export TINYSMBDIR
:= $(BASEDIR
)/libtinysmb
48 export LIBZDIR
:= $(BASEDIR
)/libz
49 export STUBSDIR
:= $(BASEDIR
)/lockstubs
50 export DEPS
:= $(BASEDIR
)/deps
51 export LIBS
:= $(BASEDIR
)/lib
53 export INCDIR
:= $(BASEDIR
)/include
55 #---------------------------------------------------------------------------------
57 #---------------------------------------------------------------------------------
59 export LIBDIR
:= $(LIBS
)/$(PLATFORM
)
60 export DEPSDIR
:= $(DEPS
)/$(PLATFORM
)
62 #---------------------------------------------------------------------------------
64 #---------------------------------------------------------------------------------
67 #---------------------------------------------------------------------------------
68 BBALIB
:= $(LIBDIR
)/libbba
69 OGCLIB
:= $(LIBDIR
)/libogc
70 MODLIB
:= $(LIBDIR
)/libmodplay
71 MADLIB
:= $(LIBDIR
)/libmad
72 DBLIB
:= $(LIBDIR
)/libdb
73 BTELIB
:= $(LIBDIR
)/libbte
74 WIIUSELIB
:= $(LIBDIR
)/libwiiuse
75 TINYSMBLIB
:= $(LIBDIR
)/libtinysmb
76 ZLIB
:= $(LIBDIR
)/libz
77 STUBSLIB
:= $(LIBDIR
)/libgclibstubs
79 #---------------------------------------------------------------------------------
80 DEFINCS
:= -I
$(BASEDIR
) -I
$(BASEDIR
)/gc
81 INCLUDES
:= $(DEFINCS
) -I
$(BASEDIR
)/gc
/netif
-I
$(BASEDIR
)/gc
/ipv4 \
82 -I
$(BASEDIR
)/gc
/ogc
-I
$(BASEDIR
)/gc
/ogc
/machine
-I
$(BASEDIR
)/gc
/tinysmb \
83 -I
$(BASEDIR
)/gc
/modplay
-I
$(BASEDIR
)/gc
/mad \
84 -I
$(BASEDIR
)/gc
/z
-I
$(BASEDIR
)/gc
/bte \
85 -I
$(BASEDIR
)/gc
/sdcard
-I
$(BASEDIR
)/gc
/wiiuse
87 MACHDEP
:= -DBIGENDIAN
-DGEKKO
-mcpu
=750 -meabi
-msdata
=eabi
-mhard-float
-fmodulo-sched
-ffunction-sections
-fdata-sections
89 ifeq ($(PLATFORM
),wii
)
93 ifeq ($(PLATFORM
),cube
)
97 CFLAGS
:= -DLIBOGC_INTERNAL
-DGAMECUBE
-O2
-Wall
$(MACHDEP
) -fno-strict-aliasing
$(INCLUDES
)
100 #---------------------------------------------------------------------------------
101 VPATH
:= $(LWIPDIR
) \
103 $(LWIPDIR
)/arch
/gc
/netif \
105 $(LWIPDIR
)/core
/ipv4 \
121 #---------------------------------------------------------------------------------
122 LWIPOBJ
:= network.o netio.o gcif.o \
123 inet.o mem.o dhcp.o raw.o \
124 memp.o netif.o pbuf.o stats.o \
125 sys.o tcp.o tcp_in.o tcp_out.o \
126 udp.o icmp.o ip.o ip_frag.o \
127 ip_addr.o etharp.o loopif.o
129 #---------------------------------------------------------------------------------
131 console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
132 lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
133 lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
134 exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
135 video_asm.o video.o pad.o dvd.o exi.o mutex.o arqueue.o arqmgr.o \
136 cache_asm.o system.o system_asm.o cond.o \
137 gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
138 message.o card.o aram.o depackrnc.o decrementer_handler.o \
139 depackrnc1.o dsp.o si.o tdf.o ipc.o ogc_crt0.o \
140 console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o \
141 sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
142 sdgecko_io.o sdgecko_buf.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
145 #---------------------------------------------------------------------------------
146 MODOBJ
:= freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
148 #---------------------------------------------------------------------------------
149 MADOBJ
:= mp3player.o bit.o decoder.o fixed.o frame.o huffman.o \
150 layer12.o layer3.o stream.o synth.o timer.o \
153 #---------------------------------------------------------------------------------
154 DBOBJ
:= uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
155 uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
156 debug_supp.o geckousb.o
158 #---------------------------------------------------------------------------------
159 BTEOBJ
:= bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
161 #---------------------------------------------------------------------------------
162 WIIUSEOBJ
:= classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
163 nunchuk.o wiiuse.o wpad.o
165 #---------------------------------------------------------------------------------
166 TINYSMBOBJ
:= des.o lmhash.o smb.o
168 #---------------------------------------------------------------------------------
169 ZLIBOBJ
:= adler32.o compress.o crc32.o gzio.o uncompr.o \
170 deflate.o trees.o zutil.o inflate.o infback.o \
173 #---------------------------------------------------------------------------------
175 #---------------------------------------------------------------------------------
177 #---------------------------------------------------------------------------------
179 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
181 #---------------------------------------------------------------------------------
183 #---------------------------------------------------------------------------------
185 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
187 #---------------------------------------------------------------------------------
189 #---------------------------------------------------------------------------------
191 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -D_LANGUAGE_ASSEMBLY
-Wa
,-mgekko
-c
$< -o
$@
193 #---------------------------------------------------------------------------------
195 #---------------------------------------------------------------------------------
197 @
$(AS
) -mgekko
-Qy
$< -o
$@
199 #---------------------------------------------------------------------------------
201 #---------------------------------------------------------------------------------
206 #---------------------------------------------------------------------------------
207 wii
: gc
/ogc
/libversion.h
208 #---------------------------------------------------------------------------------
209 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
210 @
[ -d
$(LIBS
)/wii
] || mkdir
-p
$(LIBS
)/wii
211 @
[ -d
$(DEPS
)/wii
] || mkdir
-p
$(DEPS
)/wii
212 @
[ -d wii
] || mkdir
-p wii
213 @
$(MAKE
) PLATFORM
=wii libs
-C wii
-f
$(CURDIR
)/Makefile
215 #---------------------------------------------------------------------------------
216 cube
: gc
/ogc
/libversion.h
217 #---------------------------------------------------------------------------------
218 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
219 @
[ -d
$(LIBS
)/cube
] || mkdir
-p
$(LIBS
)/cube
220 @
[ -d
$(DEPS
)/cube
] || mkdir
-p
$(DEPS
)/cube
221 @
[ -d cube
] || mkdir
-p cube
222 @
$(MAKE
) PLATFORM
=cube libs
-C cube
-f
$(CURDIR
)/Makefile
225 #---------------------------------------------------------------------------------
226 gc
/ogc
/libversion.h
: Makefile
227 #---------------------------------------------------------------------------------
228 @echo
"#ifndef __LIBVERSION_H__" > $@
229 @echo
"#define __LIBVERSION_H__" >> $@
231 @echo
"#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
232 @echo
"#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
233 @echo
"#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
235 @echo
"#define _V_DATE_ __DATE__" >> $@
236 @echo
"#define _V_TIME_ __TIME__" >> $@
238 @echo
'#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)'"' >> $@
240 @echo
"#endif // __LIBVERSION_H__" >> $@
242 #---------------------------------------------------------------------------------
243 $(BBALIB
).a
: $(LWIPOBJ
)
244 #---------------------------------------------------------------------------------
245 $(OGCLIB
).a
: $(OGCOBJ
)
246 #---------------------------------------------------------------------------------
247 $(MP3LIB
).a
: $(MP3OBJ
)
248 #---------------------------------------------------------------------------------
249 $(MODLIB
).a
: $(MODOBJ
)
250 #---------------------------------------------------------------------------------
251 $(MADLIB
).a
: $(MADOBJ
)
252 #---------------------------------------------------------------------------------
254 #---------------------------------------------------------------------------------
255 $(TINYSMBLIB
).a
: $(TINYSMBOBJ
)
256 #---------------------------------------------------------------------------------
257 $(ZLIB
).a
: $(ZLIBOBJ
)
258 #---------------------------------------------------------------------------------
259 $(BTELIB
).a
: $(BTEOBJ
)
260 #---------------------------------------------------------------------------------
261 $(WIIUSELIB
).a
: $(WIIUSEOBJ
)
262 #---------------------------------------------------------------------------------
264 .PHONY
: libs wii cube install-headers
install dist docs
266 #---------------------------------------------------------------------------------
268 #---------------------------------------------------------------------------------
270 @mkdir
-p
$(INCDIR
)/ogc
/machine
271 @mkdir
-p
$(INCDIR
)/bte
272 @mkdir
-p
$(INCDIR
)/wiiuse
273 @mkdir
-p
$(INCDIR
)/modplay
274 @mkdir
-p
$(INCDIR
)/mad
275 @mkdir
-p
$(INCDIR
)/sdcard
276 @cp .
/gc
/*.h
$(INCDIR
)
277 @cp .
/gc
/ogc
/*.h
$(INCDIR
)/ogc
278 @cp .
/gc
/ogc
/machine
/*.h
$(INCDIR
)/ogc
/machine
279 @cp .
/gc
/bte
/*.h
$(INCDIR
)/bte
280 @cp .
/gc
/wiiuse
/*.h
$(INCDIR
)/wiiuse
281 @cp .
/gc
/modplay
/*.h
$(INCDIR
)/modplay
282 @cp .
/gc
/mad
/*.h
$(INCDIR
)/mad
283 @cp .
/gc
/sdcard
/*.h
$(INCDIR
)/sdcard
285 #---------------------------------------------------------------------------------
286 install: install-headers
287 #---------------------------------------------------------------------------------
288 @mkdir
-p
$(DEVKITPRO
)/libogc
289 @cp
-frv
include $(DEVKITPRO
)/libogc
290 @cp
-frv lib
$(DEVKITPRO
)/libogc
291 @cp
-frv libogc_license.txt
$(DEVKITPRO
)/libogc
294 #---------------------------------------------------------------------------------
295 dist: install-headers
296 #---------------------------------------------------------------------------------
297 @
tar --exclude
=*CVS
* --exclude
=wii
--exclude
=cube
--exclude
=*deps
* \
298 --exclude
=*.bz2
--exclude
=*include* --exclude
=*lib
/* --exclude
=*docs
/*\
299 -cvjf libogc-src-
$(DATESTRING
).
tar.bz2
*
300 @
tar -cvjf libogc-
$(DATESTRING
).
tar.bz2
include lib libogc_license.txt
303 LIBRARIES
:= $(OGCLIB
).a
$(MODLIB
).a
$(MADLIB
).a
$(DBLIB
).a
$(ZLIB
).a
$(TINYSMBLIB
).a
305 ifeq ($(PLATFORM
),cube
)
306 LIBRARIES
+= $(BBALIB
).a
308 ifeq ($(PLATFORM
),wii
)
309 LIBRARIES
+= $(BTELIB
).a
$(WIIUSELIB
).a
312 #---------------------------------------------------------------------------------
314 #---------------------------------------------------------------------------------
316 #---------------------------------------------------------------------------------
318 #---------------------------------------------------------------------------------
325 #---------------------------------------------------------------------------------
326 docs
: install-headers
327 #---------------------------------------------------------------------------------
330 -include $(DEPSDIR
)/*.d