-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (53 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
66
WSW_DIR = ~/.warsow-1.0
EXECUTE_DIR = .
EXECUTABLE = wsw-server
MOD = basewsw
NAME = objective
SERVER_CMD = cd $(EXECUTE_DIR) && $(EXECUTABLE) +set fs_game $(MOD) \
+set g_gametype $(NAME)
THIS = Makefile
SOURCE_DIR = source
GAMETYPES_DIR = /progs/gametypes/
SOURCE_DESTINATION_DIR = $(GAMETYPES_DIR)$(NAME)/
DATA_DIR = data
TMP_DIR = tmp
BASE_MOD = basewsw
CONFIG_DIR = configs/server/gametypes
FILES = $(shell find $(SOURCE_DIR) $(DATA_DIR))
SETTINGS_FILE = $(SOURCE_DIR)/main/Settings.as
EVERY_PK3 = $(NAME)-*.pk3
CFG = $(NAME).cfg
VERSION = $(shell grep VERSION $(SETTINGS_FILE) \
| head -n1 | sed 's/.*"\(.*\)".*/\1/')
VERSION_WORD = $(subst .,_,$(VERSION))
PK3 = $(NAME)-$(VERSION_WORD).pk3
all: dist
dist: $(PK3)
$(PK3): $(FILES) $(THIS)
rm -rf $(TMP_DIR)
mkdir -p $(TMP_DIR)$(SOURCE_DESTINATION_DIR)
rm -f $(PK3)
cp -r $(SOURCE_DIR)/* $(TMP_DIR)$(SOURCE_DESTINATION_DIR)
mv $(TMP_DIR)$(SOURCE_DESTINATION_DIR)imports \
$(TMP_DIR)$(GAMETYPES_DIR)$(NAME).gt
cd $(TMP_DIR)$(GAMETYPES_DIR) && find . -name '*.as' \
| sed 's|^./||' | sed 's/$$/;/' | sort >> $(NAME).gt
cp -r $(DATA_DIR)/* $(TMP_DIR)/
cd $(TMP_DIR) && zip ../$(PK3) -r -xi *
rm -r $(TMP_DIR)
local: dist
cp $(PK3) $(WSW_DIR)/$(BASE_MOD)/
production: local
$(SERVER_CMD)
productionloop: local
while true; do $(SERVER_CMD); done
clean:
rm -f $(EVERY_PK3)
destroy:
rm -f $(WSW_DIR)/$(BASE_MOD)/$(EVERY_PK3)
rm -f $(WSW_DIR)/$(BASE_MOD)/$(CONFIG_DIR)/$(CFG)
rm -f $(WSW_DIR)/$(MOD)/$(CONFIG_DIR)/$(CFG)
restart: destroy local
dev: restart
$(SERVER_CMD)
.PHONY: all dist local production productionloop clean destroy restart dev