-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (78 loc) · 2.14 KB
/
Makefile
File metadata and controls
105 lines (78 loc) · 2.14 KB
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
95
96
97
98
99
100
101
102
103
104
#
# Makefile for CODER
# a game for the #MetaGameJam
#
# Author: Lukas Singer
#
# Created: 2018-03-25
#
#################
# #
# CONFIGURATION #
# #
#################
# the name of the game
NAME=coder
# the directory for the virtual enviroment
# HINT: dont change this, this is also a targets name!
VIRTUALENV=venv
# the "compiler" for the game (the executable)
PY-CC=python -OO $(VIRTUALENV)/bin/pyinstaller
# the "compiler" for the build info
BUILD-INFO-CC=python generate_build_info.py
BIN-DIR=bin
# the temp dir (f.e. for creating the docs or creating the executable)
TMP-DIR=tmp
IMAGES-SRC=images/*.png
IMAGES-DEST=images
SOUNDS-SRC=sounds/*.ogg
SOUNDS-DEST=sounds
FONTS-SRC=fonts/*.ttf
FONTS-DEST=fonts
# the build info file
BUILD-INFO-FILE=build_info.py
# the main source file
SRC-FILE=coder.py
# the requirements file
REQ-FILE=requirements.txt
# activation and deactivation commands for the virtual enviroment
ACTIVATE-VIRTUALENV=. $(VIRTUALENV)/bin/activate
DEACTIVATE-VIRTUALENV=deactivate
# flags for the "compiler" for the game
PY-CC-FLAGS=--clean --onefile --strip --log-level=WARN
PY-CC-ADD-DATA=--add-data '$(IMAGES-SRC):$(IMAGES-DEST)' --add-data '$(SOUNDS-SRC):$(SOUNDS-DEST)' --add-data '$(FONTS-SRC):$(FONTS-DEST)'
###########
# #
# TARGETS #
# #
###########
# build the game when invoked with:
# $ make
default:
( \
$(ACTIVATE-VIRTUALENV) ; \
$(BUILD-INFO-CC) --output=$(BUILD-INFO-FILE) ; \
$(PY-CC) $(PY-CC-FLAGS) $(PY-CC-ADD-DATA) --distpath=$(BIN-DIR) --name $(NAME) $(SRC-FILE) ; \
$(DEACTIVATE-VIRTUALENV) ; \
)
# create the virtual enviroment and install requirements when invoked with:
# $ make venv
.PHONY: $(VIRTUALENV)
$(VIRTUALENV):
( \
python3 -m venv $(VIRTUALENV) ; \
$(ACTIVATE-VIRTUALENV) ; \
pip install -r $(REQ-FILE) ; \
$(DEACTIVATE-VIRTUALENV) ; \
)
# remove the virtual enviroment when invoked with:
# $ make clean-venv
clean-venv:
rm -r $(VIRTUALENV)
# remove everything created with this Makefile (except the virtual enviroment) when invoked with:
# $ make clean
.PHONY: clean
clean:
rm -r $(BIN-DIR)
rm -r $(TMP-DIR)
rm $(BUILD-INFO-FILE)