-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (75 loc) · 1.75 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
84
85
86
87
88
89
90
91
92
93
94
all:
# make build
@echo Not implemented
run:
python3 ok-disc.py -v
DS_STORE = build/.DS_Store
ifneq ("$(wildcard $(DS_Store))","")
DEL_DS = rm $(DS_Store)
else
DEL_DS = @:
endif
# ifeq (build,$(firstword $(MAKECMDGOALS)))
# BUILD_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# $(eval $(BUILD_ARGS):dummy;@:)
# endif
.PHONY: build
build:
$(DEL_DS)
@python3 -m zipapp build -m "ok_disc:main" -o ok
@make clean
@mkdir out
@mv ok ./out/ok
@cp ./assets/code/scheme ./out/scheme
# https://erictleung.com/user-input-makefile
@cp ./src/$(filter-out $@,$(MAKECMDGOALS)) ./out/
@echo Files can be found in ./out
@echo 'Use make zip <name-of-zip> to generate zip'
# for command line args
%:
@:
ZIP = $(filter-out $@,$(MAKECMDGOALS))
ifneq ("$(wildcard $(ZIP))","")
DEL_ZIP = rm -r $(ZIP)
else
DEL_ZIP = @:
endif
ZIPS = ./zips
ifeq ("$(wildcard $(ZIPS))","")
MK_ZIPS = mkdir $(ZIPS)
DEL_ZIPS = @:
else
MK_ZIPS = @:
DEL_ZIPS = rm -r $(ZIPS)
endif
zip:
$(MK_ZIPS)
$(DEL_ZIP)
mkdir $(filter-out $@,$(MAKECMDGOALS))
cp -a ./out/. $(filter-out $@,$(MAKECMDGOALS))/
zip -r ./zips/$(filter-out $@,$(MAKECMDGOALS)).zip $(filter-out $@,$(MAKECMDGOALS))
rm -r $(filter-out $@,$(MAKECMDGOALS))
zip-inner:
python3 -m zipapp ok_disc -m "ok_disc:main"
build-deprecated:
python3 -m compileall ok-disc.py
mv ./__pycache__/ok-disc.cpython-37.pyc ok
rm -r ./__pycache__
build-windows:
python3 -m compileall ok-disc-win.py
mv ./__pycache__/ok-disc-win.cpython-37.pyc ok
rm -r ./__pycache__
build-disc:
python3 -m compileall ok-disc-build.py
mv ./__pycache__/ok-disc-build.cpython-37.pyc ok
rm -r ./__pycache__
OUT = ./out
ifneq ("$(wildcard $(OUT))","")
CLEAN = @rm -r $(OUT)
else
CLEAN = @:
endif
clean:
$(CLEAN)
clean-zips:
$(DEL_ZIPS)