[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 compile_commands.json
build build
dist dist

View File

@ -2,6 +2,7 @@ OS=$(shell uname | tr [:upper:] [:lower:])
HOST_ENV=${OS}-$(shell uname -m) HOST_ENV=${OS}-$(shell uname -m)
DEVENV=devenv$(shell pwd | sed 's/\//-/g') DEVENV=devenv$(shell pwd | sed 's/\//-/g')
DEVENV_IMAGE=nostalgia-devenv DEVENV_IMAGE=nostalgia-devenv
CURRENT_BUILD=$(file < .current_build)
ifneq ($(shell which gmake 2> /dev/null),) ifneq ($(shell which gmake 2> /dev/null),)
MAKE=gmake -s MAKE=gmake -s
else else
@ -14,41 +15,38 @@ ifneq ($(shell which docker 2> /dev/null),)
endif endif
ifeq ($(OS),darwin) ifeq ($(OS),darwin)
NOSTALGIA_STUDIO=./dist/current/nostalgia-studio.app/Contents/MacOS/nostalgia-studio NOSTALGIA_STUDIO=./dist/${CURRENT_BUILD}/nostalgia-studio.app/Contents/MacOS/nostalgia-studio
NOSTALGIA_STUDIO_PROFILE=dist/current/nostalgia-studio.app/Contents/Resources/nostalgia-studio.json NOSTALGIA_STUDIO_PROFILE=dist/${CURRENT_BUILD}/nostalgia-studio.app/Contents/Resources/nostalgia-studio.json
MGBA=/Applications/mGBA.app/Contents/MacOS/mGBA MGBA=/Applications/mGBA.app/Contents/MacOS/mGBA
else else
NOSTALGIA_STUDIO=./dist/current/bin/nostalgia-studio NOSTALGIA_STUDIO=./dist/${CURRENT_BUILD}/bin/nostalgia-studio
NOSTALGIA_STUDIO_PROFILE=dist/current/share/nostalgia-studio.json NOSTALGIA_STUDIO_PROFILE=dist/${CURRENT_BUILD}/share/nostalgia-studio.json
MGBA=mgba-qt MGBA=mgba-qt
endif endif
.PHONY: build .PHONY: build
build: build:
${ENV_RUN} ./scripts/run-make build $(foreach file, $(wildcard build/*), cmake --build $(file) --target;)
.PHONY: pkg-gba .PHONY: pkg-gba
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 ${ENV_RUN} ./scripts/gba-pkg
.PHONY: preinstall
preinstall:
${ENV_RUN} ./scripts/run-make build preinstall
.PHONY: install .PHONY: install
install: install:
${ENV_RUN} ./scripts/run-make build install $(foreach file, $(wildcard build/*), cmake --build $(file) --target install;)
.PHONY: clean .PHONY: clean
clean: clean:
${ENV_RUN} ./scripts/run-make build clean $(foreach file, $(wildcard build/*), cmake --build $(file) --target clean;)
.PHONY: purge .PHONY: purge
purge: purge:
${ENV_RUN} rm -rf build ${ENV_RUN} rm -rf build .current_build
.PHONY: test .PHONY: test
test: test:
${ENV_RUN} ./scripts/run-make build test $(foreach file, $(wildcard build/*), cmake --build $(file) --target test;)
.PHONY: run .PHONY: run
run: install run: install
${ENV_RUN} ./dist/current/bin/nostalgia sample_project ${ENV_RUN} ./dist/${CURRENT_BUILD}/bin/nostalgia sample_project
.PHONY: run-studio .PHONY: run-studio
run-studio: install run-studio: install
${ENV_RUN} ${NOSTALGIA_STUDIO} -profile ${NOSTALGIA_STUDIO_PROFILE} ${ENV_RUN} ${NOSTALGIA_STUDIO} -profile ${NOSTALGIA_STUDIO_PROFILE}
@ -57,7 +55,7 @@ gba-run: pkg-gba
${MGBA} nostalgia.gba ${MGBA} nostalgia.gba
.PHONY: gdb .PHONY: gdb
gdb: install 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 .PHONY: gdb-studio
gdb-studio: install gdb-studio: install
${ENV_RUN} gdb --args ${NOSTALGIA_STUDIO} -profile ${NOSTALGIA_STUDIO_PROFILE} ${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 padbin 32 $NOSTALGIA_BIN
ls -lh $NOSTALGIA_BIN ls -lh $NOSTALGIA_BIN
cat $NOSTALGIA_BIN $MEDIA_HEADER $NOSTALGIA_MEDIA > $NOSTALGIA_GBA cat $NOSTALGIA_BIN $MEDIA_HEADER $NOSTALGIA_MEDIA > $NOSTALGIA_GBA
rm -f $MEDIA_HEADER $NOSTALGIA_MEDIA rm -f $MEDIA_HEADER #$NOSTALGIA_MEDIA
gbafix $NOSTALGIA_GBA 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)/ project=$(pwd)/
buildTool="" buildTool=""
if [[ $TARGET == windows ]]; then if [[ $TARGET == gba ]]; then
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/Mingw.cmake"
buildTool="-GNinja"
elif [[ $TARGET == gba ]]; then
toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake" toolchain="-DCMAKE_TOOLCHAIN_FILE=cmake/modules/GBA.cmake"
nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA" nostalgiaBuildType="-DNOSTALGIA_BUILD_TYPE=GBA"
oxUseStdLib="-DOX_USE_STDLIB=OFF" oxUseStdLib="-DOX_USE_STDLIB=OFF"
@ -53,7 +50,6 @@ popd
rm -f build/current dist/current rm -f build/current dist/current
mkdir -p dist mkdir -p dist
ln -s ${TARGET}-${BUILD_TYPE} build/current echo ${TARGET}-${BUILD_TYPE} > .current_build
rm -f compile_commands.json rm -f compile_commands.json
ln -s build/current/compile_commands.json ln -s build/${TARGET}-${BUILD_TYPE}/compile_commands.json
ln -s ${TARGET}-${BUILD_TYPE} dist/current