diff --git a/Makefile.superproject.example b/Makefile.superproject.example index f30a7b5..e2cebae 100644 --- a/Makefile.superproject.example +++ b/Makefile.superproject.example @@ -47,7 +47,7 @@ update: | update-common # building Nim programs foo bar: | build deps echo -e $(BUILD_MSG) "build/$@" && \ - $(ENV_SCRIPT) nim c -o:build/$@ $(NIM_PARAMS) "$@.nim" + $(ENV_SCRIPT) "$(NIMC)" c -o:build/$@ $(NIM_PARAMS) "$@.nim" clean: | clean-common rm -rf build/{foo,bar} diff --git a/makefiles/variables.mk b/makefiles/variables.mk index 229e4a5..586bad8 100644 --- a/makefiles/variables.mk +++ b/makefiles/variables.mk @@ -15,6 +15,8 @@ CC ?= gcc endif LD := $(CC) +NIMC ?= nim + #- extra parameters for the Nim compiler #- NIMFLAGS should come from the environment or make's command line NIM_PARAMS := $(NIMFLAGS) diff --git a/scripts/env.sh b/scripts/env.sh index d2298ff..e37b5fc 100755 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -11,6 +11,8 @@ ## get native Windows paths on Mingw #uname | grep -qi mingw && PWD_CMD="pwd -W" +export NIMC=${NIMC:-nim} + # We use ${BASH_SOURCE[0]} instead of $0 to allow sourcing this file # and we fall back to a Zsh-specific special var to also support Zsh. export REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})" @@ -34,7 +36,7 @@ export PATH="${NIMBLE_DIR}/bin:${PATH}" if [[ "$USE_SYSTEM_NIM" != "1" ]]; then export PATH="${NIM_PATH}:${PATH}" else - echo "[using system Nim: $(which nim)]" 1>&2 + echo "[using system Nim: $(which $NIMC)]" 1>&2 fi if [[ -n "${NIM_COMMIT}" && "${NIM_COMMIT}" != "nimbus" ]]; then diff --git a/scripts/nimble.sh b/scripts/nimble.sh index 933b293..7521f3d 100755 --- a/scripts/nimble.sh +++ b/scripts/nimble.sh @@ -32,5 +32,5 @@ cleanup() { [ -e "$NIMS" ] || { ln -s "$F" "$NIMS"; trap cleanup EXIT; } # can't have an "exec" here or the EXIT pseudo-signal won't be triggered -$(dirname $0)/env.sh nim "$@" "$NIMS" +$(dirname $0)/env.sh "$NIMC" "$@" "$NIMS"