This repository was archived by the owner on Nov 22, 2023. It is now read-only.
forked from crownengine/crown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
250 lines (217 loc) · 11.5 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#
# Copyright (c) 2012-2023 Daniele Bartolini et al.
# SPDX-License-Identifier: MIT
#
UNAME := $(shell uname)
ifeq ($(UNAME), $(filter $(UNAME), Linux))
OS=linux
EXE_PREFIX=./
EXE_SUFFIX=
else
ifeq ($(UNAME), $(filter $(UNAME), windows32))
OS=windows
EXE_PREFIX=
EXE_SUFFIX=.exe
ARG_PREFIX=/
MKDIR=mkdir
else
OS=windows
EXE_PREFIX=
EXE_SUFFIX=.exe
ARG_PREFIX=//
MKDIR=mkdir -p
endif
endif
GENIE=scripts/genie/bin/$(OS)/genie
MAKE_JOBS=1
# LuaJIT
NDKABI=$(ANDROID_NDK_ABI)
NDKDIR=$(ANDROID_NDK_ROOT)
NDKBIN=$(NDKDIR)/toolchains/llvm/prebuilt/linux-x86_64/bin
NDKCROSS=$(NDKBIN)/arm-linux-androideabi-
NDKCC=$(NDKBIN)/armv7a-linux-androideabi$(NDKABI)-clang
NDKCROSS64=$(NDKBIN)/aarch64-linux-android-
NDKCC64=$(NDKBIN)/aarch64-linux-android$(NDKABI)-clang
build/android-arm/bin/libluajit.a:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src HOST_CC="gcc -m32" CROSS=$(NDKCROSS) STATIC_CC=$(NDKCC) DYNAMIC_CC="$(NDKCC) -fPIC" TARGET_LD=$(NDKCC)
mkdir -p build/android-arm/bin
cp -r 3rdparty/luajit/src/jit 3rdparty/luajit/src/libluajit.a build/android-arm/bin
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src clean
build/android-arm64/bin/libluajit.a:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src CROSS=$(NDKCROSS64) STATIC_CC=$(NDKCC64) DYNAMIC_CC="$(NDKCC64) -fPIC" TARGET_LD=$(NDKCC64)
mkdir -p build/android-arm64/bin
cp -r 3rdparty/luajit/src/jit 3rdparty/luajit/src/libluajit.a build/android-arm64/bin
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src clean
build/linux64/bin/luajit:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src CC="gcc -m64" CCOPT="-O2 -fomit-frame-pointer -msse2" TARGET_SYS=Linux BUILDMODE=static
mkdir -p build/linux64/bin
cp -r 3rdparty/luajit/src/jit 3rdparty/luajit/src/luajit 3rdparty/luajit/src/libluajit.a build/linux64/bin
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src clean
build/mingw64/bin/luajit.exe:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src CC="$(MINGW)/bin/x86_64-w64-mingw32-gcc -m64" CCOPT="-O2 -fomit-frame-pointer -msse2" TARGET_SYS=Windows BUILDMODE=static
-$(MKDIR) "build/mingw64/bin"
cp -r 3rdparty/luajit/src/jit 3rdparty/luajit/src/luajit.exe 3rdparty/luajit/src/libluajit.a build/mingw64/bin
-@"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/luajit/src clean
-@rm 3rdparty/luajit/src/host/buildvm.exe
-@rm 3rdparty/luajit/src/host/minilua.exe
build/windows64/bin/luajit.exe:
-$(MKDIR) "build/windows64/bin"
cd "3rdparty/luajit/src" && .\\msvcbuild.bat
cp -r 3rdparty/luajit/src/jit 3rdparty/luajit/src/luajit.exe 3rdparty/luajit/src/lua51.dll 3rdparty/luajit/src/lua51.lib build/windows64/bin
-@rm -f 3rdparty/luajit/src/buildvm.*
-@rm -f 3rdparty/luajit/src/jit/vmdef.lua
-@rm -f 3rdparty/luajit/src/lua51.*
-@rm -f 3rdparty/luajit/src/luajit.exe
-@rm -f 3rdparty/luajit/src/luajit.exp
-@rm -f 3rdparty/luajit/src/luajit.lib
-@rm -f 3rdparty/luajit/src/minilua.*
build/projects/android-arm:
$(GENIE) --gfxapi=gles3 --no-luajit --compiler=android-arm gmake
android-arm-debug: build/projects/android-arm build/android-arm/bin/libluajit.a
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/android-arm config=debug
android-arm-development: build/projects/android-arm build/android-arm/bin/libluajit.a
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/android-arm config=development
android-arm-release: build/projects/android-arm build/android-arm/bin/libluajit.a
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/android-arm config=release
android-arm: android-arm-debug android-arm-development android-arm-release
build/projects/android-arm64:
$(GENIE) --gfxapi=gles3 --file=scripts/genie.lua --compiler=android-arm64 gmake
android-arm64-debug: build/projects/android-arm64 build/android-arm64/bin/libluajit.a
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/android-arm64 config=debug
android-arm64-development: build/projects/android-arm64 build/android-arm64/bin/libluajit.a
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/android-arm64 config=development
android-arm64-release: build/projects/android-arm64 build/android-arm64/bin/libluajit.a
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/android-arm64 config=release
android-arm64: android-arm64-debug android-arm64-development android-arm64-release
build/linux64/bin/texturec:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/bimg/.build/projects/gmake-linux config=release64 texturec
cp -r 3rdparty/bimg/.build/linux64_gcc/bin/texturecRelease $@
build/linux64/bin/shaderc:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/bgfx/.build/projects/gmake-linux config=release64 shaderc
cp -r 3rdparty/bgfx/.build/linux64_gcc/bin/shadercRelease $@
build/projects/linux:
$(GENIE) --file=3rdparty/bgfx/scripts/genie.lua --with-tools --gcc=linux-gcc gmake
$(GENIE) --file=3rdparty/bimg/scripts/genie.lua --with-tools --gcc=linux-gcc gmake
$(GENIE) --gfxapi=gl32 --with-tools --compiler=linux-gcc gmake
linux-debug64: build/projects/linux build/linux64/bin/luajit build/linux64/bin/texturec build/linux64/bin/shaderc
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/linux crown config=debug64
linux-development64: build/projects/linux build/linux64/bin/luajit build/linux64/bin/texturec build/linux64/bin/shaderc
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/linux crown config=development64
linux-release64: build/projects/linux build/linux64/bin/luajit
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/linux crown config=release64
linux: linux-debug64 linux-development64 linux-release64
build/mingw64/bin/texturec.exe:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/bimg/.build/projects/gmake-mingw-gcc config=release64 texturec
cp -r 3rdparty/bimg/.build/win64_mingw-gcc/bin/texturecRelease.exe $@
build/mingw64/bin/shaderc.exe:
"$(MAKE)" -j$(MAKE_JOBS) -R -C 3rdparty/bgfx/.build/projects/gmake-mingw-gcc config=release64 shaderc
cp -r 3rdparty/bgfx/.build/win64_mingw-gcc/bin/shadercRelease.exe $@
build/projects/mingw:
$(GENIE) --file=3rdparty/bgfx/scripts/genie.lua --with-tools --gcc=mingw-gcc gmake
$(GENIE) --file=3rdparty/bimg/scripts/genie.lua --with-tools --gcc=mingw-gcc gmake
$(GENIE) --gfxapi=d3d11 --with-tools --compiler=mingw-gcc gmake
mingw-debug64: build/projects/mingw build/mingw64/bin/luajit.exe build/mingw64/bin/texturec.exe build/mingw64/bin/shaderc.exe
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/mingw config=debug64
mingw-development64: build/projects/mingw build/mingw64/bin/luajit.exe build/mingw64/bin/texturec.exe build/mingw64/bin/shaderc.exe
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/mingw config=development64
mingw-release64: build/projects/mingw build/mingw64/bin/luajit.exe
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/mingw config=release64
mingw: mingw-debug64 mingw-development64 mingw-release64
build/windows64/bin/texturec.exe:
devenv.com 3rdparty/bimg/.build/projects/vs2019/bimg.sln $(ARG_PREFIX)Build "Release|x64" $(ARG_PREFIX)Project texturec.vcxproj
cp -r 3rdparty/bimg/.build/win64_vs2019/bin/texturecRelease.exe $@
build/windows64/bin/shaderc.exe:
devenv.com 3rdparty/bgfx/.build/projects/vs2019/bgfx.sln $(ARG_PREFIX)Build "Release|x64" $(ARG_PREFIX)Project shaderc.vcxproj
cp -r 3rdparty/bgfx/.build/win64_vs2019/bin/shadercRelease.exe $@
build/projects/vs2019:
$(GENIE) --file=3rdparty/bgfx/scripts/genie.lua --with-tools vs2019
$(GENIE) --file=3rdparty/bimg/scripts/genie.lua --with-tools vs2019
$(GENIE) --gfxapi=d3d11 --with-tools --no-level-editor vs2019
windows-debug64: build/projects/vs2019 build/windows64/bin/luajit.exe build/windows64/bin/texturec.exe build/windows64/bin/shaderc.exe
devenv.com build/projects/vs2019/crown.sln $(ARG_PREFIX)Build "debug|x64"
windows-development64: build/projects/vs2019 build/windows64/bin/luajit.exe build/windows64/bin/texturec.exe build/windows64/bin/shaderc.exe
devenv.com build/projects/vs2019/crown.sln $(ARG_PREFIX)Build "development|x64"
windows-release64: build/projects/vs2019 build/windows64/bin/luajit.exe
devenv.com build/projects/vs2019/crown.sln $(ARG_PREFIX)Build "release|x64"
level-editor-theme:
cd tools/level_editor/resources/theme/Adwaita && ./parse-sass.sh
cd tools/level_editor/resources && ./generate-resources.sh > resources.gresource.xml
level-editor-linux-debug64:
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/linux level-editor config=debug64
level-editor-linux-release64:
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/linux level-editor config=release64
tools-linux-debug64: linux-debug64 level-editor-linux-debug64
tools-linux-release64: linux-development64 level-editor-linux-release64
tools-windows-debug64: windows-debug64
tools-windows-release64: windows-development64
level-editor-mingw-debug64: build/projects/mingw
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/mingw level-editor config=debug64
level-editor-mingw-release64: build/projects/mingw
"$(MAKE)" -j$(MAKE_JOBS) -R -C build/projects/mingw level-editor config=release64
tools-mingw-debug64: mingw-debug64 level-editor-mingw-debug64
tools-mingw-release64: mingw-development64 level-editor-mingw-release64
.PHONY: docs
docs:
"$(MAKE)" -C docs/ html
SAMPLES_PLATFORM=$(OS)
.PHONY: 00-empty
00-empty: $(OS)-development64
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --source-dir $(realpath samples/$@) --map-source-dir core $(realpath samples) --compile --platform $(SAMPLES_PLATFORM)
.PHONY: 01-physics
01-physics: $(OS)-development64
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --source-dir $(realpath samples/$@) --map-source-dir core $(realpath samples) --compile --platform $(SAMPLES_PLATFORM)
.PHONY: 02-animation
02-animation: $(OS)-development64
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --source-dir $(realpath samples/$@) --map-source-dir core $(realpath samples) --compile --platform $(SAMPLES_PLATFORM)
.PHONY: 03-joypad
03-joypad: $(OS)-development64
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --source-dir $(realpath samples/$@) --map-source-dir core $(realpath samples) --compile --platform $(SAMPLES_PLATFORM)
.PHONY: samples
samples: 00-empty 01-physics 02-animation 03-joypad
.PHONY: run-00-empty
run-00-empty: 00-empty
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --data-dir $(realpath samples/$<_$(OS))
.PHONY: run-01-physics
run-01-physics: 01-physics
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --data-dir $(realpath samples/$<_$(OS))
.PHONY: run-02-animation
run-02-animation: 02-animation
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --data-dir $(realpath samples/$<_$(OS))
.PHONY: run-03-joypad
run-03-joypad: 03-joypad
cd build/$(OS)64/bin && $(EXE_PREFIX)crown-development$(EXE_SUFFIX) --data-dir $(realpath samples/$<_$(OS))
.PHONY: clean-samples
clean-samples:
-@rm -rf samples/00-empty_*
-@rm -rf samples/01-physics_*
-@rm -rf samples/02-animation_*
-@rm -rf samples/03-joypad_*
.PHONY: codespell
codespell:
@codespell docs src tools \
--ignore-words=scripts/codespell-dictionary.txt \
--skip "*.ttf.h,*.png,docs/_themes,tools/level_editor/resources/theme/Adwaita" \
-q4 # 4: omit warnings about automatic fixes that were disabled in the dictionary.
.PHONY: cppcheck
cppcheck:
@cppcheck src \
--includes-file=scripts/cppcheck/includes.txt \
--suppressions-list=scripts/cppcheck/suppressions.txt \
--enable=all \
--quiet \
--force # Check all configurations.
.PHONY: format-sources
format-sources:
@scripts/uncrustify/format-all.sh -j $(MAKE_JOBS)
.PHONY: create-meson-build
create-meson-build:
$(GENIE) create-meson-build
.PHONY: clean
clean: clean-samples
@echo Cleaning...
ifeq ($(OS), linux)
-@"$(MAKE)" -R -C 3rdparty/luajit/src clean -s
endif
-@rm -rf 3rdparty/bgfx/.build
-@rm -rf 3rdparty/bimg/.build
-@rm -rf build