diff --git a/.gitignore b/.gitignore index 8ec4fe73..7f1b8941 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.current_build compile_commands.json build dist diff --git a/Makefile b/Makefile index e45dd112..b875837e 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/scripts/gba-pkg b/scripts/gba-pkg index e2504c69..a5a26976 100755 --- a/scripts/gba-pkg +++ b/scripts/gba-pkg @@ -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 diff --git a/scripts/run-make b/scripts/run-make deleted file mode 100755 index 28dfe61c..00000000 --- a/scripts/run-make +++ /dev/null @@ -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 diff --git a/scripts/setup-build b/scripts/setup-build index 50857bbd..a7243f45 100755 --- a/scripts/setup-build +++ b/scripts/setup-build @@ -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