Skip to content

Commit

Permalink
Fix out-of-tree builds
Browse files Browse the repository at this point in the history
  • Loading branch information
9ary committed Nov 29, 2023
1 parent f99fef8 commit 9ea61ae
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/continuous-integration-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
path: libntfs

- name: Build libogc2
run: make install
run: |
mkdir -p build
make -C build -f ../Makefile install
working-directory: libogc2

- name: Build libfat
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
cube
deps
include
Expand Down
4 changes: 2 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NUMBER = 1.0
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.

OUTPUT_DIRECTORY = docs
OUTPUT_DIRECTORY = $(BUILDDIR)/docs

# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
Expand Down Expand Up @@ -579,7 +579,7 @@ WARN_FORMAT = "$file:$line: $text"
# and error messages should be written. If left blank the output is written
# to stderr.

WARN_LOGFILE = warn.log
WARN_LOGFILE = $(BUILDDIR)/warn.log

#---------------------------------------------------------------------------
# configuration options related to the input files
Expand Down
59 changes: 34 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif

CURFILE := $(abspath $(lastword $(MAKEFILE_LIST)))

export PATH := $(DEVKITPPC)/bin:$(PATH)

export LIBOGC_MAJOR := 2
Expand All @@ -26,7 +28,8 @@ VERSTRING := $(LIBOGC_MAJOR).$(LIBOGC_MINOR).$(LIBOGC_PATCH)
#---------------------------------------------------------------------------------
ifeq ($(strip $(PLATFORM)),)
#---------------------------------------------------------------------------------
export BASEDIR := $(CURDIR)
export BUILDDIR := $(CURDIR)
export BASEDIR := $(dir $(CURFILE))
export LWIPDIR := $(BASEDIR)/lwip
export OGCDIR := $(BASEDIR)/libogc
export MODDIR := $(BASEDIR)/libmodplay
Expand All @@ -39,10 +42,10 @@ export LIBASNDDIR := $(BASEDIR)/libasnd
export LIBAESNDDIR := $(BASEDIR)/libaesnd
export LIBISODIR := $(BASEDIR)/libiso9660
export LIBWIIKEYB := $(BASEDIR)/libwiikeyboard
export DEPS := $(BASEDIR)/deps
export LIBS := $(BASEDIR)/lib
export DEPS := $(BUILDDIR)/deps
export LIBS := $(BUILDDIR)/lib

export INCDIR := $(BASEDIR)/include
export INCDIR := $(BUILDDIR)/include

#---------------------------------------------------------------------------------
else
Expand Down Expand Up @@ -74,10 +77,12 @@ WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
DEFINCS := -I$(BASEDIR) -I$(BASEDIR)/gc
INCLUDES := $(DEFINCS) -I$(BASEDIR)/gc/netif -I$(BASEDIR)/gc/ipv4 \
-I$(BASEDIR)/gc/ogc -I$(BASEDIR)/gc/ogc/machine \
-I$(BUILDDIR)/gc/ogc \
-I$(BASEDIR)/gc/modplay \
-I$(BASEDIR)/gc/bte \
-I$(BASEDIR)/gc/sdcard -I$(BASEDIR)/gc/wiiuse \
-I$(BASEDIR)/gc/di
-I$(BASEDIR)/gc/di \
-I$(CURDIR)

MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections

Expand Down Expand Up @@ -189,7 +194,7 @@ wii: gc/ogc/libversion.h
@[ -d $(LIBS)/wii ] || mkdir -p $(LIBS)/wii
@[ -d $(DEPS)/wii ] || mkdir -p $(DEPS)/wii
@[ -d wii ] || mkdir -p wii
@$(MAKE) PLATFORM=wii libs -C wii -f $(CURDIR)/Makefile
@$(MAKE) PLATFORM=wii libs -C wii -f $(CURFILE)

