-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (64 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# SPDX-FileCopyrightText: 2024 Boris Stefanovic <owldev@bluewin.ch>
#
# SPDX-License-Identifier: GPL-3.0-only
PROJNAME := chessclockpy
NAME := chessclock
MAIN := launch.py
MAKEFILE := Makefile
LICENCE := LICENCE.txt
NOTICE := NOTICE.txt
PYTHON ?= python
VENV := venv
REQS := requirements.txt
OUT := out
ZIP_DIR_NAME := ${PROJNAME}
ZIP_DIR_PATH := ${OUT}/${ZIP_DIR_NAME}
ZIP_FILE := ${PROJNAME}.zip
ZIP_PATH := ${OUT}/${ZIP_FILE}
BIN_ROOT := ${OUT}/inst
BIN_SPEC := ${BIN_ROOT}
BIN_WORK := ${BIN_ROOT}/build
BIN_DIST := ${OUT}
all: package bin
run: ${VENV}
source ${VENV}/bin/activate && \
${PYTHON} ${MAIN} && \
deactivate
package: ${OUT}
rm -rf ${ZIP_DIR_PATH} ${ZIP_PATH}
mkdir -p ${ZIP_DIR_PATH}
cp -r chessclock ${MAIN} ${REQS} ${MAKEFILE} ${LICENCE} ${NOTICE} ${ZIP_DIR_PATH}/
cd ${OUT} && \
zip -r ${ZIP_FILE} ${ZIP_DIR_NAME}
bin: ${OUT} ${VENV}
rm -rf ${BIN_ROOT}
mkdir -p ${BIN_ROOT}
source ${VENV}/bin/activate && \
pip install -U pyinstaller && \
pyinstaller \
-y \
--clean \
--onefile \
--windowed \
--distpath ${BIN_DIST} \
--workpath ${BIN_WORK} \
--specpath ${BIN_SPEC} \
--name ${NAME} \
launch.py && \
deactivate
run-bin: bin
./out/${NAME}
clean:
-find chessclock -type d -name "__pycache__" -exec rm -rf {} \;
rm -rf ${OUT} build dist *.spec
rm -rf ${VENV}
${VENV}:
-[[ ! -d ${VENV} ]] && \
${PYTHON} -m venv ${VENV} && \
source ${VENV}/bin/activate && \
pip install -U pip && \
pip install -U -r ${REQS} && \
deactivate
${OUT}:
mkdir -p $@
.PHONY: all bin clean package run run-bin