-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
65 lines (52 loc) · 1.6 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
# You may want to edit these, either here or from the commandline using
# VARIABLE=value
WSW_DIR = ~/.local/share/warsow-2.1/
EXECUTE_DIR = .
EXECUTABLE = wsw-server
MOD = basewsw
NAME = hGunGame Server
GT = hgg_ffa
PORT = 44400
INSTAGIB = 1
NORMAL_INPUT = { echo set sv_hostname '"$(NAME)"' && cat; }
LOOP_INPUT = { echo set sv_hostname '"$(NAME)"'; }
CD = cd $(EXECUTE_DIR)
SERVER_CMD = $(EXECUTABLE) +set fs_game $(MOD) +set sv_port $(PORT) \
+set g_gametype $(GT) +set g_instagib $(INSTAGIB)
THIS = Makefile
GT_DIR = src
TMP_DIR = tmp
BASE_MOD = basewsw
CONFIG_DIR = configs/server/gametypes
GLOBALS_FILE = progs/gametypes/hgg/Base/globals.as
EVERY_PK3 = hgg-*.pk3
EVERY_CFG = hgg_*.cfg
VERSION = $(shell grep VERSION $(GT_DIR)/$(GLOBALS_FILE) \
| head -n1 | sed 's/.*"\(.*\)".*/\1/')
VERSION_WORD = $(subst .,_,$(VERSION))
GT_PK3 = hgg-$(VERSION_WORD).pk3
all: $(GT_PK3)
$(GT_PK3): $(shell find $(GT_DIR)/) $(THIS)
rm -rf $(TMP_DIR)
mkdir $(TMP_DIR)
rm -f *.pk3
cp -r $(GT_DIR)/* $(TMP_DIR)/
cd $(TMP_DIR); zip ../$(GT_PK3) -r -xi *
rm -r $(TMP_DIR)
local: $(GT_PK3)
mkdir -p $(WSW_DIR)/$(BASE_MOD)/
cp $(GT_PK3) $(WSW_DIR)/$(BASE_MOD)/
production: local
$(CD) && $(NORMAL_INPUT) | $(SERVER_CMD)
productionloop: local
$(CD) && while true; do $(LOOP_INPUT) | $(SERVER_CMD); done
clean:
rm -f *.pk3
destroy:
rm -f $(WSW_DIR)/$(BASE_MOD)/$(EVERY_PK3)
rm -f $(WSW_DIR)/$(BASE_MOD)/$(CONFIG_DIR)/$(EVERY_CFG)
rm -f $(WSW_DIR)/$(MOD)/$(CONFIG_DIR)/$(EVERY_CFG)
restart: destroy local
dev: restart
$(CD) && $(NORMAL_INPUT) | $(SERVER_CMD)
.PHONY: all local production productionloop clean destroy restart dev