Use project name in Makefile throughout and pass to pkg-gba

This commit is contained in:
Gary Talent 2023-12-11 22:26:20 -06:00
parent dc233286b4
commit a60765b338
2 changed files with 13 additions and 12 deletions

View File

@ -3,29 +3,29 @@ BUILDCORE_PATH=deps/buildcore
include ${BUILDCORE_PATH}/base.mk
ifeq ($(BC_VAR_OS),darwin)
NOSTALGIA_STUDIO=./build/${BC_VAR_CURRENT_BUILD}/bin/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
NOSTALGIA_STUDIO=./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME}-studio.app/Contents/MacOS/${BC_VAR_PROJECT_NAME}-studio
MGBA=/Applications/mGBA.app/Contents/MacOS/mGBA
else
NOSTALGIA_STUDIO=./build/${BC_VAR_CURRENT_BUILD}/bin/nostalgia-studio
NOSTALGIA_STUDIO=./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME}-studio
MGBA=mgba-qt
endif
.PHONY: pkg-gba
pkg-gba: build
${BC_CMD_ENVRUN} ${BC_PY3} ./scripts/pkg-gba.py sample_project
${BC_CMD_ENVRUN} ${BC_PY3} ./scripts/pkg-gba.py sample_project ${BC_VAR_PROJECT_NAME}
.PHONY: run
run: build
./build/${BC_VAR_CURRENT_BUILD}/bin/nostalgia sample_project
./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME} sample_project
.PHONY: run-studio
run-studio: build
${NOSTALGIA_STUDIO}
.PHONY: gba-run
gba-run: pkg-gba
${MGBA} nostalgia.gba
${MGBA} ${BC_VAR_PROJECT_NAME}.gba
.PHONY: debug
debug: build
${BC_CMD_HOST_DEBUGGER} ./build/${BC_VAR_CURRENT_BUILD}/bin/nostalgia sample_project
${BC_CMD_HOST_DEBUGGER} ./build/${BC_VAR_CURRENT_BUILD}/bin/${BC_VAR_PROJECT_NAME} sample_project
.PHONY: debug-studio
debug-studio: build
${BC_CMD_HOST_DEBUGGER} ${NOSTALGIA_STUDIO}

View File

@ -21,12 +21,13 @@ host_env = f'{os}-{arch}'
with open(".current_build","r") as f:
current_build = f.readlines()[0]
project_dir = sys.argv[1]
project_name = sys.argv[2]
bin = f'./build/{host_env}-{current_build}/bin/'
nostalgia_bin = 'build/gba-release/bin/nostalgia.bin'
nostalgia_project = sys.argv[1]
nostalgia_gba = 'nostalgia.gba'
project_bin = f'build/gba-release/bin/{project_name}.bin'
project_gba = f'{project_name}.gba'
shutil.copyfile(nostalgia_bin, nostalgia_gba)
shutil.copyfile(project_bin, project_gba)
subprocess.run([
f'{bin}/nostalgia-pack', '-src', nostalgia_project, '-rom-bin', nostalgia_gba])
subprocess.run(['gbafix', nostalgia_gba])
f'{bin}/{project_name}-pack', '-src', project_dir, '-rom-bin', project_gba])
subprocess.run(['gbafix', project_gba])