-
-
Save nnevatie/9fe11e3933ed3f51e5344639c6881bd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BIN=/home/osboxes/devkitPro/devkitARM/bin | |
CXX=$BIN/arm-none-eabi-g++ | |
AR=$BIN/arm-none-eabi-ar | |
LD=$BIN/arm-none-eabi-g++ | |
# Create output dir | |
mkdir -p tmp | |
CXX_FLAGS="-nostdinc++ -std=c++14 -fno-exceptions -mcpu=arm7tdmi -march=armv4t -mthumb -mthumb-interwork -fPIC -fno-common -nodefaultlibs -nostdlib" | |
# Build library objects | |
CXX_LIB="$CXX -c -I include -I include/saturn $CXX_FLAGS" | |
$CXX_LIB src/bios.cc -o tmp/bios.o | |
$CXX_LIB src/bootsector.s -o tmp/bootsector.o | |
$CXX_LIB src/error.cc -o tmp/error.o | |
$CXX_LIB src/init.cc -o tmp/init.o | |
$CXX_LIB src/lowbios.s -o tmp/lowbios.o | |
$CXX_LIB src/mainloop.cc -o tmp/mainloop.o | |
$CXX_LIB src/math.cc -o tmp/math.o | |
$CXX_LIB src/memory.cc -o tmp/memory.o | |
# Archive libsaturn | |
AR_FLAGS="-rucs --target=elf32-littlearm" | |
$AR $AR_FLAGS tmp/libsaturn.a tmp/bios.o tmp/bootsector.o tmp/error.o tmp/init.o tmp/lowbios.o tmp/mainloop.o tmp/math.o tmp/memory.o | |
# Build main | |
CXX_MAIN="$CXX -c -I include -I include/saturn $CXX_FLAGS" | |
$CXX_MAIN test/src/main.cc -o tmp/main.o | |
# Link main | |
LD_FLAGS="-Ltmp -lsaturn -nostdlib -T util/gba.ld --whole-file" | |
$LD tmp/main.o -o tmp/main.bin $LD_FLAGS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment