-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
124 lines (90 loc) · 2.91 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
# Use 'make stable' to compile monster, 'make trunk' to compile monster-trunk.
# Use 'make install' to install monster, 'make install-trunk' to install
# monster-trunk.
.PHONY: crawl
# Use master
TRUNK = master
CRAWL_PATH=crawl-ref/crawl-ref/source
CXX = g++
PYTHON = python
ifdef USE_MERGE_BASE
MERGE_BASE := $(shell cd $(CRAWL_PATH) ; git merge-base HEAD $(USE_MERGE_BASE))
endif
VERSION = $(shell cd $(CRAWL_PATH) ; git describe)
CFLAGS = -Wall -Wno-parentheses -DNDEBUG -DUNIX -I$(CRAWL_PATH) \
-I$(CRAWL_PATH)/rltiles -I/usr/include/ncursesw -g -O0 --std=c++11
LFLAGS = -lncursesw -lz -lpthread -g
LUA_INCLUDE_DIR = /usr/include/lua5.1
ifeq (,$(wildcard $(LUA_INCLUDE_DIR)/lua.h))
BUILD_LUA = y
endif
ifeq (,$(BUILD_LUA))
CFLAGS += -I$(LUA_INCLUDE_DIR)
LFLAGS += -llua5.1
else
LUASRC := $(CRAWL_PATH)/contrib/lua/src
LUALIB = lua
LUALIBA = lib$(LUALIB).a
CFLAGS += -I$(LUASRC)
LFLAGS += $(LUASRC)/$(LUALIBA)
CONTRIB_OBJECTS += $(LUASRC)/$(LUALIBA)
endif
SQLITE_INCLUDE_DIR = /usr/include
ifeq (,$(wildcard $(SQLITE_INCLUDE_DIR)/sqlite3.h))
BUILD_SQLITE = y
endif
ifeq (,$(BUILD_SQLITE))
LFLAGS += -lsqlite3
else
SQLSRC := $(CRAWL_PATH)/contrib/sqlite
SQLLIB := sqlite3
SQLLIBA := lib$(SQLLIB).a
FSQLLIBA := $(SQLSRC)/$(SQLLIBA)
CFLAGS += -I$(SQLSRC)
LFLAGS += $(FSQLLIBA)
CONTRIB_OBJECTS += $(FSQLLIBA)
endif
include $(CRAWL_PATH)/Makefile.obj
CRAWL_OBJECTS := $(OBJECTS:main.o=)
CRAWL_OBJECTS += libunix.o version.o
TILEDEFS := floor wall feat main player gui icons dngn unrand
CRAWL_OBJECTS += $(TILEDEFS:%=rltiles/tiledef-%.o)
MONSTER_OBJECTS = monster-main.o vault_monster_data.o vault_monsters.o
ALL_OBJECTS = $(MONSTER_OBJECTS) $(CRAWL_OBJECTS:%=$(CRAWL_PATH)/%)
all: vaults trunk
crawl:
+${MAKE} -C $(CRAWL_PATH) NO_OPTIMIZE=y DEBUG=$(DEBUG) TILES= NO_LUA_BINDINGS=y
.cc.o:
${CXX} ${CFLAGS} -o $@ -c $<
vault_monster_data.o: vaults
trunk: monster-trunk
vault_monster_data.o:
${CXX} ${CFLAGS} -o vault_monster_data.o -c vault_monster_data.cc
vaults: | update-cdo-git
rm -f vault_monster_data.cc vault_monster_data.o
${PYTHON} parse_des.py --verbose
update-cdo-git:
[ "`hostname`" != "ipx14623" ] || sudo -H -u git /var/cache/git/crawl-ref.git/update.sh
monster-trunk: vaults update-cdo-git crawl $(MONSTER_OBJECTS) $(CONTRIB_OBJECTS)
g++ $(CFLAGS) -o $@ $(ALL_OBJECTS) $(LFLAGS)
$(LUASRC)/$(LUALIBA):
echo Building Lua...
cd $(LUASRC) && $(MAKE) all
$(FSQLLIBA):
echo Building SQLite
cd $(SQLSRC) && $(MAKE)
test: monster
./monster-trunk quasit
install-trunk: monster-trunk tile_info.txt
strip -s monster-trunk
cp monster-trunk $(HOME)/bin/
if [ -f ~/source/announcements.log ]; then \
echo 'Monster database of master branch on crawl.develz.org updated to: $(VERSION)' >>~/source/announcements.log;\
fi
tile_info.txt:
${PYTHON} parse_tiles.py --verbose
clean:
rm -f *.o
rm -f monster monster-trunk
rm -f *.pyc vault_monster_data.cc
cd $(CRAWL_PATH) && git clean -f -d -x && git pull