LIJI32 / SameBoy

Game Boy and Game Boy Color emulator written in C
https://sameboy.github.io/
Other
1.68k stars 211 forks source link

Ability to pass additional parameters to libretro make script #141

Open ofry opened 5 years ago

ofry commented 5 years ago

For example,

DEBUG=1 etc.

I think it's related to #111

orbea commented 5 years ago

@ofry This is not an issue really.

make -C libretro DEBUG=1

or

cd libretro
make DEBUG=1
ofry commented 5 years ago

I mean this:

# Libretro Core (uses its own build system)
libretro:
$(MAKE) -C libretro
orbea commented 5 years ago

Just use the libretro makefile for the libretro core...

ofry commented 5 years ago

@orbea

Hm... maybe this issue and https://github.com/LIJI32/SameBoy/issues/111 aren't major, but could you fix it in this repo?

orbea commented 5 years ago

I'm not sure about mingw since I have never used it and don't have windows, but for reference I build the libretro core with this repo.

  1. Build rgbds (https://github.com/rednex/rgbds) and add it the the $PATH.
  2. make bootroms
  3. make -C libretro
ofry commented 5 years ago
ofry@games MINGW64 ~/main-sameboy
$ make bootroms
cd BootROMs && rgbasm -o ../build/bin/BootROMs/agb_boot.bin.tmp ../BootROMs/agb_boot.asm
rgblink -o build/bin/BootROMs/agb_boot.bin.tmp2 build/bin/BootROMs/agb_boot.bin.tmp
head -c  2304 build/bin/BootROMs/agb_boot.bin.tmp2 > build/bin/BootROMs/agb_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/cgb_boot.bin.tmp ../BootROMs/cgb_boot.asm
rgblink -o build/bin/BootROMs/cgb_boot.bin.tmp2 build/bin/BootROMs/cgb_boot.bin.tmp
head -c  2304 build/bin/BootROMs/cgb_boot.bin.tmp2 > build/bin/BootROMs/cgb_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/dmg_boot.bin.tmp ../BootROMs/dmg_boot.asm
rgblink -o build/bin/BootROMs/dmg_boot.bin.tmp2 build/bin/BootROMs/dmg_boot.bin.tmp
head -c  256 build/bin/BootROMs/dmg_boot.bin.tmp2 > build/bin/BootROMs/dmg_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/sgb_boot.bin.tmp ../BootROMs/sgb_boot.asm
rgblink -o build/bin/BootROMs/sgb_boot.bin.tmp2 build/bin/BootROMs/sgb_boot.bin.tmp
head -c  256 build/bin/BootROMs/sgb_boot.bin.tmp2 > build/bin/BootROMs/sgb_boot.bin
cd BootROMs && rgbasm -o ../build/bin/BootROMs/sgb2_boot.bin.tmp ../BootROMs/sgb2_boot.asm
rgblink -o build/bin/BootROMs/sgb2_boot.bin.tmp2 build/bin/BootROMs/sgb2_boot.bin.tmp
head -c  256 build/bin/BootROMs/sgb2_boot.bin.tmp2 > build/bin/BootROMs/sgb2_boot.bin

ofry@games MINGW64 ~/main-sameboy
$ make -C libretro
make: вход в каталог «/home/ofry/main-sameboy/libretro»
gcc -c -o ../build/obj/../Core/gb_libretro.c.o ../Core/gb.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
../Core/gb.c: In function 'GB_is_inited':
../Core/gb.c:521:25: warning: multi-character character constant [-Wmultichar]
     return gb->magic == 'SAME';
                         ^~~~~~
../Core/gb.c: In function 'reset_ram':
../Core/gb.c:561:31: warning: implicit declaration of function 'random'; did you mean 'rand'? [-Wimplicit-function-declaration]
                 gb->ram[i] = (random() & 0xFF);
                               ^~~~~~
                               rand
../Core/gb.c: In function 'GB_reset':
../Core/gb.c:687:28: warning: multi-character character constant [-Wmultichar]
     gb->magic = (uintptr_t)'SAME';
                            ^~~~~~
gcc -c -o ../build/obj/../Core/memory_libretro.c.o ../Core/memory.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/timing_libretro.c.o ../Core/timing.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
gcc -c -o ../build/obj/../Core/sm83_cpu_libretro.c.o ../Core/sm83_cpu.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
../Core/sm83_cpu.c: In function 'rlc_r':
../Core/sm83_cpu.c:1173:17: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
     if (!(value << 1)) {
          ~~~~~~~^~~~~
echo "/* AUTO-GENERATED */" > ../libretro/agb_boot.c
echo "const unsigned char agb_boot[] = {" >> ../libretro/agb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/agb_boot.bin >> ../libretro/agb_boot.c
echo "};" >> ../libretro/agb_boot.c
echo "const unsigned agb_boot_length = sizeof(agb_boot);" >> ../libretro/agb_boot.c
gcc -c -o ../build/obj/../libretro/agb_boot_libretro.c.o ../libretro/agb_boot.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
echo "/* AUTO-GENERATED */" > ../libretro/cgb_boot.c
echo "const unsigned char cgb_boot[] = {" >> ../libretro/cgb_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/cgb_boot.bin >> ../libretro/cgb_boot.c
echo "};" >> ../libretro/cgb_boot.c
echo "const unsigned cgb_boot_length = sizeof(cgb_boot);" >> ../libretro/cgb_boot.c
gcc -c -o ../build/obj/../libretro/cgb_boot_libretro.c.o ../libretro/cgb_boot.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
echo "/* AUTO-GENERATED */" > ../libretro/dmg_boot.c
echo "const unsigned char dmg_boot[] = {" >> ../libretro/dmg_boot.c
hexdump -v -e '/1 "0x%02x, "' ../build/bin/BootROMs/dmg_boot.bin >> ../libretro/dmg_boot.c
echo "};" >> ../libretro/dmg_boot.c
echo "const unsigned dmg_boot_length = sizeof(dmg_boot);" >> ../libretro/dmg_boot.c
gcc -c -o ../build/obj/../libretro/dmg_boot_libretro.c.o ../libretro/dmg_boot.c -DGIT_VERSION=\"" 4536581"\" -DSAMEBOY_CORE_VERSION=\"\" -O2 -DNDEBUG -DDISABLE_TIMEKEEPING -DDISABLE_REWIND -DDISABLE_DEBUGGER -Wall -D__LIBRETRO__  -I.. -std=gnu11 -D_GNU_SOURCE -D_USE_MATH_DEFINES  -DGB_INTERNAL
gcc  -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=../libretro/link.T -Wl,--no-undefined -I.. -o ../build/bin/sameboy_libretro.dll ../build/obj/../Core/gb_libretro.c.o ../build/obj/../Core/apu_libretro.c.o ../build/obj/../Core/memory_libretro.c.o ../build/obj/../Core/mbc_libretro.c.o ../build/obj/../Core/timing_libretro.c.o ../build/obj/../Core/display_libretro.c.o ../build/obj/../Core/symbol_hash_libretro.c.o ../build/obj/../Core/camera_libretro.c.o ../build/obj/../Core/sm83_cpu_libretro.c.o ../build/obj/../Core/joypad_libretro.c.o ../build/obj/../Core/save_state_libretro.c.o ../build/obj/../libretro/agb_boot_libretro.c.o ../build/obj/../libretro/cgb_boot_libretro.c.o ../build/obj/../libretro/dmg_boot_libretro.c.o ../build/obj/../libretro/libretro_libretro.c.o -lm
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xde1): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xde8): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xdef): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xe21): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xf67): undefined reference to `GB_sgb_load_default_data'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xfa5): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0xfe4): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x1001): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x101a): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x1041): undefined reference to `random'
../build/obj/../Core/gb_libretro.c.o:gb.c:(.text+0x104d): more undefined references to `random' follow
../build/obj/../Core/apu_libretro.c.o:apu.c:(.text+0xf5c): undefined reference to `GB_sgb_render_jingle'
../build/obj/../Core/memory_libretro.c.o:memory.c:(.text+0xbb6): undefined reference to `GB_sgb_write'
../build/obj/../Core/display_libretro.c.o:display.c:(.text+0x227): undefined reference to `GB_sgb_render'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:182: ../build/bin/sameboy_libretro.dll] Ошибка 1
rm ../libretro/cgb_boot.c ../libretro/dmg_boot.c ../libretro/agb_boot.c
make: выход из каталога «/home/ofry/main-sameboy/libretro»
orbea commented 5 years ago

Looks specific to mingw, I suppose the solution is discussed in https://github.com/LIJI32/SameBoy/issues/111#issuecomment-417947667.

ofry commented 5 years ago

Could you port fix from branch https://github.com/libretro/SameBoy/tree/buildbot to this repo?

orbea commented 5 years ago

I'm not sure that is a fix so much as a workaround? @LIJI32 Would probably know more.