-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (35 loc) · 1.07 KB
/
Makefile
File metadata and controls
46 lines (35 loc) · 1.07 KB
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
BUILD_DIR ?= build
CMAKE ?= cmake
PYTHON ?= python3
VENV_DIR ?= .venv
REQ_FILE ?= requirements.txt
CLANG_FORMAT ?= clang-format
FORMAT_DIRS ?= src tests
ifeq ($(OS),Windows_NT)
VENV_PYTHON := $(VENV_DIR)/Scripts/python.exe
else
VENV_PYTHON := $(VENV_DIR)/bin/python3
endif
VENV_STAMP := $(VENV_DIR)/.stamp
.PHONY: all configure compiler clean test venv format
all: compiler
configure:
$(CMAKE) -S . -B $(BUILD_DIR)
compiler: configure
$(CMAKE) --build $(BUILD_DIR) --target dhad
test: configure
$(CMAKE) --build $(BUILD_DIR) --target lang_driver codegen_ex1
$(PYTHON) tests/run_ctest.py --build-dir $(BUILD_DIR)
venv: $(VENV_STAMP)
$(VENV_STAMP): $(REQ_FILE)
$(PYTHON) -m venv $(VENV_DIR)
$(VENV_PYTHON) -m pip install --upgrade pip
$(VENV_PYTHON) -m pip install -r $(REQ_FILE)
touch $(VENV_STAMP)
format:
@command -v $(CLANG_FORMAT) >/dev/null || \
(echo "clang-format not found: $(CLANG_FORMAT)"; exit 1)
find $(FORMAT_DIRS) -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' \) -print0 | \
xargs -0 $(CLANG_FORMAT) -i
clean:
rm -rf $(BUILD_DIR) $(VENV_DIR)