Fix build.

This commit is contained in:
Hana Nova 2025-02-26 05:23:26 +01:00
parent d9456244e0
commit 5fad7f347a
8 changed files with 6826 additions and 6872 deletions

2
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"type": "emulicious-debugger", "type": "emulicious-debugger",
"request": "launch", "request": "launch",
"name": "Launch in Emulicious", "name": "Launch in Emulicious",
"program": "${workspaceFolder}\\bin\\PandorasBlocks.gbc", "program": "${workspaceFolder}/bin/PandorasBlocks.gbc",
"port": 58870, "port": 58870,
"stopOnEntry": false, "stopOnEntry": false,
"preLaunchTask": "buildrom" "preLaunchTask": "buildrom"

View File

@ -1,99 +1,54 @@
.SUFFIXES: .SUFFIXES:
################################################ RM_RF := rm -rf
# # MKDIR_P := mkdir -p
# CONSTANT DEFINITIONS # ifeq ($(strip $(shell which rm)),)
# # RM_RF := -rmdir /s /q
################################################ MKDIR_P := -mkdir
# Directory constants
BINDIR := bin
OBJDIR := obj
DEPDIR := dep
# Program constants
ifneq ($(strip $(shell which rm)),)
# POSIX OSes
RM_RF := rm -rf
MKDIR_P := mkdir -p
PY :=
filesize = printf 'NB_PB$2_BLOCKS equ ((%u) + $2 - 1) / $2\n' "`wc -c <$1`"
else
# Windows outside of a POSIX env (Cygwin, MSYS2, etc.)
# We need Powershell to get any sort of decent functionality
$(warning Powershell is required to get basic functionality)
RM_RF := -del /q
MKDIR_P := -mkdir
PY := python
filesize = powershell Write-Output $$('NB_PB$2_BLOCKS equ ' + [string] [int] (([IO.File]::ReadAllBytes('$1').Length + $2 - 1) / $2))
endif endif
# Shortcut if you want to use a local copy of RGBDS RGBDS ?=
RGBDS :=
RGBASM := $(RGBDS)rgbasm RGBASM := $(RGBDS)rgbasm
RGBLINK := $(RGBDS)rgblink RGBLINK := $(RGBDS)rgblink
RGBFIX := $(RGBDS)rgbfix RGBFIX := $(RGBDS)rgbfix
RGBGFX := $(RGBDS)rgbgfx RGBGFX := $(RGBDS)rgbgfx
ROM = $(BINDIR)/$(ROMNAME).$(ROMEXT) ROM = bin/$(ROMNAME).$(ROMEXT)
# Argument constants
INCDIRS = src/ src/include/ INCDIRS = src/ src/include/
WARNINGS = all extra WARNINGS = all extra
ASFLAGS = -p 0xFF $(addprefix -i,$(INCDIRS)) $(addprefix -W,$(WARNINGS)) ASFLAGS = -p ${PADVALUE} $(addprefix -I,${INCDIRS}) $(addprefix -W,${WARNINGS})
LDFLAGS = -p 0xFF LDFLAGS = -p ${PADVALUE}
FIXFLAGS = -p 0xFF -l 0x33 -r 0x04 -v -i $(GAMEID) -k $(LICENSEE) -t $(TITLE) -n $(VERSION) -m $(MAPPER) FIXFLAGS = -p ${PADVALUE} -i "${GAMEID}" -k "${LICENSEE}" -l ${OLDLIC} -m ${MBC} -n ${VERSION} -r ${SRAMSIZE} -t ${TITLE}
# The list of "root" ASM files that RGBASM will be invoked on
SRCS = $(wildcard src/*.asm) SRCS = $(wildcard src/*.asm)
## Project-specific configuration
# Use this to override the above
include project.mk include project.mk
# `all` (Default target): build the ROM
all: $(ROM) all: $(ROM)
.PHONY: all .PHONY: all
# `clean`: Clean temp and bin files
clean: clean:
$(RM_RF) $(BINDIR) $(RM_RF) dep obj bin
$(RM_RF) $(OBJDIR)
$(RM_RF) $(DEPDIR)
$(RM_RF) res
.PHONY: clean .PHONY: clean
# `rebuild`: Build everything from scratch
# It's important to do these two in order if we're using more than one job
rebuild: rebuild:
$(MAKE) clean $(MAKE) clean
$(MAKE) all $(MAKE) all
.PHONY: rebuild .PHONY: rebuild
bin/%.${ROMEXT}: $(patsubst src/%.asm,obj/%.o,${SRCS})
@${MKDIR_P} "${@D}"
${RGBLINK} ${LDFLAGS} -m bin/$*.map -n bin/$*.sym -o $@ $^ \
&& ${RGBFIX} -v ${FIXFLAGS} $@
obj/%.mk: src/%.asm
@${MKDIR_P} "${@D}"
${RGBASM} ${ASFLAGS} -M $@ -MG -MP -MQ ${@:.mk=.o} -MQ $@ -o ${@:.mk=.o} $<
# How to build a ROM obj/%.o: obj/%.mk
$(BINDIR)/%.$(ROMEXT) $(BINDIR)/%.sym $(BINDIR)/%.map: $(patsubst src/%.asm,$(OBJDIR)/%.o,$(SRCS)) @touch $@
@$(MKDIR_P) $(@D)
$(RGBLINK) $(LDFLAGS) -m $(BINDIR)/$*.map -n $(BINDIR)/$*.sym -o $(BINDIR)/$*.$(ROMEXT) $^ \
&& $(RGBFIX) -v $(FIXFLAGS) $(BINDIR)/$*.$(ROMEXT)
# `.mk` files are auto-generated dependency lists of the "root" ASM files, to save a lot of hassle. ifeq ($(filter clean,${MAKECMDGOALS}),)
# Also add all obj dependencies to the dep file too, so Make knows to remake it include $(patsubst src/%.asm,obj/%.mk,${SRCS})
# Caution: some of these flags were added in RGBDS 0.4.0, using an earlier version WILL NOT WORK
# (and produce weird errors)
$(OBJDIR)/%.o $(DEPDIR)/%.mk: src/%.asm
@$(MKDIR_P) $(patsubst %/,%,$(dir $(OBJDIR)/$* $(DEPDIR)/$*))
$(RGBASM) $(ASFLAGS) -M $(DEPDIR)/$*.mk -MG -MP -MQ $(OBJDIR)/$*.o -MQ $(DEPDIR)/$*.mk -o $(OBJDIR)/$*.o $<
ifneq ($(MAKECMDGOALS),clean)
-include $(patsubst src/%.asm,$(DEPDIR)/%.mk,$(SRCS))
endif endif
# Catch non-existent files
# KEEP THIS LAST!!
%:
@false

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

16
deploy.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
echo "Cleaning..."
make clean >/dev/null
echo "Making pocket version."
rm src/include/hardware.inc >/dev/null
cp src/include/hardware.analogue src/include/hardware.inc >/dev/null
make >/dev/null
echo "Fixing pocket version."
mv bin/PandorasBlocks.gbc bin/PandorasBlocks.pocket >/dev/null
python patch_pocket.py >/dev/null
rgbfix -fhg -O bin/PandorasBlocks.pocket >/dev/null
echo "Making regular version."
rm -rf obj >/dev/null
rm src/include/hardware.inc >/dev/null
cp src/include/hardware.nintendo src/include/hardware.inc >/dev/null
make >/dev/null

View File

@ -1,29 +1,12 @@
# ROM Version PADVALUE := 0xFF
VERSION := 0x01 VERSION := 0x01
# 4 Character Game ID
GAMEID := DTGM GAMEID := DTGM
# ROM Title (14 chars max)
TITLE := DMGTRIS TITLE := DMGTRIS
# "Licensee" code (2 chars)
LICENSEE := NR LICENSEE := NR
OLDLIC := 0x33
# Output options MBC := 0x1B
SRAMSIZE := 0x04
ROMNAME := PandorasBlocks ROMNAME := PandorasBlocks
ROMEXT := gbc ROMEXT := gbc
# Mapper
MAPPER := 0x1B
# Extra assembler flags
# Do not insert nop after halt
ASFLAGS += -h
# 8.24 fixed point.
ASFLAGS += -Q 25 ASFLAGS += -Q 25
# Extra fix flags
# Set as gbc compatible
FIXFLAGS += -c FIXFLAGS += -c