disable SMB debug spew for now
[libogc.git] / Makefile
blobce31533dbf94e6c4b8538fe19e072aa29e4656bb
1 #---------------------------------------------------------------------------------
2 .SUFFIXES:
3 #---------------------------------------------------------------------------------
5 ifeq ($(strip $(DEVKITPRO)),)
6 $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
7 endif
9 ifeq ($(strip $(DEVKITPPC)),)
10 $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
11 endif
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
21 BUILD := build
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 #---------------------------------------------------------------------------------
50 else
51 #---------------------------------------------------------------------------------
53 export LIBDIR := $(LIBS)/$(PLATFORM)
54 export DEPSDIR := $(DEPS)/$(PLATFORM)
56 #---------------------------------------------------------------------------------
57 endif
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 \
83 -I$(BASEDIR)/gc/di
85 MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -fmodulo-sched -ffunction-sections -fdata-sections
88 ifeq ($(PLATFORM),wii)
89 MACHDEP += -DHW_RVL
90 endif
92 ifeq ($(PLATFORM),cube)
93 MACHDEP += -DHW_DOL
94 endif
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) \
101 $(LWIPDIR)/arch/gc \
102 $(LWIPDIR)/arch/gc/netif \
103 $(LWIPDIR)/core \
104 $(LWIPDIR)/core/ipv4 \
105 $(LWIPDIR)/netif \
106 $(OGCDIR) \
107 $(MODDIR) \
108 $(MADDIR) \
109 $(SAMPLEDIR) \
110 $(DBDIR) \
111 $(DBDIR)/uIP \
112 $(DIDIR) \
113 $(BTEDIR) \
114 $(WIIUSEDIR) \
115 $(SDCARDDIR) \
116 $(TINYSMBDIR) \
117 $(LIBZDIR) \
118 $(LIBASNDDIR) \
119 $(LIBWIIKEYB) \
120 $(STUBSDIR)
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 #---------------------------------------------------------------------------------
132 OGCOBJ := \
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 \
153 version.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 \
175 inftrees.o inffast.o
177 #---------------------------------------------------------------------------------
178 ASNDLIBOBJ := asndlib.o
180 #---------------------------------------------------------------------------------
181 WIIKEYBLIBOBJ := usbkeyboard.o keyboard.o ukbdmap.o wskbdutil.o
183 #---------------------------------------------------------------------------------
184 # Build rules:
185 #---------------------------------------------------------------------------------
186 %.o : %.c
187 #---------------------------------------------------------------------------------
188 @echo $(notdir $<)
189 @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -Wa,-mgekko -c $< -o $@
191 #---------------------------------------------------------------------------------
192 %.o : %.cpp
193 #---------------------------------------------------------------------------------
194 @echo $(notdir $<)
195 @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -Wa,-mgekko -c $< -o $@
197 #---------------------------------------------------------------------------------
198 %.o : %.S
199 #---------------------------------------------------------------------------------
200 @echo $(notdir $<)
201 @$(CC) -MMD -MP -MF $(DEPSDIR)/$*.d $(CFLAGS) -D_LANGUAGE_ASSEMBLY -Wa,-mgekko -c $< -o $@
203 #---------------------------------------------------------------------------------
204 %.o : %.s
205 #---------------------------------------------------------------------------------
206 @echo $(notdir $<)
207 @$(AS) -mgekko -Qy $< -o $@
209 #---------------------------------------------------------------------------------
210 %.a:
211 #---------------------------------------------------------------------------------
212 $(AR) -rc $@ $^
214 all: wii cube
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__" >> $@
240 @echo >> $@
241 @echo "#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
242 @echo "#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
243 @echo "#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
244 @echo >> $@
245 @echo "#define _V_DATE_ __DATE__" >> $@
246 @echo "#define _V_TIME_ __TIME__" >> $@
247 @echo >> $@
248 @echo '#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)'"' >> $@
249 @echo >> $@
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 #---------------------------------------------------------------------------------
263 $(DBLIB).a: $(DBOBJ)
264 #---------------------------------------------------------------------------------
265 $(DILIB).a: $(DIOBJ)
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 #---------------------------------------------------------------------------------
283 install-headers:
284 #---------------------------------------------------------------------------------
285 @mkdir -p $(INCDIR)
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
325 endif
326 ifeq ($(PLATFORM),wii)
327 LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(DILIB).a $(WIIKEYBLIB).a
328 endif
330 #---------------------------------------------------------------------------------
331 libs: $(LIBRARIES)
332 #---------------------------------------------------------------------------------
334 #---------------------------------------------------------------------------------
335 clean:
336 #---------------------------------------------------------------------------------
337 rm -fr wii cube
338 rm -fr $(DEPS)
339 rm -fr $(LIBS)
340 rm -fr $(INCDIR)
341 rm -f *.map
343 #---------------------------------------------------------------------------------
344 docs: install-headers
345 #---------------------------------------------------------------------------------
346 doxygen libogc.dox
348 -include $(DEPSDIR)/*.d