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
:= 8
17 export LIBOGC_PATCH
:= 0
19 include $(DEVKITPPC
)/base_rules
23 DATESTRING
:= $(shell date
+%Y
%m
%d
)
24 VERSTRING
:= $(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)
26 #---------------------------------------------------------------------------------
27 ifeq ($(strip $(PLATFORM
)),)
28 #---------------------------------------------------------------------------------
29 export BASEDIR
:= $(CURDIR
)
30 export LWIPDIR
:= $(BASEDIR
)/lwip
31 export OGCDIR
:= $(BASEDIR
)/libogc
32 export MODDIR
:= $(BASEDIR
)/libmodplay
33 export MADDIR
:= $(BASEDIR
)/libmad
34 export SAMPLEDIR
:= $(BASEDIR
)/libsamplerate
35 export DBDIR
:= $(BASEDIR
)/libdb
36 export DIDIR
:= $(BASEDIR
)/libdi
37 export BTEDIR
:= $(BASEDIR
)/lwbt
38 export WIIUSEDIR
:= $(BASEDIR
)/wiiuse
39 export TINYSMBDIR
:= $(BASEDIR
)/libtinysmb
40 export LIBZDIR
:= $(BASEDIR
)/libz
41 export LIBASNDDIR
:= $(BASEDIR
)/libasnd
42 export LIBWIIKEYB
:= $(BASEDIR
)/libwiikeyboard
43 export STUBSDIR
:= $(BASEDIR
)/lockstubs
44 export DEPS
:= $(BASEDIR
)/deps
45 export LIBS
:= $(BASEDIR
)/lib
47 export INCDIR
:= $(BASEDIR
)/include
49 #---------------------------------------------------------------------------------
51 #---------------------------------------------------------------------------------
53 export LIBDIR
:= $(LIBS
)/$(PLATFORM
)
54 export DEPSDIR
:= $(DEPS
)/$(PLATFORM
)
56 #---------------------------------------------------------------------------------
58 #---------------------------------------------------------------------------------
61 #---------------------------------------------------------------------------------
62 BBALIB
:= $(LIBDIR
)/libbba
63 OGCLIB
:= $(LIBDIR
)/libogc
64 MODLIB
:= $(LIBDIR
)/libmodplay
65 MADLIB
:= $(LIBDIR
)/libmad
66 DBLIB
:= $(LIBDIR
)/libdb
67 DILIB
:= $(LIBDIR
)/libdi
68 BTELIB
:= $(LIBDIR
)/libbte
69 WIIUSELIB
:= $(LIBDIR
)/libwiiuse
70 TINYSMBLIB
:= $(LIBDIR
)/libtinysmb
71 ZLIB
:= $(LIBDIR
)/libz
72 ASNDLIB
:= $(LIBDIR
)/libasnd
73 WIIKEYBLIB
:= $(LIBDIR
)/libwiikeyboard
74 STUBSLIB
:= $(LIBDIR
)/libgclibstubs
76 #---------------------------------------------------------------------------------
77 DEFINCS
:= -I
$(BASEDIR
) -I
$(BASEDIR
)/gc
78 INCLUDES
:= $(DEFINCS
) -I
$(BASEDIR
)/gc
/netif
-I
$(BASEDIR
)/gc
/ipv4 \
79 -I
$(BASEDIR
)/gc
/ogc
-I
$(BASEDIR
)/gc
/ogc
/machine \
80 -I
$(BASEDIR
)/gc
/modplay \
81 -I
$(BASEDIR
)/gc
/z
-I
$(BASEDIR
)/gc
/bte \
82 -I
$(BASEDIR
)/gc
/sdcard
-I
$(BASEDIR
)/gc
/wiiuse \
85 MACHDEP
:= -DBIGENDIAN
-DGEKKO
-mcpu
=750 -meabi
-msdata
=eabi
-mhard-float
-fmodulo-sched
-ffunction-sections
-fdata-sections
88 ifeq ($(PLATFORM
),wii
)
92 ifeq ($(PLATFORM
),cube
)
96 CFLAGS
:= -DLIBOGC_INTERNAL
-O2
-mregnames
-Wall
$(MACHDEP
) -fno-strict-aliasing
$(INCLUDES
) -Wa
,-mgekko
97 ASFLAGS
:= $(MACHDEP
) -mregnames
-D_LANGUAGE_ASSEMBLY
-Wa
,-mgekko
$(INCLUDES
)
99 #---------------------------------------------------------------------------------
100 VPATH
:= $(LWIPDIR
) \
102 $(LWIPDIR
)/arch
/gc
/netif \
104 $(LWIPDIR
)/core
/ipv4 \
123 #---------------------------------------------------------------------------------
124 LWIPOBJ
:= network.o netio.o gcif.o \
125 inet.o mem.o dhcp.o raw.o \
126 memp.o netif.o pbuf.o stats.o \
127 sys.o tcp.o tcp_in.o tcp_out.o \
128 udp.o icmp.o ip.o ip_frag.o \
129 ip_addr.o etharp.o loopif.o
131 #---------------------------------------------------------------------------------
133 console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
134 lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
135 lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
136 exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
137 video_asm.o video.o pad.o dvd.o exi.o mutex.o arqueue.o arqmgr.o \
138 cache_asm.o system.o system_asm.o cond.o \
139 gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
140 message.o card.o aram.o depackrnc.o decrementer_handler.o \
141 depackrnc1.o dsp.o si.o tpl.o ipc.o ogc_crt0.o \
142 console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o \
143 sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
144 sdgecko_io.o sdgecko_buf.o gcsd.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
145 texconv.o wiilaunch.o
147 #---------------------------------------------------------------------------------
148 MODOBJ
:= freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
150 #---------------------------------------------------------------------------------
151 MADOBJ
:= mp3player.o bit.o decoder.o fixed.o frame.o huffman.o \
152 layer12.o layer3.o stream.o synth.o timer.o \
155 #---------------------------------------------------------------------------------
156 DBOBJ
:= uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
157 uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
158 debug_supp.o geckousb.o
159 #---------------------------------------------------------------------------------
160 DIOBJ
:= di.o di_read.o stubasm.o stubload.o di_iso9660.o
162 #---------------------------------------------------------------------------------
163 BTEOBJ
:= bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
165 #---------------------------------------------------------------------------------
166 WIIUSEOBJ
:= classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
167 nunchuk.o wiiboard.o wiiuse.o speaker.o wpad.o motion_plus.o
169 #---------------------------------------------------------------------------------
170 TINYSMBOBJ
:= des.o md4.o ntlm.o smb.o smb_devoptab.o
172 #---------------------------------------------------------------------------------
173 ZLIBOBJ
:= adler32.o compress.o crc32.o gzio.o uncompr.o \
174 deflate.o trees.o zutil.o inflate.o infback.o \
177 #---------------------------------------------------------------------------------
178 ASNDLIBOBJ
:= asndlib.o
180 #---------------------------------------------------------------------------------
181 WIIKEYBLIBOBJ
:= usbkeyboard.o keyboard.o ukbdmap.o wskbdutil.o
183 #---------------------------------------------------------------------------------
185 #---------------------------------------------------------------------------------
187 #---------------------------------------------------------------------------------
189 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
191 #---------------------------------------------------------------------------------
193 #---------------------------------------------------------------------------------
195 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -Wa
,-mgekko
-c
$< -o
$@
197 #---------------------------------------------------------------------------------
199 #---------------------------------------------------------------------------------
201 @
$(CC
) -MMD
-MP
-MF
$(DEPSDIR
)/$*.d
$(CFLAGS
) -D_LANGUAGE_ASSEMBLY
-Wa
,-mgekko
-c
$< -o
$@
203 #---------------------------------------------------------------------------------
205 #---------------------------------------------------------------------------------
207 @
$(AS
) -mgekko
-Qy
$< -o
$@
209 #---------------------------------------------------------------------------------
211 #---------------------------------------------------------------------------------
216 #---------------------------------------------------------------------------------
217 wii
: gc
/ogc
/libversion.h
218 #---------------------------------------------------------------------------------
219 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
220 @
[ -d
$(LIBS
)/wii
] || mkdir
-p
$(LIBS
)/wii
221 @
[ -d
$(DEPS
)/wii
] || mkdir
-p
$(DEPS
)/wii
222 @
[ -d wii
] || mkdir
-p wii
223 @
$(MAKE
) PLATFORM
=wii libs
-C wii
-f
$(CURDIR
)/Makefile
225 #---------------------------------------------------------------------------------
226 cube
: gc
/ogc
/libversion.h
227 #---------------------------------------------------------------------------------
228 @
[ -d
$(INCDIR
) ] || mkdir
-p
$(INCDIR
)
229 @
[ -d
$(LIBS
)/cube
] || mkdir
-p
$(LIBS
)/cube
230 @
[ -d
$(DEPS
)/cube
] || mkdir
-p
$(DEPS
)/cube
231 @
[ -d cube
] || mkdir
-p cube
232 @
$(MAKE
) PLATFORM
=cube libs
-C cube
-f
$(CURDIR
)/Makefile
235 #---------------------------------------------------------------------------------
236 gc
/ogc
/libversion.h
: Makefile
237 #---------------------------------------------------------------------------------
238 @echo
"#ifndef __LIBVERSION_H__" > $@
239 @echo
"#define __LIBVERSION_H__" >> $@
241 @echo
"#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
242 @echo
"#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
243 @echo
"#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
245 @echo
"#define _V_DATE_ __DATE__" >> $@
246 @echo
"#define _V_TIME_ __TIME__" >> $@
248 @echo
'#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR
).
$(LIBOGC_MINOR
).
$(LIBOGC_PATCH
)'"' >> $@
250 @echo
"#endif // __LIBVERSION_H__" >> $@
252 #---------------------------------------------------------------------------------
253 $(BBALIB
).a
: $(LWIPOBJ
)
254 #---------------------------------------------------------------------------------
255 $(OGCLIB
).a
: $(OGCOBJ
)
256 #---------------------------------------------------------------------------------
257 $(MP3LIB
).a
: $(MP3OBJ
)
258 #---------------------------------------------------------------------------------
259 $(MODLIB
).a
: $(MODOBJ
)
260 #---------------------------------------------------------------------------------
261 $(MADLIB
).a
: $(MADOBJ
)
262 #---------------------------------------------------------------------------------
264 #---------------------------------------------------------------------------------
266 #---------------------------------------------------------------------------------
267 $(TINYSMBLIB
).a
: $(TINYSMBOBJ
)
268 #---------------------------------------------------------------------------------
269 $(ZLIB
).a
: $(ZLIBOBJ
)
270 #---------------------------------------------------------------------------------
271 $(ASNDLIB
).a
: $(ASNDLIBOBJ
)
272 #---------------------------------------------------------------------------------
273 $(WIIKEYBLIB
).a
: $(WIIKEYBLIBOBJ
)
274 #---------------------------------------------------------------------------------
275 $(BTELIB
).a
: $(BTEOBJ
)
276 #---------------------------------------------------------------------------------
277 $(WIIUSELIB
).a
: $(WIIUSEOBJ
)
278 #---------------------------------------------------------------------------------
280 .PHONY
: libs wii cube install-headers
install dist docs
282 #---------------------------------------------------------------------------------
284 #---------------------------------------------------------------------------------
286 @mkdir
-p
$(INCDIR
)/ogc
/machine
287 @mkdir
-p
$(INCDIR
)/bte
288 @mkdir
-p
$(INCDIR
)/wiiuse
289 @mkdir
-p
$(INCDIR
)/modplay
290 @mkdir
-p
$(INCDIR
)/sdcard
291 @mkdir
-p
$(INCDIR
)/di
292 @mkdir
-p
$(INCDIR
)/wiikeyboard
293 @cp .
/gc
/*.h
$(INCDIR
)
294 @cp .
/gc
/ogc
/*.h
$(INCDIR
)/ogc
295 @cp .
/gc
/ogc
/machine
/*.h
$(INCDIR
)/ogc
/machine
296 @cp .
/gc
/bte
/*.h
$(INCDIR
)/bte
297 @cp .
/gc
/wiiuse
/*.h
$(INCDIR
)/wiiuse
298 @cp .
/gc
/modplay
/*.h
$(INCDIR
)/modplay
299 @cp .
/gc
/sdcard
/*.h
$(INCDIR
)/sdcard
300 @cp .
/gc
/di
/*.h
$(INCDIR
)/di
301 @cp .
/gc
/wiikeyboard
/*.h
$(INCDIR
)/wiikeyboard
303 #---------------------------------------------------------------------------------
304 install: install-headers
305 #---------------------------------------------------------------------------------
306 @mkdir
-p
$(DEVKITPRO
)/libogc
307 @cp
-frv
include $(DEVKITPRO
)/libogc
308 @cp
-frv lib
$(DEVKITPRO
)/libogc
309 @cp
-frv libogc_license.txt
$(DEVKITPRO
)/libogc
312 #---------------------------------------------------------------------------------
313 dist: install-headers
314 #---------------------------------------------------------------------------------
315 @
tar --exclude
=*CVS
* --exclude
=.svn
--exclude
=wii
--exclude
=cube
--exclude
=*deps
* \
316 --exclude
=*.bz2
--exclude
=*include* --exclude
=*lib
/* --exclude
=*docs
/*\
317 -cvjf libogc-src-
$(VERSTRING
).
tar.bz2
*
318 @
tar -cvjf libogc-
$(VERSTRING
).
tar.bz2
include lib libogc_license.txt
321 LIBRARIES
:= $(OGCLIB
).a
$(MODLIB
).a
$(MADLIB
).a
$(DBLIB
).a
$(ZLIB
).a
$(TINYSMBLIB
).a
$(ASNDLIB
).a
323 ifeq ($(PLATFORM
),cube
)
324 LIBRARIES
+= $(BBALIB
).a
326 ifeq ($(PLATFORM
),wii
)
327 LIBRARIES
+= $(BTELIB
).a
$(WIIUSELIB
).a
$(DILIB
).a
$(WIIKEYBLIB
).a
330 #---------------------------------------------------------------------------------
332 #---------------------------------------------------------------------------------
334 #---------------------------------------------------------------------------------
336 #---------------------------------------------------------------------------------
343 #---------------------------------------------------------------------------------
344 docs
: install-headers
345 #---------------------------------------------------------------------------------
348 -include $(DEPSDIR
)/*.d