introduce `NIMC` to control which `nim` to call (#53)

This commit is contained in:
Jacek Sieka 2022-11-24 17:07:01 +01:00 committed by GitHub
parent dc535cd462
commit 8c59324e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -47,7 +47,7 @@ update: | update-common
# building Nim programs # building Nim programs
foo bar: | build deps foo bar: | build deps
echo -e $(BUILD_MSG) "build/$@" && \ 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 clean: | clean-common
rm -rf build/{foo,bar} rm -rf build/{foo,bar}

View File

@ -15,6 +15,8 @@ CC ?= gcc
endif endif
LD := $(CC) LD := $(CC)
NIMC ?= nim
#- extra parameters for the Nim compiler #- extra parameters for the Nim compiler
#- NIMFLAGS should come from the environment or make's command line #- NIMFLAGS should come from the environment or make's command line
NIM_PARAMS := $(NIMFLAGS) NIM_PARAMS := $(NIMFLAGS)

View File

@ -11,6 +11,8 @@
## get native Windows paths on Mingw ## get native Windows paths on Mingw
#uname | grep -qi mingw && PWD_CMD="pwd -W" #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 # 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. # and we fall back to a Zsh-specific special var to also support Zsh.
export REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})" export REL_PATH="$(dirname ${BASH_SOURCE[0]:-${(%):-%x}})"
@ -34,7 +36,7 @@ export PATH="${NIMBLE_DIR}/bin:${PATH}"
if [[ "$USE_SYSTEM_NIM" != "1" ]]; then if [[ "$USE_SYSTEM_NIM" != "1" ]]; then
export PATH="${NIM_PATH}:${PATH}" export PATH="${NIM_PATH}:${PATH}"
else else
echo "[using system Nim: $(which nim)]" 1>&2 echo "[using system Nim: $(which $NIMC)]" 1>&2
fi fi
if [[ -n "${NIM_COMMIT}" && "${NIM_COMMIT}" != "nimbus" ]]; then if [[ -n "${NIM_COMMIT}" && "${NIM_COMMIT}" != "nimbus" ]]; then

View File

@ -32,5 +32,5 @@ cleanup() {
[ -e "$NIMS" ] || { ln -s "$F" "$NIMS"; trap cleanup EXIT; } [ -e "$NIMS" ] || { ln -s "$F" "$NIMS"; trap cleanup EXIT; }
# can't have an "exec" here or the EXIT pseudo-signal won't be triggered # 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"