#---------------------------------------------------------------------------------
cube: gc/ogc/libversion.h
Expand All @@ -198,12 +203,13 @@ cube: gc/ogc/libversion.h
@[ -d $(LIBS)/cube ] || mkdir -p $(LIBS)/cube
@[ -d $(DEPS)/cube ] || mkdir -p $(DEPS)/cube
@[ -d cube ] || mkdir -p cube
@$(MAKE) PLATFORM=cube libs -C cube -f $(CURDIR)/Makefile
@$(MAKE) PLATFORM=cube libs -C cube -f $(CURFILE)


#---------------------------------------------------------------------------------
gc/ogc/libversion.h : Makefile
gc/ogc/libversion.h : $(CURFILE)
#---------------------------------------------------------------------------------
@[ -d gc/ogc ] || mkdir -p gc/ogc
@echo "#ifndef __OGC_LIBVERSION_H__" > $@
@echo "#define __OGC_LIBVERSION_H__" >> $@
@echo >> $@
Expand Down Expand Up @@ -265,7 +271,7 @@ $(WIIUSELIB).a: $(WIIUSEOBJ)
.PHONY: libs wii cube install-headers install uninstall dist docs

#---------------------------------------------------------------------------------
install-headers:
install-headers: gc/ogc/libversion.h
#---------------------------------------------------------------------------------
@mkdir -p $(INCDIR)
@mkdir -p $(INCDIR)/ogc/machine
Expand All @@ -276,25 +282,26 @@ install-headers:
@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/sys/*.h $(INCDIR)/sys
@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
@cp $(BASEDIR)/gc/*.h $(INCDIR)
@cp $(BASEDIR)/gc/ogc/*.h $(INCDIR)/ogc
@cp $(BUILDDIR)/gc/ogc/*.h $(INCDIR)/ogc
@cp $(BASEDIR)/gc/ogc/machine/*.h $(INCDIR)/ogc/machine
@cp $(BASEDIR)/gc/sys/*.h $(INCDIR)/sys
@cp $(BASEDIR)/gc/bte/*.h $(INCDIR)/bte
@cp $(BASEDIR)/gc/wiiuse/*.h $(INCDIR)/wiiuse
@cp $(BASEDIR)/gc/modplay/*.h $(INCDIR)/modplay
@cp $(BASEDIR)/gc/sdcard/*.h $(INCDIR)/sdcard
@cp $(BASEDIR)/gc/di/*.h $(INCDIR)/di
@cp $(BASEDIR)/gc/wiikeyboard/*.h $(INCDIR)/wiikeyboard

#---------------------------------------------------------------------------------
install: wii cube install-headers
#---------------------------------------------------------------------------------
@mkdir -p $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv include $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv lib $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv libogc_license.txt $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv gamecube_rules wii_rules $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv $(BASEDIR)/libogc_license.txt $(DESTDIR)$(DEVKITPRO)/libogc2
@cp -frv $(BASEDIR)/{gamecube_rules,wii_rules} $(DESTDIR)$(DEVKITPRO)/libogc2

#---------------------------------------------------------------------------------
uninstall:
Expand All @@ -304,9 +311,10 @@ uninstall:
#---------------------------------------------------------------------------------
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 libogc2-src-$(VERSTRING).tar.bz2 *
@tar -C $(BASEDIR) --exclude-vcs --exclude-vcs-ignores --exclude .github \
-cvjf $(BUILDDIR)/libogc2-src-$(VERSTRING).tar.bz2 .

@cp $(BASEDIR)/{libogc_license.txt,gamecube_rules,wii_rules} .
@tar -cvjf libogc2-$(VERSTRING).tar.bz2 include lib libogc_license.txt gamecube_rules wii_rules


Expand All @@ -327,6 +335,7 @@ libs: $(LIBRARIES)
clean:
#---------------------------------------------------------------------------------
rm -fr wii cube
rm -fr gc/ogc/libversion.h
rm -fr $(DEPS)
rm -fr $(LIBS)
rm -fr $(INCDIR)
Expand All @@ -335,6 +344,6 @@ clean:
#---------------------------------------------------------------------------------
docs: install-headers
#---------------------------------------------------------------------------------
doxygen Doxyfile
@cd $(BASEDIR); doxygen Doxyfile

-include $(DEPSDIR)/*.d

0 comments on commit 9ea61ae

Please sign in to comment.