fix(compiler): Makefile: Do not let target 'build' depend on directory

The target `build` creates a build directory with the same name and
initializes through an invocation of CMake. Regardless of the success
or failure of the CMake invocation, all subsequent invocations of the
target do not invoke CMake anymore, as the target's prerequisites are
satisfied through the existence of the build directory created upon
the first invocation.

This patch changes the dependencies to the build directory with an
intermediate target that depends on a stamp file that is only created
when the first CMake invocation in the build directory succeeds.
This commit is contained in:
Andi Drebes
2021-10-19 21:48:55 +02:00
committed by Quentin Bourgerie
parent ab7a208112
commit 527887bbf9

View File

@@ -2,7 +2,7 @@ BUILD_DIR=./build
Python3_EXECUTABLE=
build:
$(BUILD_DIR)/configured.stamp:
cmake -B $(BUILD_DIR) -GNinja ../llvm-project/llvm/ \
-DLLVM_ENABLE_PROJECTS=mlir \
-DLLVM_BUILD_EXAMPLES=OFF \
@@ -15,14 +15,17 @@ build:
-DLLVM_EXTERNAL_PROJECTS=zamalang \
-DLLVM_EXTERNAL_ZAMALANG_SOURCE_DIR=. \
-DPython3_EXECUTABLE=${Python3_EXECUTABLE}
touch $@
build-end-to-end-jit: build
build-initialized: $(BUILD_DIR)/configured.stamp
build-end-to-end-jit: build-initialized
cmake --build $(BUILD_DIR) --target end_to_end_jit_test
zamacompiler: build
zamacompiler: build-initialized
cmake --build $(BUILD_DIR) --target zamacompiler
python-bindings: build
python-bindings: build-initialized
cmake --build $(BUILD_DIR) --target ZamalangMLIRPythonModules ZamalangPythonModules
test-check: zamacompiler file-check not