-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
145 lines (105 loc) · 4.12 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# change with your path of your editor
godot-path =
godot-name-executable-main = Godot_v3.4.4-stable
project-name = #todo
itch-project = #todo
ifeq ($(OS),Windows_NT)
console = powershell --comand
godot-sufix = _win64.exe
copy = copy
copy-flag = /Y
rm = rmdir
rm-flag = /Q /S
default-target = compile/windows/$(project-name).exe
make = mingw32-make
else
console = sh
godot-sufix = _x11.64
copy = cp
copy-flag = -f
rm = rm
rm-flag = -rf
default-target = compile/linux/$(project-name).x86_64s
make = make
endif
mkdir = mkdir
file-config-dev = config\development.tres
file-config-prod = config\production.tres
file-config-default = $(file-config-dev)
file-config-used = config\environment_config.tres
git = git
describe = describe
git-decribe-flag-long = --tags --long
git-decribe-flag-short = --tags
echo = echo
pybabel = pybabel
pybabel-flags = extract -F babelrc -k text -k LineEdit/placeholder_text -k tr -k hint_tooltip -k translate -o
msgmerge = msgmerge
msgmerge-flags = --update --backup=simple --suffix=.back
godot ?= $(addprefix $(godot-path), $(addsuffix $(godot-sufix), $(godot-name-executable-main)) )
godot-flag = --export
godot-flag-debug = --export-debug
butler ?= butler
source-sufix = gd tscn tres
source-files = $(foreach sufix, $(source-sufix), $(wildcard *.$(sufix) */*.$(sufix) */*/*.$(sufix) */*/*/*.$(sufix) */*/*/*/*.$(sufix) */*/*/*/*/*.$(sufix)))
translation-string-files = $(wildcard locales/*.txt)
cached-data = cache.tres
version-file = version.tres
.PHONY: all
all: $(default-target)
.PHONY: setup
setup: $(version-file)
$(copy) $(copy-flag) "$(file-config-dev)" "$(file-config-used)"
.PHONY: production
production: $(source-files) $(version-file) .FORCE
$(copy) $(copy-flag) "$(file-config-prod)" "$(file-config-used)"
$(godot) $(godot-flag) "Windows" compile/windows/$(project-name).exe
$(godot) $(godot-flag) "Linux" compile/linux/$(project-name).x86_64
$(copy) $(copy-flag) "$(file-config-dev)" "$(file-config-used)"
.PHONY: debug
debug: $(source-files) $(version-file) .FORCE
$(copy) $(copy-flag) "$(file-config-prod)" "$(file-config-used)"
$(godot) $(godot-flag-debug) "Windows" compile/windows/$(project-name).exe
$(godot) $(godot-flag-debug) "Linux" compile/linux/$(project-name).x86_64
$(copy) $(copy-flag) "$(file-config-dev)" "$(file-config-used)"
.PHONY: debug-local
debug-local: compile/windows/$(project-name).exe compile/linux/$(project-name).x86_64
.PHONY: update-translation
update-translation: locales/fr.po locales/en.po
.PHONY: clean-cache
clean-cache:
$(rm) $(rm-flag) $(cached-data)
%.po: locales/translation.pot
$(msgmerge) $(msgmerge-flags) $@ $<
%.pot: $(source-files) $(translation-string-files)
$(pybabel) $(pybabel-flags) $@ .
var := $(shell $(git) $(describe) $(git-decribe-flag-long))
$(version-file): version_model.txt .FORCE
$(copy) $(copy-flag) $< $@
echo version = "$(var)" >> $@
compile/windows/$(project-name).exe: $(source-files) $(version-file)
$(godot) $(godot-flag) "Windows" $@
compile/linux/$(project-name).x86_64: $(source-files) $(version-file)
$(godot) $(godot-flag) "Linux" $@
version-short := $(shell $(git) $(describe) $(git-decribe-flag-short))
.PHONY: itch-push-windows
itch-push-windows:
$(butler) push compile/tmp/. $(itch-project):windows-universal --userversion $(version-short)
.PHONY: itch-push-linux
itch-push-linux:
$(butler) push compile/tmp/. $(itch-project):linux-universal --userversion $(version-short)
.PHONY: itch-push
itch-push: .FORCE
$(make) production
$(mkdir) "compile/tmp"
$(copy) $(copy-flag) "compile\windows\$(project-name).exe" "compile\tmp\$(project-name).exe"
$(copy) $(copy-flag) "compile\windows\$(project-name).pck" "compile\tmp\$(project-name).pck"
$(make) itch-push-windows
$(rm) $(rm-flag) "compile/tmp"
$(mkdir) "compile/tmp"
$(copy) $(copy-flag) "compile\linux\$(project-name).x86_64" "compile\tmp\$(project-name).x86_64"
$(copy) $(copy-flag) "compile\linux\$(project-name).pck" "compile\tmp\$(project-name).pck"
$(make) itch-push-linux
$(rm) $(rm-flag) "compile/tmp"
.PHONY: .FORCE
.FORCE: # force the revaluation of the rule even if other prerequesit files are not changed