-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (52 loc) · 1.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
OUT_DIR:=build/
EXEC_NAME:=main
SYSTEM_NAME:=Linux
TOOLCHAIN:=
BUILD_TYPE:=
PACKAGE_NAME:=shooter2
PACKAGE_EXEC_NAME:=$(PACKAGE_NAME)
PACKAGE_TOOL:=tar cvfJ
PACKAGE_FILE_TYPE := .tar.xz
RUN_COMMAND:=
RELEASE_BUILD:=
ifdef RELEASE
RELEASE_BUILD:=RELEASE=true
BUILD_TYPE:=Release
OUT_DIR:=$(OUT_DIR)release
else
BUILD_TYPE:=Debug
OUT_DIR:=$(OUT_DIR)debug
endif
ifdef WINDOWS
OUT_DIR:=$(OUT_DIR)_win
PACKAGE_EXEC_NAME:=$(PACKAGE_EXEC_NAME).exe
EXEC_NAME:=$(EXEC_NAME).exe
SYSTEM_NAME:=Windows
TOOLCHAIN:=-DCMAKE_TOOLCHAIN_FILE=win.toolchain.cmake
PACKAGE_TOOL:=7z a
PACKAGE_FILE_TYPE:=.zip
PACKAGE_NAME:=$(PACKAGE_NAME)_win
RUN_COMMAND:=wine
endif
run: build
$(RUN_COMMAND) $(OUT_DIR)/$(EXEC_NAME)
package: build
cp $(OUT_DIR)/$(EXEC_NAME) $(PACKAGE_EXEC_NAME)
$(PACKAGE_TOOL) $(PACKAGE_NAME)$(PACKAGE_FILE_TYPE) game_modes/ maps/ sprites/ $(PACKAGE_EXEC_NAME)
rm $(PACKAGE_EXEC_NAME)
build: build_bin game_modes/%.wasm bots/%.wasm
game_modes/%.wasm:
$(MAKE) -C src/game_modes/ $(RELEASE_BUILD)
bots/%.wasm:
$(MAKE) -C src/bots/ $(RELEASE_BUILD)
build_bin: configure
ninja -C $(OUT_DIR) -j2
configure: CMakeLists.txt
/usr/bin/cmake -B$(OUT_DIR) -H. -GNinja -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_SYSTEM_NAME=$(SYSTEM_NAME) $(TOOLCHAIN)
clean:
rm -rf build/
rm -f game_modes/*
rm -rf $(OUT_DIR)
rm -f $(PACKAGE_NAME)$(PACKAGE_FILE_TYPE)
rm -rf src/game_modes/build/
rm -rf src/game_modes/*/target/