-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 2.09 KB
/
Makefile
File metadata and controls
56 lines (45 loc) · 2.09 KB
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
#
# build dependencies: libasio-dev libicu-dev libsqlite3-dev libdcserver
# runtime dependencies: fcgiwrap
#
prefix = /usr/local
exec_prefix = $(prefix)
sbindir = $(exec_prefix)/sbin
bindir = $(exec_prefix)/bin
sysconfdir = $(prefix)/etc
libexecdir = $(exec_prefix)/libexec
localstatedir = /var/local
CXXFLAGS=-std=c++17 -g -O3 -Wall -DNDEBUG "-DLOCALSTATEDIR=\"$(localstatedir)\"" # -fsanitize=address -static-libasan
DEPS=database.h models.h lobby_server.h gate_server.h common.h vms.h sega_crypto.h discord.h
USER=dcnet
all: iwango_server keycutter keycutter.cgi culdcept-gamedata
iwango_server: lobby_server.o models.o packet_processor.o gate_server.o database.o discord.o common.o
$(CXX) $(CXXFLAGS) -o $@ lobby_server.o models.o packet_processor.o gate_server.o database.o discord.o common.o -lpthread -licuuc -lsqlite3 -ldcserver -Wl,-rpath,/usr/local/lib
keycutter: keycutter.o sega_crypto.o
$(CXX) $(CXXFLAGS) -o keycutter keycutter.o sega_crypto.o
keycutter.cgi: sega_crypto.o keycutter-cgi.o
$(CXX) $(CXXFLAGS) -o keycutter.cgi sega_crypto.o keycutter-cgi.o
culdcept-gamedata: culdcept-gamedata.o
$(CXX) $(CXXFLAGS) -o culdcept-gamedata culdcept-gamedata.o
%.o: %.cpp $(DEPS)
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f *.o iwango_server keycutter keycutter.cgi culdcept-gamedata
install: iwango_server keycutter.cgi
mkdir -p $(DESTDIR)$(sbindir)
install iwango_server $(DESTDIR)$(sbindir)
mkdir -p $(DESTDIR)$(libexecdir)/cgi-bin
install keycutter.cgi $(DESTDIR)$(libexecdir)/cgi-bin
mkdir -p $(DESTDIR)$(sysconfdir)
cp -n iwango.cfg $(DESTDIR)$(sysconfdir)
iwango.service: iwango.service.in Makefile
sed -e "s/INSTALL_USER/$(USER)/g" -e "s:SBINDIR:$(sbindir):g" -e "s:SYSCONFDIR:$(sysconfdir):g" -e "s:LOCALSTATEDIR:$(localstatedir):g" < $< > $@
installservice: iwango.service
mkdir -p $(localstatedir)/log
mkdir -p /usr/lib/systemd/system/
cp $< /usr/lib/systemd/system/
systemctl enable $<
createdb: iwango.sql
mkdir -p $(localstatedir)/lib/iwango
sqlite3 $(localstatedir)/lib/iwango/iwango.db < iwango.sql
chown $(USER):$(USER) $(localstatedir)/lib/iwango $(localstatedir)/lib/iwango/iwango.db