RetroArch/Makefile.libogc

269 lines
9.9 KiB
Makefile
Raw Normal View History

2017-08-19 21:20:54 +00:00
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
export PATH := $(DEVKITPPC)/bin:$(PATH)
export LIBOGC_MAJOR := 1
export LIBOGC_MINOR := 8
export LIBOGC_PATCH := 17
include $(DEVKITPPC)/base_rules
BUILD := build
BUILD_LITE = 1
2017-08-19 21:20:54 +00:00
DATESTRING := $(shell date +%Y%m%d)
VERSTRING := $(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)
#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
export DBDIR := $(BASEDIR)/wii/libogc/libdb
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
export LIBS := $(BASEDIR)/wii/libogc/libs
export INCDIR := $(BASEDIR)/wii/libogc/include
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LIBDIR := $(LIBS)/$(PLATFORM)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
BBALIB := $(LIBDIR)/libbba
OGCLIB := $(LIBDIR)/libogc
DBLIB := $(LIBDIR)/libdb
BTELIB := $(LIBDIR)/libbte
WIIUSELIB := $(LIBDIR)/libwiiuse
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
STUBSLIB := $(LIBDIR)/libgclibstubs
#---------------------------------------------------------------------------------
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
DEFINCS := -I$(DEFAULTINCDIR)
INCLUDES := $(DEFINCS) \
-I$(BASEDIR)/wii/libogc \
-I$(DEFAULTINCDIR)/netif \
-I$(DEFAULTINCDIR)/ipv4 \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/ogc \
-I$(DEFAULTINCDIR)/ogc/machine \
-I$(DEFAULTINCDIR)/bte \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/wiikeyboard \
-I$(DEFAULTINCDIR)/wiiuse \
-I$(DEFAULTINCDIR)/di
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
MACHDEP += -DHW_RVL
endif
ifeq ($(PLATFORM),cube)
MACHDEP += -DHW_DOL
endif
CFLAGS := -DLIBOGC_INTERNAL -g -O2 -fno-strict-aliasing -mregnames -Wall $(MACHDEP) $(INCLUDES)
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
#---------------------------------------------------------------------------------
VPATH := $(LWIPDIR) \
$(LWIPDIR)/arch/gc \
$(LWIPDIR)/arch/gc/netif \
$(LWIPDIR)/core \
$(LWIPDIR)/core/ipv4 \
$(LWIPDIR)/netif \
$(OGCDIR) \
$(DBDIR) \
$(DBDIR)/uIP \
$(BTEDIR) \
$(WIIUSEDIR) \
$(SDCARDDIR) \
$(LIBWIIKEYB) \
$(STUBSDIR)
#---------------------------------------------------------------------------------
LWIPOBJ := network.o netio.o gcif.o \
inet.o mem.o dhcp.o raw.o \
memp.o netif.o pbuf.o stats.o \
sys.o tcp.o tcp_in.o tcp_out.o \
udp.o icmp.o ip.o ip_frag.o \
ip_addr.o etharp.o loopif.o
#---------------------------------------------------------------------------------
OGCOBJ := \
console.o lwp_priority.o lwp_queue.o lwp_threadq.o lwp_threads.o lwp_sema.o \
lwp_messages.o lwp.o lwp_handler.o lwp_stack.o lwp_mutex.o \
lwp_watchdog.o lwp_wkspace.o lwp_objmgr.o lwp_heap.o sys_state.o \
exception_handler.o exception.o irq.o irq_handler.o semaphore.o \
video_asm.o video.o pad.o exi.o mutex.o arqueue.o arqmgr.o \
2017-08-19 21:20:54 +00:00
cache_asm.o system.o system_asm.o cond.o \
gx.o gu.o gu_psasm.o audio.o cache.o decrementer.o \
message.o card.o aram.o depackrnc.o decrementer_handler.o \
depackrnc1.o dsp.o si.o tpl.o ipc.o ogc_crt0.o \
console_font_8x16.o timesupp.o lock_supp.o newlibc.o usbgecko.o usbmouse.o \
sbrk.o malloc_lock.o kprintf.o stm.o ios.o es.o isfs.o usb.o network_common.o \
sdgecko_io.o sdgecko_buf.o gcsd.o argv.o network_wii.o wiisd.o conf.o usbstorage.o \
texconv.o wiilaunch.o
ifneq ($(BUILD_LITE), 1)
OGCOBJ += dvd.o
endif
2017-08-19 21:20:54 +00:00
#---------------------------------------------------------------------------------
DBOBJ := uip_ip.o uip_tcp.o uip_pbuf.o uip_netif.o uip_arp.o uip_arch.o \
uip_icmp.o memb.o memr.o bba.o tcpip.o debug.o debug_handler.o \
debug_supp.o geckousb.o
#---------------------------------------------------------------------------------
BTEOBJ := bte.o hci.o l2cap.o btmemb.o btmemr.o btpbuf.o physbusif.o
#---------------------------------------------------------------------------------
WIIUSEOBJ := classic.o dynamics.o events.o io.o io_wii.o ir.o \
nunchuk.o wiiuse.o speaker.o wpad.o motion_plus.o
#---------------------------------------------------------------------------------
WIIKEYBLIBOBJ := usbkeyboard.o keyboard.o ukbdmap.o wskbdutil.o
all: wii cube
#---------------------------------------------------------------------------------
wii: $(BASEDIR)/wii/libogc/include/ogc/libversion.h
#---------------------------------------------------------------------------------
@[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
@[ -d $(LIBS)/wii ] || mkdir -p $(LIBS)/wii
@[ -d wii ] || mkdir -p wii
@$(MAKE) PLATFORM=wii libs -C wii -f $(CURDIR)/Makefile.libogc
#---------------------------------------------------------------------------------
cube: $(BASEDIR)/wii/libogc/include/ogc/libversion.h
#---------------------------------------------------------------------------------
@[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
@[ -d $(LIBS)/cube ] || mkdir -p $(LIBS)/cube
@[ -d cube ] || mkdir -p cube
@$(MAKE) PLATFORM=cube libs -C cube -f $(CURDIR)/Makefile.libogc
#---------------------------------------------------------------------------------
$(BASEDIR)/wii/libogc/include/ogc/libversion.h : Makefile.libogc
#---------------------------------------------------------------------------------
@echo "#ifndef __LIBVERSION_H__" > $@
@echo "#define __LIBVERSION_H__" >> $@
@echo >> $@
@echo "#define _V_MAJOR_ $(LIBOGC_MAJOR)" >> $@
@echo "#define _V_MINOR_ $(LIBOGC_MINOR)" >> $@
@echo "#define _V_PATCH_ $(LIBOGC_PATCH)" >> $@
@echo >> $@
@echo "#define _V_DATE_ __DATE__" >> $@
@echo "#define _V_TIME_ __TIME__" >> $@
@echo >> $@
@echo '#define _V_STRING "libOGC Release '$(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)'"' >> $@
@echo >> $@
@echo "#endif // __LIBVERSION_H__" >> $@
#---------------------------------------------------------------------------------
$(BBALIB).a: $(LWIPOBJ)
#---------------------------------------------------------------------------------
$(OGCLIB).a: $(OGCOBJ)
#---------------------------------------------------------------------------------
$(DBLIB).a: $(DBOBJ)
#---------------------------------------------------------------------------------
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
#---------------------------------------------------------------------------------
$(BTELIB).a: $(BTEOBJ)
#---------------------------------------------------------------------------------
$(WIIUSELIB).a: $(WIIUSEOBJ)
#---------------------------------------------------------------------------------
.PHONY: libs wii cube install-headers install dist docs
#---------------------------------------------------------------------------------
install-headers:
#---------------------------------------------------------------------------------
@mkdir -p $(INCDIR)
@mkdir -p $(INCDIR)/ogc/machine
@mkdir -p $(INCDIR)/bte
@mkdir -p $(INCDIR)/wiiuse
@mkdir -p $(INCDIR)/modplay
@mkdir -p $(INCDIR)/sdcard
@mkdir -p $(INCDIR)/di
@mkdir -p $(INCDIR)/wiikeyboard
@cp ./gc/*.h $(INCDIR)
@cp ./gc/ogc/*.h $(INCDIR)/ogc
@cp ./gc/ogc/machine/*.h $(INCDIR)/ogc/machine
@cp ./gc/bte/*.h $(INCDIR)/bte
@cp ./gc/wiiuse/*.h $(INCDIR)/wiiuse
@cp ./gc/modplay/*.h $(INCDIR)/modplay
@cp ./gc/sdcard/*.h $(INCDIR)/sdcard
@cp ./gc/di/*.h $(INCDIR)/di
@cp ./gc/wiikeyboard/*.h $(INCDIR)/wiikeyboard
#---------------------------------------------------------------------------------
install: wii cube install-headers
#---------------------------------------------------------------------------------
@mkdir -p $(DEVKITPRO)/libogc
@cp -frv include $(DEVKITPRO)/libogc
@cp -frv lib $(DEVKITPRO)/libogc
@cp -frv libogc_license.txt $(DEVKITPRO)/libogc
#---------------------------------------------------------------------------------
dist: wii cube install-headers
#---------------------------------------------------------------------------------
@tar --exclude=*CVS* --exclude=.svn --exclude=wii --exclude=cube --exclude=*deps* \
--exclude=*.bz2 --exclude=*include* --exclude=*lib/* --exclude=*docs/*\
-cvjf libogc-src-$(VERSTRING).tar.bz2 *
@tar -cvjf libogc-$(VERSTRING).tar.bz2 include lib libogc_license.txt
LIBRARIES := $(OGCLIB).a $(DBLIB).a
ifeq ($(PLATFORM),cube)
LIBRARIES += $(BBALIB).a
endif
ifeq ($(PLATFORM),wii)
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
endif
#---------------------------------------------------------------------------------
libs: $(LIBRARIES)
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
rm -fr $(BASEDIR)/wii/*.o
rm -f *.map
#---------------------------------------------------------------------------------
docs: install-headers
#---------------------------------------------------------------------------------
doxygen libogc.dox