-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
68 lines (55 loc) · 1.52 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
SHELL := $(shell which bash)
MICROMAMBA := $(CURDIR)/.micromamba
MAMBA := $(MICROMAMBA)/micromamba
VENV := $(PWD)/.venv
DEPS := $(VENV)/.deps
BIN := $(VENV)/bin
BUILD_TYPE?=debug
BUILD_TYPE_LOWER:=$(shell echo $(BUILD_TYPE) | tr '[:upper:]' '[:lower:]')
BUILD_ROOT:=$(CURDIR)/out/$(BUILD_TYPE_LOWER)
COMPILER := $(BIN)/x86_64-conda-linux-gnu-g++
CMAKE := $(BIN)/cmake
NINJA := $(BIN)/ninja
OUT := $(CURDIR)/out
.PHONY: test help
ifndef VERBOSE
.SILENT:
endif
help:
grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
$(MAMBA):
echo "Installing Mamba..."
$(SHELL) ./install-micromamba.sh "$(MICROMAMBA)"
$(DEPS): environment.yml $(MAMBA)
echo "Installing dependencies..."
$(MAMBA) create --quiet --yes -p $(VENV)
$(MAMBA) install --quiet --yes -p $(VENV) -f environment.yml
cp environment.yml $(DEPS)
.PHONY: deps
deps: $(DEPS)
clean:
rm -rf $(VENV)
rm -rf $(MICROMAMBA)
rm -rf $(OUT)
.PHONY: config
config: $(BUILD_ROOT)/.configured
$(BUILD_ROOT)/.configured:
mkdir -p $(BUILD_ROOT)
$(CMAKE) -S $(CURDIR) -B $(BUILD_ROOT) \
-GNinja \
-DCMAKE_MAKE_PROGRAM=$(NINJA) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DCMAKE_CXX_COMPILER=$(COMPILER)
.PHONY: build
build: deps config
$(CMAKE) --build $(BUILD_ROOT)
.PHONY: test
test: build
$(BUILD_ROOT)/test
.PHONY: format
format: deps
find src -iname '*.hpp' -o -iname '*.cpp' | xargs $(BIN)/clang-format -i
$(BIN)/clang-format -i test.cpp
patch:
git add .
git diff --binary main > aqtc_cpp.patch