-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
57 lines (39 loc) · 1.54 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
CXX := /dt9/usr/bin/g++
PY_VERSION ?= 3.8
PYTHON := python$(PY_VERSION)
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
SOURCES := $(wildcard tensorflow_mri/cc/kernels/*.cc) $(wildcard tensorflow_mri/cc/ops/*.cc)
TARGET := tensorflow_mri/python/ops/_mri_ops.so
TF_CFLAGS := $(shell $(PYTHON) -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))')
TF_LDFLAGS := $(shell $(PYTHON) -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')
CFLAGS := -O3 -march=x86-64 -mtune=generic
CXXFLAGS := $(CFLAGS)
CXXFLAGS += $(TF_CFLAGS) -fPIC -std=c++17
CXXFLAGS += -I$(ROOT_DIR)
LDFLAGS := $(TF_LDFLAGS)
LDFLAGS += -l:libspiral_waveform.a
all: lib wheel
lib: $(TARGET)
$(TARGET): $(SOURCES)
$(CXX) -shared $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
wheel: $(TARGET)
./tools/build/build_pip_pkg.sh make --python $(PYTHON) artifacts
docs: $(TARGET)
rm -rf tools/docs/_build
rm -rf tools/docs/_templates
rm -rf tools/docs/api_docs
$(PYTHON) tools/docs/create_templates.py
$(PYTHON) tools/docs/create_documents.py
$(MAKE) -C tools/docs dirhtml PY_VERSION=$(PY_VERSION)
test: $(wildcard tensorflow_mri/python/*.py)
$(PYTHON) -m unittest discover -v -p *_test.py
doctest: $(wildcard tensorflow_mri/python/*.py)
$(PYTHON) tools/docs/test_docs.py
lint: $(wildcard tensorflow_mri/python/*.py)
pylint --rcfile=pylintrc tensorflow_mri/python
api: $(wildcard tensorflow_mri/python/*.py)
$(PYTHON) tools/build/create_api.py
clean:
rm -rf artifacts/
rm -rf $(TARGET)
.PHONY: all lib wheel test lint docs clean