forked from otland/tfs-old-svn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
105 lines (86 loc) · 2.84 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
# Makefile for Linux (Ubuntu, Debian), Windows (mingw, probably supports MSVC too)
TFS = forgottenserver
INCLUDEDIRS = -I"." -I"/usr/include/libxml2" -I"/usr/include/mysql"
LIBS = -lxml2 -lpthread -lgmp
ifdef LUAJIT
INCLUDEDIRS += -I"/usr/include/luajit-2.0"
LIBS += -lluajit-5.1
else
INCLUDEDIRS += -I"/usr/include/lua5.1"
LIBS += -llua5.1
endif
FLAGS = -D_THREAD_SAFE -D_REENTRANT -D__NO_HOMEDIR_CONF__ -D__ENABLE_SERVER_DIAGNOSTIC__
CXXFLAGS = $(INCLUDEDIRS) $(FLAGS) -Werror -Wall -O3 -fno-strict-aliasing
CXX = g++
#For windows:
# mingw32-make
#For Linux:
# make
ifndef MYSQL
MYSQL = 1
endif
ifndef SQLITE
SQLITE = 1
endif
ifeq ($(MYSQL),1)
ifdef WIN32
LIBS += -lmysql
else
LIBS += -lmysqlclient
endif
FLAGS += -D__USE_MYSQL__
endif
ifeq ($(SQLITE),1)
LIBS += -lsqlite3
FLAGS += -D__USE_SQLITE__
endif
#mingw32-make WIN32=1 LATEST_MINGW=1
ifdef WIN32
ifdef LATEST_MINGW
#Causes notices when compiling with latest MinGW without these flags.
FLAGS += -enable-stdcall-fixup -enable-auto-import -enable-runtime-pseudo-reloc
LIBS += -lboost_system-mgw45-1_45 -lboost_thread-mgw45-mt-1_45 -lboost_regex-mgw45-1_45
else
LIBS += -lboost_system -lboost_thread -lboost_regex
endif
LIBS += -lws2_32 -lwsock32
FLAGS += -mwindows
else
LIBS += -lboost_thread -lboost_system -lboost_regex -lpthread -ldl
endif
#mingw32-make DEBUG=1
#make DEBUG=1
ifdef DEBUG
CXXFLAGS += -g
#TODO: add all flags
FLAGS += -D__DEBUG__ -D__DEBUG_PLAYERS__
endif
LDFLAGS = $(LIBS)
ifdef WIN32
DEL = del
endif
CXXSOURCES = actions.cpp admin.cpp allocator.cpp ban.cpp baseevents.cpp beds.cpp \
creature.cpp creatureevent.cpp chat.cpp combat.cpp commands.cpp condition.cpp configmanager.cpp \
connection.cpp container.cpp cylinder.cpp database.cpp databasemanager.cpp databasemysql.cpp \
databasesqlite.cpp depotchest.cpp depotlocker.cpp exception.cpp fileloader.cpp game.cpp \
globalevent.cpp gui.cpp house.cpp housetile.cpp inbox.cpp ioguild.cpp iologindata.cpp iomap.cpp \
iomapserialize.cpp iomarket.cpp inputbox.cpp item.cpp items.cpp logger.cpp luascript.cpp mailbox.cpp \
map.cpp md5.cpp modalwindow.cpp monster.cpp monsters.cpp mounts.cpp movement.cpp networkmessage.cpp \
npc.cpp otserv.cpp outfit.cpp outputmessage.cpp party.cpp player.cpp playerbox.cpp position.cpp \
protocol.cpp protocolgame.cpp protocollogin.cpp protocolold.cpp quests.cpp raids.cpp rsa.cpp \
scheduler.cpp scriptmanager.cpp server.cpp sha1.cpp spawn.cpp spells.cpp status.cpp talkaction.cpp \
tasks.cpp teleport.cpp textlogger.cpp thing.cpp tile.cpp tools.cpp trashholder.cpp vocation.cpp \
waitlist.cpp weapons.cpp
OBJDIR = obj
CXXOBJECTS = $(CXXSOURCES:%.cpp=$(OBJDIR)/%.o)
all: $(TFS)
clean:
ifdef WIN32
-$(DEL) $(CXXOBJECTS) $(TFS)
else
$(RM) $(CXXOBJECTS) $(TFS)
endif
$(TFS): $(CXXOBJECTS)
$(CXX) $(CXXFLAGS) -o $@ $(CXXOBJECTS) $(LDFLAGS)
$(OBJDIR)/%.o: %.cpp
$(CXX) -c $(CXXFLAGS) -o $@ $<