Skip to content

Commit

Permalink
Allow rgbds to build SameBoy's BootROMs for testing
Browse files Browse the repository at this point in the history
rgbds needs to use a local copy of its executables for testing,
passed as an `RGBDS=../../` prefix for the path to them all.

This commit enables that, so rgbds can do
    test_downstream LIJI32/SameBoy bootroms
in its run-tests.sh script.
  • Loading branch information
Rangi42 committed Dec 6, 2023
1 parent eba273d commit 6d3a657
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ override CONF := release
FAT_FLAGS += -arch x86_64 -arch arm64
endif

# Support out-of-PATH RGBDS
RGBASM := $(RGBDS)rgbasm
RGBLINK := $(RGBDS)rgblink
RGBGFX := $(RGBDS)rgbgfx



# Set compilation and linkage flags based on target, platform and configuration
Expand Down Expand Up @@ -596,7 +601,7 @@ $(BIN)/SDL/Palettes: Misc/Palettes

$(OBJ)/%.2bpp: %.png
-@$(MKDIR) -p $(dir $@)
rgbgfx $(if $(filter $(shell echo 'print __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 5)' | rgbasm -), $$0), -h -u, -Z -u -c embedded) -o $@ $<
$(RGBGFX) $(if $(filter $(shell echo 'print __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 5)' | $(RGBASM) -), $$0), -h -u, -Z -u -c embedded) -o $@ $<

$(OBJ)/BootROMs/SameBoyLogo.pb12: $(OBJ)/BootROMs/SameBoyLogo.2bpp $(PB12_COMPRESS)
-@$(MKDIR) -p $(dir $@)
Expand All @@ -613,8 +618,8 @@ $(BIN)/BootROMs/sgb2_boot: BootROMs/sgb_boot.asm

$(BIN)/BootROMs/%.bin: BootROMs/%.asm $(OBJ)/BootROMs/SameBoyLogo.pb12
-@$(MKDIR) -p $(dir $@)
rgbasm -i $(OBJ)/BootROMs/ -i BootROMs/ -o $@.tmp $<
rgblink -o $@.tmp2 $@.tmp
$(RGBASM) -i $(OBJ)/BootROMs/ -i BootROMs/ -o $@.tmp $<
$(RGBLINK) -o $@.tmp2 $@.tmp
dd if=$@.tmp2 of=$@ count=1 bs=$(if $(findstring dmg,$@)$(findstring sgb,$@)$(findstring mgb,$@),256,2304) 2> $(NULL)
@rm $@.tmp $@.tmp2

Expand Down Expand Up @@ -724,4 +729,4 @@ lib-unsupported:
clean:
rm -rf build

.PHONY: libretro tester cocoa ios _ios ios-ipa ios-deb liblib-unsupported
.PHONY: libretro tester cocoa ios _ios ios-ipa ios-deb liblib-unsupported bootroms

0 comments on commit 6d3a657

Please sign in to comment.