-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (72 loc) · 2.41 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
#
# ShowQR Makefile
#
PIP_FILE=Pipfile
PIP_REQ=requirements.txt
SHOWQR_SRC=showqr.py
SHOWQR_SPEC=showqr.spec
SHOWQR_FILE=dist/showqr
SHOWQR_ICNS_RES=ShowQR.iconset
SHOWQR_ICNS=showqr.icns
SHOWQR_WORKFLOW=ShowQR.workflow
usage:
@echo "Usage:" &&\
echo " make clean - Cleanup project folder" &&\
echo " make showqr - Generate the showqr application" &&\
echo " make test - Test the showqr executable" &&\
echo " make install - Install ShowQR (brew)" &&\
echo " make venv - Create the python virtualenv"
clean:
@rm -rf build dist *.spec *.png
venv: requirements.txt
@[ ! -d venv ] &&\
mkdir -p venv || echo venv "venv dir already exists"
@python3 -m venv venv &&\
. venv/bin/activate &&\
pip install --upgrade pip &&\
pip install -r requirements.txt
$(PIP_FILE): $(PIP_REQ)
@echo "Loading environment with pipenv" &&\
export LC_ALL=en_US.UTF-8 &&\
export LANG=en_US.UTF-8 &&\
pipenv --python=$(PYVER) install -r $(PIP_REQ)
$(SHOWQR_ICNS): $(SHOWQR_ICNS_RES)
@echo "Making icon"
@iconutil -c icns $(SHOWQR_ICNS_RES)
$(SHOWQR_FILE): $(SHOWQR_ICNS) $(SHOWQR_SRC)
@echo "Generating ShowQR executable"
@rm -rf dist
@export LC_ALL=en_US.UTF-8
@export LANG=en_US.UTF-8
pipenv run pyinstaller\
--onefile\
--icon $(SHOWQR_ICNS)\
-s\
-c\
-F\
-y\
--exclude-module tcl\
--exclude-module tk\
--exclude-module _tkinter\
--exclude-module tkinter\
--exclude-module Tkinter\
$(SHOWQR_SRC)
@mkdir -p dist
@[ -f $(SHOWQR_FILE) ] &&\
echo "Successfully created" ||\
echo "Unsuccessfully created"
showqr: $(SHOWQR_FILE) $(PIP_FILE)
@[ -f $(SHOWQR_FILE) ] &&\
echo "ShowQR binary file at: " $(SHOWQR_FILE)
test: showqr
@echo "Testing ShowQR" &&\
echo "Testing ShowQR" | $(SHOWQR_FILE) -f &&\
[ -f ShowQR.png ] &&\
echo "QR code successfully created"
install: showqr $(SHOWQR_WORKFLOW)
@echo "Installing ShowQR"
@BREW_PFX=`brew --prefix` &&\
sudo cp $(SHOWQR_FILE) $$BREW_PFX/bin &&\
cp -r $(SHOWQR_WORKFLOW) ~/Library/Services/ &&\
echo "Installation successfully accomplished"
all: clean showqr install