-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
61 lines (45 loc) · 1.65 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
.PHONY: test
# may borrow system check code from ies.
PLATFORM := $(shell python -c "import os; print(os.name)")
ifeq (${PLATFORM}, )
PLATFORM := $(shell python3 -c "import os; print(os.name)") # executed on macos
endif
ifeq (${PLATFORM}, nt)
OS_TYPE = windows
else
OS_TYPE = macos
endif
PYTHON_ENV = -X utf8=1
ifeq (${OS_TYPE}, macos)
CONDA_ENV = rosetta
PYTHON = /usr/bin/python3
PIP = ${PYTHON} -m pip
else
CONDA_ENV = cplex
PYTHON = python ${PYTHON_ENV}
PIP = gsudo ${PYTHON} -m pip
endif
#### ALWAYS REMEMBER TO EXPORT USEFUL VARIABLES ####
export OS_TYPE PLATFORM PYTHON PYTHON_ENV CONDA_ENV
#### ALWAYS REMEMBER TO EXPORT USEFUL VARIABLES ####
RENDERED_CODE = conscious_struct.py hid_utils.py
RENDER_UTILS = jinja_utils.py pyright_utils.py
UTILS = log_utils.py ${RENDER_UTILS}
UTILS_SYNC_DIR = ../jubilant-adventure2/microgrid_base/
# shall you dump log to file, not to display it here
export RENDERED_CODE
test: ${UTILS} ${RENDERED_CODE} test/test_project.py
cd test && ${PYTHON} -m pytest --lf --lfnf=all --capture=tee-sys test_project.py
# cd test && ${PYTHON} -m pytest --lf --lfnf=all --capture=tee-sys --log-level=DEBUG test_project.py
${RENDERED_CODE}: $(addsuffix .j2, ${RENDERED_CODE}) ${RENDER_UTILS}
${PYTHON} render_python_code.py $@
${UTILS}: $(addprefix ${UTILS_SYNC_DIR}, ${UTILS})
bash sync_utils.sh $@ ${UTILS_SYNC_DIR}
setup:
${PIP} install -r requirements.txt
KL2XKS.json: hid_utils.py
${PYTHON} hid_utils.py
software_interface: ${RENDERED_CODE}
${MAKE} -e -C software_capture_hid_control
hardware_interface: ${RENDERED_CODE}
${MAKE} -e -C hardware_capture_hid_power_control