smb changes
[libogc.git] / Makefile
blobfba5c6cae2b09876513bfed2a579453ca1f94f22
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 LIBISODIR := $(BASEDIR)/libiso9660
43 export LIBWIIKEYB := $(BASEDIR)/libwiikeyboard
44 export STUBSDIR := $(BASEDIR)/lockstubs
45 export DEPS := $(BASEDIR)/deps
46 export LIBS := $(BASEDIR)/lib
48 export INCDIR := $(BASEDIR)/include
50 #---------------------------------------------------------------------------------
51 else
52 #---------------------------------------------------------------------------------
54 export LIBDIR := $(LIBS)/$(PLATFORM)
55 export DEPSDIR := $(DEPS)/$(PLATFORM)
57 #---------------------------------------------------------------------------------
58 endif
59 #---------------------------------------------------------------------------------
62 #---------------------------------------------------------------------------------
63 BBALIB := $(LIBDIR)/libbba
64 OGCLIB := $(LIBDIR)/libogc
65 MODLIB := $(LIBDIR)/libmodplay
66 MADLIB := $(LIBDIR)/libmad
67 DBLIB := $(LIBDIR)/libdb
68 DILIB := $(LIBDIR)/libdi
69 BTELIB := $(LIBDIR)/libbte
70 WIIUSELIB := $(LIBDIR)/libwiiuse
71 TINYSMBLIB := $(LIBDIR)/libtinysmb
72 ZLIB := $(LIBDIR)/libz
73 ASNDLIB := $(LIBDIR)/libasnd
74 ISOLIB := $(LIBDIR)/libiso9660
75 WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
76 STUBSLIB := $(LIBDIR)/libgclibstubs
78 #---------------------------------------------------------------------------------
79 DEFINCS := -I$(BASEDIR) -I$(BASEDIR)/gc
80 INCLUDES := $(DEFINCS) -I$(BASEDIR)/gc/netif -I$(BASEDIR)/gc/ipv4 \
81 -I$(BASEDIR)/gc/ogc -I$(BASEDIR)/gc/ogc/machine \
82 -I$(BASEDIR)/gc/modplay \
83 -I$(BASEDIR)/gc/z -I$(BASEDIR)/gc/bte \
84 -I$(BASEDIR)/gc/sdcard -I$(BASEDIR)/gc/wiiuse \
85 -I$(BASEDIR)/gc/di
87 MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -fmodulo-sched -ffunction-sections -fdata-sections
90 ifeq ($(PLATFORM),wii)
91 MACHDEP += -DHW_RVL
92 endif
94 ifeq ($(PLATFORM),cube)
95 MACHDEP += -DHW_DOL
96 endif
98 CFLAGS := -DLIBOGC_INTERNAL -O2 -mregnames -Wall $(MACHDEP) -fno-strict-aliasing $(INCLUDES) -Wa,-mgekko
99 ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY -Wa,-mgekko $(INCLUDES)
101 #---------------------------------------------------------------------------------
102 VPATH := $(LWIPDIR) \
103 $(LWIPDIR)/arch/gc \
104 $(LWIPDIR)/arch/gc/netif \
105 $(LWIPDIR)/core \
106 $(LWIPDIR)/core/ipv4 \
107 $(LWIPDIR)/netif \
108 $(OGCDIR) \
109 $(MODDIR) \
110 $(MADDIR) \
111 $(SAMPLEDIR) \
112 $(DBDIR) \
113 $(DBDIR)/uIP \
114 $(DIDIR) \
115 $(BTEDIR) \
116 $(WIIUSEDIR) \
117 $(SDCARDDIR) \
118 $(TINYSMBDIR) \
119 $(LIBZDIR) \
120 $(LIBASNDDIR) \
121 $(LIBISODIR) \
122 $(LIBWIIKEYB) \
123 $(STUBSDIR)
126 #---------------------------------------------------------------------------------
127 LWIPOBJ := network.o netio.o gcif.o \
128 inet.o mem.o dhcp.o raw.o \
129 memp.o netif.o pbuf.o stats.o \
130 sys.o tcp.o tcp_in.o tcp_out.o \
131 udp.o icmp.o ip.o ip_frag.o \
132 ip_addr.o etharp.o loopif.o
134 #---------------------------------------------------------------------------------
135 OGCOBJ := \
136 console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
137 lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
138 lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
139 exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
140 video_asm.o video.o pad.o dvd.o exi.o mutex.o arqueue.o arqmgr.o \
141 cache_asm.o system.o system_asm.o cond.o \
142 gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
143 message.o card.o aram.o depackrnc.o decrementer_handler.o \
144 depackrnc1.o dsp.o si.o tpl.o ipc.o ogc_crt0.o \
145 console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o usbmouse.o \
146 sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
147 sdgecko_io.o sdgecko_buf.o gcsd.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
148 texconv.o wiilaunch.o
150 #---------------------------------------------------------------------------------
151 MODOBJ := freqtab.o mixer.o modplay.o semitonetab.o gcmodplay.o
153 #---------------------------------------------------------------------------------
154 MADOBJ := mp3player.o bit.o decoder.o fixed.o frame.o huffman.o \
155 layer12.o layer3.o stream.o synth.o timer.o \
156 version.o
158 #---------------------------------------------------------------------------------
159 DBOBJ := uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
160 uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
161 debug_supp.o geckousb.o
162 #---------------------------------------------------------------------------------
163 DIOBJ := di.o di_read.o stubasm.o stubload.o
165 #---------------------------------------------------------------------------------
166 BTEOBJ := bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
168 #---------------------------------------------------------------------------------
169 WIIUSEOBJ := classic.o dynamics.o events.o guitar_hero_3.o io.o io_wii.o ir.o \
170 nunchuk.o wiiboard.o wiiuse.o speaker.o wpad.o motion_plus.o
172 #---------------------------------------------------------------------------------
173 TINYSMBOBJ := des.o md4.o ntlm.o smb.o smb_devoptab.o
175 #---------------------------------------------------------------------------------
176 ZLIBOBJ := adler32.o compress.o crc32.o gzio.o uncompr.o \
177 deflate.o trees.o zutil.o inflate.o infback.o \
178 inftrees.o inffast.o
180 #---------------------------------------------------------------------------------
181 ASNDLIBOBJ := asndlib.o
183 #---------------------------------------------------------------------------------
184 ISOLIBOBJ := iso9660.o
186 #---------------------------------------------------------------------------------
187 WIIKEYBLIBOBJ := usbkeyboard.o keyboard.o ukbdmap.o wskbdutil.o
191 all: wii cube
193 #---------------------------------------------------------------------------------
194 wii: gc/ogc/libversion.h
195 #---------------------------------------------------------------------------------
196 @[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
197 @[ -d $(LIBS)/wii ] || mkdir -p $(LIBS)/wii
198 @[ -d $(DEPS)/wii ] || mkdir -p $(DEPS)/wii
199 @[ -d wii ] || mkdir -p wii
200 @$(MAKE) PLATFORM=wii libs -C wii -f $(CURDIR)/Makefile
202 #---------------------------------------------------------------------------------
203 cube: gc/ogc/libversion.h
204 #---------------------------------------------------------------------------------
205 @[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
206 @[ -d $(LIBS)/cube ] || mkdir -p $(LIBS)/cube
207 @[ -d $(DEPS)/cube ] || mkdir -p $(DEPS)/cube
208 @[ -d cube ] || mkdir -p cube
209 @$(MAKE) PLATFORM=cube libs -C cube -f $(CURDIR)/Makefile
212 #---------------------------------------------------------------------------------
213 gc/ogc/libversion.h : Makefile
214 #---------------------------------------------------------------------------------
215 @echo "#ifndef __LIBVERSION_H__" > $@
216 @echo "#define __LIBVERSION_H__" >> $@
217 @echo >> $@
218 @echo "#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
219 @echo "#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
220 @echo "#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
221 @echo >> $@
222 @echo "#define _V_DATE_ __DATE__" >> $@
223 @echo "#define _V_TIME_ __TIME__" >> $@
224 @echo >> $@
225 @echo '#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)'"' >> $@
226 @echo >> $@
227 @echo "#endif // __LIBVERSION_H__" >> $@
229 #---------------------------------------------------------------------------------
230 $(BBALIB).a: $(LWIPOBJ)
231 #---------------------------------------------------------------------------------
232 $(OGCLIB).a: $(OGCOBJ)
233 #---------------------------------------------------------------------------------
234 $(MP3LIB).a: $(MP3OBJ)
235 #---------------------------------------------------------------------------------
236 $(MODLIB).a: $(MODOBJ)
237 #---------------------------------------------------------------------------------
238 $(MADLIB).a: $(MADOBJ)
239 #---------------------------------------------------------------------------------
240 $(DBLIB).a: $(DBOBJ)
241 #---------------------------------------------------------------------------------
242 $(DILIB).a: $(DIOBJ)
243 #---------------------------------------------------------------------------------
244 $(TINYSMBLIB).a: $(TINYSMBOBJ)
245 #---------------------------------------------------------------------------------
246 $(ZLIB).a: $(ZLIBOBJ)
247 #---------------------------------------------------------------------------------
248 $(ASNDLIB).a: $(ASNDLIBOBJ)
249 #---------------------------------------------------------------------------------
250 $(ISOLIB).a: $(ISOLIBOBJ)
251 #---------------------------------------------------------------------------------
252 $(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
253 #---------------------------------------------------------------------------------
254 $(BTELIB).a: $(BTEOBJ)
255 #---------------------------------------------------------------------------------
256 $(WIIUSELIB).a: $(WIIUSEOBJ)
257 #---------------------------------------------------------------------------------
259 .PHONY: libs wii cube install-headers install dist docs
261 #---------------------------------------------------------------------------------
262 install-headers:
263 #---------------------------------------------------------------------------------
264 @mkdir -p $(INCDIR)
265 @mkdir -p $(INCDIR)/ogc/machine
266 @mkdir -p $(INCDIR)/bte
267 @mkdir -p $(INCDIR)/wiiuse
268 @mkdir -p $(INCDIR)/modplay
269 @mkdir -p $(INCDIR)/sdcard
270 @mkdir -p $(INCDIR)/di
271 @mkdir -p $(INCDIR)/wiikeyboard
272 @cp ./gc/*.h $(INCDIR)
273 @cp ./gc/ogc/*.h $(INCDIR)/ogc
274 @cp ./gc/ogc/machine/*.h $(INCDIR)/ogc/machine
275 @cp ./gc/bte/*.h $(INCDIR)/bte
276 @cp ./gc/wiiuse/*.h $(INCDIR)/wiiuse
277 @cp ./gc/modplay/*.h $(INCDIR)/modplay
278 @cp ./gc/sdcard/*.h $(INCDIR)/sdcard
279 @cp ./gc/di/*.h $(INCDIR)/di
280 @cp ./gc/wiikeyboard/*.h $(INCDIR)/wiikeyboard
282 #---------------------------------------------------------------------------------
283 install: install-headers
284 #---------------------------------------------------------------------------------
285 @mkdir -p $(DEVKITPRO)/libogc
286 @cp -frv include $(DEVKITPRO)/libogc
287 @cp -frv lib $(DEVKITPRO)/libogc
288 @cp -frv libogc_license.txt $(DEVKITPRO)/libogc
291 #---------------------------------------------------------------------------------
292 dist: install-headers
293 #---------------------------------------------------------------------------------
294 @tar --exclude=*CVS* --exclude=.svn --exclude=wii --exclude=cube --exclude=*deps* \
295 --exclude=*.bz2 --exclude=*include* --exclude=*lib/* --exclude=*docs/*\
296 -cvjf libogc-src-$(VERSTRING).tar.bz2 *
297 @tar -cvjf libogc-$(VERSTRING).tar.bz2 include lib libogc_license.txt
300 LIBRARIES := $(OGCLIB).a $(MODLIB).a $(MADLIB).a $(DBLIB).a $(ZLIB).a \
301 $(TINYSMBLIB).a $(ASNDLIB).a $(ISOLIB).a
303 ifeq ($(PLATFORM),cube)
304 LIBRARIES += $(BBALIB).a
305 endif
306 ifeq ($(PLATFORM),wii)
307 LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(DILIB).a $(WIIKEYBLIB).a
308 endif
310 #---------------------------------------------------------------------------------
311 libs: $(LIBRARIES)
312 #---------------------------------------------------------------------------------
314 #---------------------------------------------------------------------------------
315 clean:
316 #---------------------------------------------------------------------------------
317 rm -fr wii cube
318 rm -fr $(DEPS)
319 rm -fr $(LIBS)
320 rm -fr $(INCDIR)
321 rm -f *.map
323 #---------------------------------------------------------------------------------
324 docs: install-headers
325 #---------------------------------------------------------------------------------
326 doxygen libogc.dox
328 -include $(DEPSDIR)/*.d