-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
79 lines (65 loc) · 2.3 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
76
77
78
79
#
# Google Authenticator Export Helper.
#
# 2021-∞ (c) blurryroots innovation qanat OÜ. All rights reserved.
# See license.md for details.
#
# https://think-biq.com
FILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_DIR := $(shell dirname $(FILE_PATH))
PROJECT_NAME := $(notdir $(patsubst %/,%,$(dir $(FILE_PATH))))
DEBUG_FLAG :=
BUILD_PATH = "${PROJECT_DIR}/build"
ifeq '$(findstring ;,$(PATH))' ';'
OS = "win"
VENV_BIN_DIR = Scripts
STD_FLAG = "/std:c++17 /EHa"
EXE_NAME = gaeh
BUILD_PATH_RELEASE = "${BUILD_PATH}/Release"
EXE_PATH_RELEASE = "${BUILD_PATH_RELEASE}/${EXE_NAME}"
BUILD_PATH_DEBUG = "${BUILD_PATH}/Debug"
EXE_PATH_DEBUG = "${BUILD_PATH_DEBUG}/${EXE_NAME}"
LLDB = lldb
PYTHON = python
PYTHON_EXECUTABLE := "${shell $(PYTHON) -c "import sys; print(sys.executable)"}"
else
OS = "unix-y"
VENV_BIN_DIR = bin
STD_FLAG = "--std=c++17"
EXE_NAME = gaeh
BUILD_PATH_RELEASE = "${BUILD_PATH}"
EXE_PATH_RELEASE = "${BUILD_PATH_RELEASE}/${EXE_NAME}"
BUILD_PATH_DEBUG = "${BUILD_PATH}"
EXE_PATH_DEBUG = "${BUILD_PATH_DEBUG}/${EXE_NAME}"
LLDB = lldb
PYTHON := python3
PYTHON_EXECUTABLE := $(shell which $(PYTHON))
endif
CMD_ACTIVATE_VENV = . "$(PROJECT_DIR)/$(VENV_BIN_DIR)/activate"
CMD_DEACTIVATE_VENV = declare -f deactivate > /dev/null && deactivate || true
all: prepare install-gaeh build-wheel
prepare:
@$(CMD_DEACTIVATE_VENV); $(PYTHON) -m venv $(PROJECT_DIR)
$(CMD_ACTIVATE_VENV); $(PYTHON) -m pip install -U pip
$(CMD_ACTIVATE_VENV); find . -iname "requirements.txt" -exec $(PYTHON) -m pip install -r {} \;
clean:
rm -rf $(PROJECT_DIR)/{bin,include,lib,pyvenv.cfg}
clean-gaeh:
@$(CMD_ACTIVATE_VENV); (cd dep/gaeh && rm -rf build dist)
build-gaeh: clean-gaeh
@$(CMD_ACTIVATE_VENV); (\
cd dep/gaeh \
&& pip install -r requirements.txt \
&& $(PYTHON) setup.py bdist_wheel\
)
install-gaeh: build-gaeh
@$(CMD_ACTIVATE_VENV); $(PYTHON) -m pip uninstall --yes gaeh
$(CMD_ACTIVATE_VENV); $(PYTHON) -m pip install gaeh \
--force-reinstall --no-index --find-links="file://$(PROJECT_DIR)/dep/gaeh/dist"
build-wheel: install-gaeh
$(CMD_ACTIVATE_VENV); python3 setup.py bdist_wheel
install-wheel: build-wheel
$(CMD_ACTIVATE_VENV); python3 -m pip install gabut \
--force-reinstall --no-index --find-links="$(PROJECT_DIR)/dist"
run:
$(CMD_ACTIVATE_VENV); $(PYTHON) -m src $(FILES)