From 7ddf3b6f5739ec44f7f0cc257641638971bac5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Tue, 30 Nov 2021 14:40:50 +0100 Subject: [PATCH 1/2] Fix LLVM_CONFIG not be a prerequisite --- Makefile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index b4653bd7dbbb..bf6cb921fa15 100644 --- a/Makefile +++ b/Makefile @@ -61,12 +61,10 @@ ifeq ($(shell command -v ld.lld >/dev/null && uname -s),Linux) EXPORT_CC ?= CC="cc -fuse-ld=lld" endif -.PHONY: LLVM_CONFIG -LLVM_CONFIG: - @test ! -z "$(LLVM_CONFIG)" -a ! -z "$$($(LLVM_CONFIG) --version 2> /dev/null)" || \ - (echo >&2 "\033[33mCould not locate compatible llvm-config, make sure it is installed and in your PATH, or set LLVM_CONFIG. Compatible versions: $(shell cat src/llvm/ext/llvm-versions.txt)\033[0m" && false) - - @echo >&2 "\033[33mUsing $(LLVM_CONFIG) [version=$$($(LLVM_CONFIG) --version)]\033[0m" +check_llvm_config = $(eval check_llvm_config := $(if $(shell $(LLVM_CONFIG) --version),\ + $(shell echo >&2 "\033[33mUsing $(LLVM_CONFIG) [version=$$($(LLVM_CONFIG) --version)]\033[0m"),\ + $(error "Could not locate compatible llvm-config, make sure it is installed and in your PATH, or set LLVM_CONFIG. Compatible versions: $(shell cat src/llvm/ext/llvm-versions.txt)))\ + )$(check_llvm_config) .PHONY: all all: crystal ## Build all files (currently crystal only) [default] @@ -108,7 +106,8 @@ samples: $(MAKE) -C samples .PHONY: docs -docs: LLVM_CONFIG ## Generate standard library documentation +docs: ## Generate standard library documentation + $(call check_llvm_config) ./bin/crystal docs src/docs_main.cr $(DOCS_OPTIONS) --project-name=Crystal --project-version=$(CRYSTAL_VERSION) --source-refname=$(CRYSTAL_CONFIG_BUILD_COMMIT) .PHONY: crystal @@ -156,23 +155,28 @@ uninstall_docs: ## Uninstall docs from DESTDIR rm -rf "$(DATADIR)/docs" rm -rf "$(DATADIR)/examples" -$(O)/all_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES) LLVM_CONFIG +$(O)/all_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES) + $(call check_llvm_config) @mkdir -p $(O) $(EXPORT_CC) $(EXPORTS) ./bin/crystal build $(FLAGS) $(SPEC_WARNINGS_OFF) -o $@ spec/all_spec.cr -$(O)/std_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES) LLVM_CONFIG +$(O)/std_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES) + $(call check_llvm_config) @mkdir -p $(O) $(EXPORT_CC) ./bin/crystal build $(FLAGS) $(SPEC_WARNINGS_OFF) -o $@ spec/std_spec.cr -$(O)/compiler_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES) LLVM_CONFIG +$(O)/compiler_spec: $(DEPS) $(SOURCES) $(SPEC_SOURCES) + $(call check_llvm_config) @mkdir -p $(O) $(EXPORT_CC) $(EXPORTS) ./bin/crystal build $(FLAGS) $(SPEC_WARNINGS_OFF) -o $@ spec/compiler_spec.cr -$(O)/crystal: $(DEPS) $(SOURCES) LLVM_CONFIG +$(O)/crystal: $(DEPS) $(SOURCES) + $(call check_llvm_config) @mkdir -p $(O) $(EXPORTS) $(EXPORTS_BUILD) ./bin/crystal build $(FLAGS) -o $@ src/compiler/crystal.cr -D without_openssl -D without_zlib -$(LLVM_EXT_OBJ): $(LLVM_EXT_DIR)/llvm_ext.cc LLVM_CONFIG +$(LLVM_EXT_OBJ): $(LLVM_EXT_DIR)/llvm_ext.cc + $(call check_llvm_config) $(CXX) -c $(CXXFLAGS) -o $@ $< $(shell $(LLVM_CONFIG) --cxxflags) man/%.gz: man/% From 20c2abb42965a586310075586259c1af7b18e455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20M=C3=BCller?= Date: Tue, 30 Nov 2021 20:11:18 +0100 Subject: [PATCH 2/2] test --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bf6cb921fa15..e3840813e885 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ endif check_llvm_config = $(eval check_llvm_config := $(if $(shell $(LLVM_CONFIG) --version),\ $(shell echo >&2 "\033[33mUsing $(LLVM_CONFIG) [version=$$($(LLVM_CONFIG) --version)]\033[0m"),\ $(error "Could not locate compatible llvm-config, make sure it is installed and in your PATH, or set LLVM_CONFIG. Compatible versions: $(shell cat src/llvm/ext/llvm-versions.txt)))\ - )$(check_llvm_config) + ) .PHONY: all all: crystal ## Build all files (currently crystal only) [default]