[nostalgia] Remove need for run-make and "current" symlinks

This commit is contained in:
Gary Talent 2020-01-09 18:30:35 -06:00
parent 2fab740bf5
commit 08483e6e2f
5 changed files with 18 additions and 31 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.current_build
compile_commands.json
build
dist

View File

@ -2,6 +2,7 @@ OS=$(shell uname | tr [:upper:] [:lower:])
HOST_ENV=${OS}-$(shell uname -m)
DEVENV=devenv$(shell pwd | sed 's/\//-/g')
DEVENV_IMAGE=nostalgia-devenv
CURRENT_BUILD=$(file < .current_build)
ifneq ($(shell which gmake 2> /dev/null),)
MAKE=gmake -s
else
@ -14,41 +15,38 @@ ifneq ($(shell which docker 2> /dev/null),)
endif
ifeq ($(OS),darwin)
NOSTALGIA_STUDIO=./dist/current/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
NOSTALGIA_STUDIO_PROFILE=dist/current/nostalgia-studio.app/Contents/Resources/nostalgia-studio.json
NOSTALGIA_STUDIO=./dist/${CURRENT_BUILD}/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
NOSTALGIA_STUDIO_PROFILE=dist/${CURRENT_BUILD}/nostalgia-studio.app/Contents/Resources/nostalgia-studio.json
MGBA=/Applications/mGBA.app/Contents/MacOS/mGBA
else
NOSTALGIA_STUDIO=./dist/current/bin/nostalgia-studio
NOSTALGIA_STUDIO_PROFILE=dist/current/share/nostalgia-studio.json
NOSTALGIA_STUDIO=./dist/${CURRENT_BUILD}/bin/nostalgia-studio
NOSTALGIA_STUDIO_PROFILE=dist/${CURRENT_BUILD}/share/nostalgia-studio.json
MGBA=mgba-qt
endif
.PHONY: build
build:
${ENV_RUN} ./scripts/run-make build
$(foreach file, $(wildcard build/*), cmake --build $(file) --target;)
.PHONY: pkg-gba
pkg-gba:
${ENV_RUN} ./scripts/run-make build install
$(foreach file, $(wildcard build/*), cmake --build $(file) --target install;)
${ENV_RUN} ./scripts/gba-pkg
.PHONY: preinstall
preinstall:
${ENV_RUN} ./scripts/run-make build preinstall
.PHONY: install
install:
${ENV_RUN} ./scripts/run-make build install
$(foreach file, $(wildcard build/*), cmake --build $(file) --target install;)
.PHONY: clean
clean:
${ENV_RUN} ./scripts/run-make build clean
$(foreach file, $(wildcard build/*), cmake --build $(file) --target clean;)
.PHONY: purge
purge:
${ENV_RUN} rm -rf build
${ENV_RUN} rm -rf build .current_build
.PHONY: test
test:
${ENV_RUN} ./scripts/run-make build test
$(foreach file, $(wildcard build/*), cmake --build $(file) --target test;)
.PHONY: run
run: install
${ENV_RUN} ./dist/current/bin/nostalgia sample_project
${ENV_RUN} ./dist/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: run-studio
run-studio: install
${ENV_RUN} ${NOSTALGIA_STUDIO} -profile ${NOSTALGIA_STUDIO_PROFILE}
@ -57,7 +55,7 @@ gba-run: pkg-gba
${MGBA} nostalgia.gba
.PHONY: gdb
gdb: install
${ENV_RUN} gdb --args ./dist/current/bin/nostalgia sample_project
${ENV_RUN} gdb --args ./dist/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: gdb-studio
gdb-studio: install
${ENV_RUN} gdb --args ${NOSTALGIA_STUDIO} -profile ${NOSTALGIA_STUDIO_PROFILE}

View File

@ -17,5 +17,5 @@ nost-pack -src $NOSTALGIA_PROJECT -dst $NOSTALGIA_MEDIA
padbin 32 $NOSTALGIA_BIN
ls -lh $NOSTALGIA_BIN
cat $NOSTALGIA_BIN $MEDIA_HEADER $NOSTALGIA_MEDIA > $NOSTALGIA_GBA
rm -f $MEDIA_HEADER $NOSTALGIA_MEDIA
rm -f $MEDIA_HEADER #$NOSTALGIA_MEDIA
gbafix $NOSTALGIA_GBA

View File

@ -1,8 +0,0 @@
#! /usr/bin/env bash
set -e
for f in $(find $1 -maxdepth 1 -mindepth 1 -type d)
do
cmake --build "$f" --target $2
done

View File

@ -6,10 +6,7 @@ BUILD_TYPE=$2
project=$(pwd)/
buildTool=""
if [[ $TARGET == windows ]]; then
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/Mingw.cmake"
buildTool="-GNinja"
elif [[ $TARGET == gba ]]; then
if [[ $TARGET == gba ]]; then
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake"
nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
oxUseStdLib="-DOX_USE_STDLIB=OFF"
@ -53,7 +50,6 @@ popd
rm -f build/current dist/current
mkdir -p dist
ln -s ${TARGET}-${BUILD_TYPE} build/current
echo ${TARGET}-${BUILD_TYPE} > .current_build
rm -f compile_commands.json
ln -s build/current/compile_commands.json
ln -s ${TARGET}-${BUILD_TYPE} dist/current
ln -s build/${TARGET}-${BUILD_TYPE}/compile_commands.json