-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
75 lines (63 loc) · 2.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Environment detection and variable definitions
UNAME := $(shell uname)
SNOS_OUTPUT ?= tests/snos/snos/build/
FIXTURES_DIR ?= tests/fixtures
TEST_DB_TAR ?= $(FIXTURES_DIR)/katana_db.tar.gz
KATANA_DB_DIR := $(FIXTURES_DIR)/katana_db
.DEFAULT_GOAL := usage
.SILENT: clean
.PHONY: usage help check-llvm native-deps native-deps-macos native-deps-linux clean
# Virtual targets that map to actual file outputs
.PHONY: test-artifacts snos-artifacts extract-test-db
usage help:
@echo "Usage:"
@echo " test-artifacts: Prepare tests artifacts."
@echo " snos-artifacts: Prepare SNOS tests artifacts."
@echo " extract-test-db: Extract the test database file."
@echo " native-deps-macos: Install cairo-native dependencies for macOS."
@echo " native-deps-linux: Install cairo-native dependencies for Linux."
@echo " check-llvm: Check if LLVM is properly configured."
@echo " clean: Clean up generated files and artifacts."
@echo " help: Show this help message."
snos-artifacts: $(SNOS_OUTPUT)
extract-test-db: $(KATANA_DB_DIR)
test-artifacts: $(SNOS_OUTPUT)
$(SNOS_OUTPUT): $(KATANA_DB_DIR)
@echo "Initializing submodules..."
@git submodule update --init --recursive
@echo "Setting up SNOS tests..."
@cd tests/snos/snos && \
. ./setup-scripts/setup-cairo.sh && \
. ./setup-scripts/setup-tests.sh || { echo "SNOS setup failed\!"; exit 1; }
$(KATANA_DB_DIR): $(TEST_DB_TAR)
@echo "Extracting test database..."
@cd $(FIXTURES_DIR) && \
tar -xzf katana_db.tar.gz || { echo "Failed to extract test database\!"; exit 1; }
@echo "Test database extracted successfully."
check-llvm:
ifndef MLIR_SYS_190_PREFIX
$(error Could not find a suitable LLVM 19 toolchain (mlir), please set MLIR_SYS_190_PREFIX env pointing to the LLVM 19 dir)
endif
ifndef TABLEGEN_190_PREFIX
$(error Could not find a suitable LLVM 19 toolchain (tablegen), please set TABLEGEN_190_PREFIX env pointing to the LLVM 19 dir)
endif
@echo "LLVM is correctly set at $(MLIR_SYS_190_PREFIX)."
native-deps:
ifeq ($(UNAME), Darwin)
native-deps: native-deps-macos
else ifeq ($(UNAME), Linux)
native-deps: native-deps-linux
endif
@echo "Run \`source scripts/cairo-native.env.sh\` to setup the needed environment variables for cairo-native."
native-deps-macos:
@echo "Installing LLVM dependencies for macOS..."
-brew install llvm@19 --quiet
@echo "macOS dependencies installed successfully."
native-deps-linux:
@echo "Installing LLVM dependencies for Linux..."
sudo apt-get install -y llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools
@echo "Linux dependencies installed successfully."
clean:
echo "Cleaning up generated files..."
-rm -rf $(KATANA_DB_DIR) $(SNOS_OUTPUT)
echo "Clean complete."