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
144 #---------------------------------------------------------------------------------
145 MODOBJ
:= freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
147 #---------------------------------------------------------------------------------
148 MADOBJ
:= mp3player.o bit.o decoder.o fixed.o frame.o huffman.o \
149 layer12.o layer3.o stream.o synth.o timer.o \
152 #---------------------------------------------------------------------------------
153 DBOBJ
:= uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
154 uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
155 debug_supp.o geckousb.o
157 #---------------------------------------------------------------------------------
158 BTEOBJ
:= bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
160 #---------------------------------------------------------------------------------
161 WIIUSEOBJ
:= classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
162 nunchuk.o wiiuse.o wpad.o
164 #---------------------------------------------------------------------------------
165 TINYSMBOBJ
:= des.o lmhash.o smb.o
167 #---------------------------------------------------------------------------------
168 ZLIBOBJ
:= adler32.o compress.o crc32.o gzio.o uncompr.o \
169 deflate.o trees.o zutil.o inflate.o infback.o \
172 #---------------------------------------------------------------------------------
174 #---------------------------------------------------------------------------------
176 #---------------------------------------------------------------------------------
178 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
180 #---------------------------------------------------------------------------------
182 #---------------------------------------------------------------------------------
184 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
186 #---------------------------------------------------------------------------------
188 #---------------------------------------------------------------------------------
190 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -D_LANGUAGE_ASSEMBLY
-Wa
,-mgekko
-c
$< -o
$@
192 #---------------------------------------------------------------------------------
194 #---------------------------------------------------------------------------------
196 @
$(AS
) -mgekko
-Qy
$< -o
$@
198 #---------------------------------------------------------------------------------
200 #---------------------------------------------------------------------------------
203 #---------------------------------------------------------------------------------
204 all: gc
/ogc
/libversion.h
205 #---------------------------------------------------------------------------------
206 @
[ -d
$(LIBS
)/wii
] || mkdir
-p
$(LIBS
)/wii
207 @
[ -d
$(LIBS
)/cube
] || mkdir
-p
$(LIBS
)/cube
208 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
209 @
[ -d
$(DEPS
)/wii
] || mkdir
-p
$(DEPS
)/wii
210 @
[ -d
$(DEPS
)/cube
] || mkdir
-p
$(DEPS
)/cube
211 @
[ -d wii
] || mkdir
-p wii
212 @
[ -d cube
] || mkdir
-p cube
213 @
$(MAKE
) PLATFORM
=cube libs
-C cube
-f
$(CURDIR
)/Makefile
214 @
$(MAKE
) PLATFORM
=wii libs
-C wii
-f
$(CURDIR
)/Makefile
216 #---------------------------------------------------------------------------------
217 gc
/ogc
/libversion.h
: Makefile
218 #---------------------------------------------------------------------------------
219 @echo
"#ifndef __LIBVERSION_H__" > $@
220 @echo
"#define __LIBVERSION_H__" >> $@
222 @echo
"#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
223 @echo
"#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
224 @echo
"#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
226 @echo
"#define _V_DATE_ __DATE__" >> $@
227 @echo
"#define _V_TIME_ __TIME__" >> $@
229 @echo
'#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)'"' >> $@
231 @echo
"#endif // __LIBVERSION_H__" >> $@
233 #---------------------------------------------------------------------------------
234 $(BBALIB
).a
: $(LWIPOBJ
)
235 #---------------------------------------------------------------------------------
236 $(OGCLIB
).a
: $(OGCOBJ
)
237 #---------------------------------------------------------------------------------
238 $(MP3LIB
).a
: $(MP3OBJ
)
239 #---------------------------------------------------------------------------------
240 $(MODLIB
).a
: $(MODOBJ
)
241 #---------------------------------------------------------------------------------
242 $(MADLIB
).a
: $(MADOBJ
)
243 #---------------------------------------------------------------------------------
245 #---------------------------------------------------------------------------------
246 $(TINYSMBLIB
).a
: $(TINYSMBOBJ
)
247 #---------------------------------------------------------------------------------
248 $(ZLIB
).a
: $(ZLIBOBJ
)
249 #---------------------------------------------------------------------------------
250 $(BTELIB
).a
: $(BTEOBJ
)
251 #---------------------------------------------------------------------------------
252 $(WIIUSELIB
).a
: $(WIIUSEOBJ
)
253 #---------------------------------------------------------------------------------
255 .PHONY
: libs install-headers
install dist docs
257 #---------------------------------------------------------------------------------
259 #---------------------------------------------------------------------------------
261 @mkdir
-p
$(INCDIR
)/ogc
/machine
262 @mkdir
-p
$(INCDIR
)/bte
263 @mkdir
-p
$(INCDIR
)/wiiuse
264 @mkdir
-p
$(INCDIR
)/modplay
265 @mkdir
-p
$(INCDIR
)/mad
266 @mkdir
-p
$(INCDIR
)/sdcard
267 @cp .
/gc
/*.h
$(INCDIR
)
268 @cp .
/gc
/ogc
/*.h
$(INCDIR
)/ogc
269 @cp .
/gc
/ogc
/machine
/*.h
$(INCDIR
)/ogc
/machine
270 @cp .
/gc
/bte
/*.h
$(INCDIR
)/bte
271 @cp .
/gc
/wiiuse
/*.h
$(INCDIR
)/wiiuse
272 @cp .
/gc
/modplay
/*.h
$(INCDIR
)/modplay
273 @cp .
/gc
/mad
/*.h
$(INCDIR
)/mad
274 @cp .
/gc
/sdcard
/*.h
$(INCDIR
)/sdcard
276 #---------------------------------------------------------------------------------
277 install: install-headers
278 #---------------------------------------------------------------------------------
279 @mkdir
-p
$(DEVKITPRO
)/libogc
280 @cp
-frv
include $(DEVKITPRO
)/libogc
281 @cp
-frv lib
$(DEVKITPRO
)/libogc
282 @cp
-frv libogc_license.txt
$(DEVKITPRO
)/libogc
285 #---------------------------------------------------------------------------------
286 dist: install-headers
287 #---------------------------------------------------------------------------------
288 @
tar --exclude
=*CVS
* --exclude
=wii
--exclude
=cube
--exclude
=*deps
* \
289 --exclude
=*.bz2
--exclude
=*include* --exclude
=*lib
/* --exclude
=*docs
/*\
290 -cvjf libogc-src-
$(DATESTRING
).
tar.bz2
*
291 @
tar -cvjf libogc-
$(DATESTRING
).
tar.bz2
include lib libogc_license.txt
294 LIBRARIES
:= $(OGCLIB
).a
$(MODLIB
).a
$(MADLIB
).a
$(DBLIB
).a
$(ZLIB
).a
$(TINYSMBLIB
).a
296 ifeq ($(PLATFORM
),cube
)
297 LIBRARIES
+= $(BBALIB
).a
299 ifeq ($(PLATFORM
),wii
)
300 LIBRARIES
+= $(BTELIB
).a
$(WIIUSELIB
).a
303 #---------------------------------------------------------------------------------
305 #---------------------------------------------------------------------------------
307 #---------------------------------------------------------------------------------
309 #---------------------------------------------------------------------------------
316 #---------------------------------------------------------------------------------
317 docs
: install-headers
318 #---------------------------------------------------------------------------------
321 -include $(DEPSDIR
)/*.d