From b78cfc1a6119315ba565463278c2f2e4412e95ba Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Wed, 4 Sep 2024 12:42:03 +0200 Subject: [PATCH] juliac: check whether the configured julia binary supports trimming --- juliac/Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/juliac/Makefile b/juliac/Makefile index 11d6869..bdba5ae 100644 --- a/juliac/Makefile +++ b/juliac/Makefile @@ -1,9 +1,9 @@ -JULIA ?= /opt/julia/julia-c/bin/julia +JULIA ?= $(shell which julia) JULIAC ?= $(shell $(JULIA) -e 'print(normpath(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "juliac.jl")))') RUNIC_FILES := $(wildcard ../src/*.jl) ../Project.toml -runicc: runicc.jl Project.toml Manifest.toml $(RUNIC_FILES) +runicc: runicc.jl Project.toml Manifest.toml $(RUNIC_FILES) check-julia $(JULIA) --project=. $(JULIAC) --output-exe $@ --trim=unsafe-warn $< Manifest.toml: Project.toml ../Project.toml @@ -13,7 +13,15 @@ Manifest.toml: Project.toml ../Project.toml clean: -rm -f runicc Manifest.toml +check-julia: + @if ! $(JULIA) --help-hidden | grep -s -q '\-\-trim'; then \ + echo "ERROR: The configured julia binary ($(JULIA)) does not support the --trim argument."; \ + echo " Configure the binary using the JULIA variable (e.g. \`JULIA=/path/to/julia make ...\`)"; \ + echo " or change how \`julia\` resolves in \`PATH\`."; \ + exit 1; \ + fi + print-%: @echo '$*=$($*)' -.PHONY: clean +.PHONY: clean check-julia