2020-12-06 04:25:23 +00:00
|
|
|
GIT_VERSION!=git describe --tags
|
|
|
|
|
2020-08-28 18:02:03 +00:00
|
|
|
CC=clang
|
2020-08-20 17:03:15 +00:00
|
|
|
CXX=clang++
|
|
|
|
# -w suppresses all warnings (the part that's commented out helps me find memory leaks, it ruins performance though!)
|
2020-09-24 01:12:24 +00:00
|
|
|
# If compiling with ASAN, invoke like this: $ LSAN_OPTIONS=suppressions=suppr.txt bin/fusion
|
2020-08-28 20:44:29 +00:00
|
|
|
CFLAGS=-O3 #-g3 -fsanitize=address
|
2021-03-12 17:50:21 +00:00
|
|
|
CXXFLAGS=-Wall -Wno-unknown-pragmas -std=c++17 -O2 -DPROTOCOL_VERSION=$(PROTOCOL_VERSION) -DGIT_VERSION=\"$(GIT_VERSION)\" -I./vendor #-g3 -fsanitize=address
|
2020-12-14 02:42:11 +00:00
|
|
|
LDFLAGS=-lpthread -lsqlite3 #-g3 -fsanitize=address
|
2020-08-20 17:03:15 +00:00
|
|
|
# specifies the name of our exectuable
|
|
|
|
SERVER=bin/fusion
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-08-21 17:38:45 +00:00
|
|
|
# assign protocol version
|
|
|
|
# this can be overriden by ex. make PROTOCOL_VERSION=728
|
|
|
|
PROTOCOL_VERSION?=104
|
|
|
|
|
2020-08-20 17:03:15 +00:00
|
|
|
# Windows-specific
|
2020-08-28 18:02:03 +00:00
|
|
|
WIN_CC=x86_64-w64-mingw32-gcc
|
2020-08-20 17:03:15 +00:00
|
|
|
WIN_CXX=x86_64-w64-mingw32-g++
|
2020-09-06 15:52:50 +00:00
|
|
|
WIN_CFLAGS=-O3 #-g3 -fsanitize=address
|
2021-03-12 17:50:21 +00:00
|
|
|
WIN_CXXFLAGS=-D_WIN32_WINNT=0x0601 -Wall -Wno-unknown-pragmas -std=c++17 -O3 -DPROTOCOL_VERSION=$(PROTOCOL_VERSION) -DGIT_VERSION=\"$(GIT_VERSION)\" -I./vendor #-g3 -fsanitize=address
|
2020-12-14 16:39:26 +00:00
|
|
|
WIN_LDFLAGS=-static -lws2_32 -lwsock32 -lsqlite3 #-g3 -fsanitize=address
|
2020-08-20 17:03:15 +00:00
|
|
|
WIN_SERVER=bin/winfusion.exe
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-08-28 20:44:29 +00:00
|
|
|
CSRC=\
|
2021-03-12 17:50:21 +00:00
|
|
|
vendor/bcrypt/bcrypt.c\
|
|
|
|
vendor/bcrypt/crypt_blowfish.c\
|
|
|
|
vendor/bcrypt/crypt_gensalt.c\
|
|
|
|
vendor/bcrypt/wrapper.c\
|
2020-08-28 18:02:03 +00:00
|
|
|
|
2020-08-28 20:44:29 +00:00
|
|
|
CXXSRC=\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/ChatManager.cpp\
|
2021-03-12 19:07:26 +00:00
|
|
|
src/CustomCommands.cpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/CNLoginServer.cpp\
|
|
|
|
src/CNProtocol.cpp\
|
|
|
|
src/CNShardServer.cpp\
|
|
|
|
src/CNShared.cpp\
|
2020-08-28 18:02:03 +00:00
|
|
|
src/Database.cpp\
|
2020-08-22 17:19:46 +00:00
|
|
|
src/Defines.cpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/main.cpp\
|
2020-08-24 21:04:56 +00:00
|
|
|
src/MissionManager.cpp\
|
2020-09-16 19:46:15 +00:00
|
|
|
src/MobManager.cpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/NanoManager.cpp\
|
2020-08-21 02:10:14 +00:00
|
|
|
src/ItemManager.cpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/NPCManager.cpp\
|
|
|
|
src/PlayerManager.cpp\
|
2021-03-12 22:44:21 +00:00
|
|
|
src/PlayerMovement.cpp\
|
2021-03-12 22:18:00 +00:00
|
|
|
src/BuiltinCommands.cpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/settings.cpp\
|
2020-08-29 11:43:33 +00:00
|
|
|
src/TransportManager.cpp\
|
2020-09-09 17:06:22 +00:00
|
|
|
src/TableData.cpp\
|
2020-09-17 22:45:43 +00:00
|
|
|
src/ChunkManager.cpp\
|
2020-09-19 21:16:47 +00:00
|
|
|
src/BuddyManager.cpp\
|
2020-10-04 23:54:08 +00:00
|
|
|
src/GroupManager.cpp\
|
2020-12-02 09:00:11 +00:00
|
|
|
src/Monitor.cpp\
|
2020-11-28 13:29:06 +00:00
|
|
|
src/RacingManager.cpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
|
|
|
|
# headers (for timestamp purposes)
|
2020-08-28 20:44:29 +00:00
|
|
|
CHDR=\
|
2021-03-12 17:50:21 +00:00
|
|
|
vendor/bcrypt/bcrypt.h\
|
|
|
|
vendor/bcrypt/crypt_blowfish.h\
|
|
|
|
vendor/bcrypt/crypt_gensalt.h\
|
|
|
|
vendor/bcrypt/ow-crypt.h\
|
|
|
|
vendor/bcrypt/winbcrypt.h\
|
2020-08-28 18:02:03 +00:00
|
|
|
|
2020-08-28 20:44:29 +00:00
|
|
|
CXXHDR=\
|
2021-03-12 17:50:21 +00:00
|
|
|
vendor/bcrypt/BCrypt.hpp\
|
|
|
|
vendor/INIReader.hpp\
|
|
|
|
vendor/JSON.hpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/ChatManager.hpp\
|
2021-03-12 19:07:26 +00:00
|
|
|
src/CustomCommands.hpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/CNLoginServer.hpp\
|
|
|
|
src/CNProtocol.hpp\
|
|
|
|
src/CNShardServer.hpp\
|
|
|
|
src/CNShared.hpp\
|
|
|
|
src/CNStructs.hpp\
|
2020-08-28 18:02:03 +00:00
|
|
|
src/Database.hpp\
|
2020-08-22 15:25:42 +00:00
|
|
|
src/Defines.hpp\
|
2021-03-12 17:50:21 +00:00
|
|
|
vendor/INIReader.hpp\
|
|
|
|
vendor/JSON.hpp\
|
2020-08-24 21:04:56 +00:00
|
|
|
src/MissionManager.hpp\
|
2020-09-16 19:46:15 +00:00
|
|
|
src/MobManager.hpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/NanoManager.hpp\
|
2020-08-21 02:10:14 +00:00
|
|
|
src/ItemManager.hpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/NPCManager.hpp\
|
|
|
|
src/Player.hpp\
|
|
|
|
src/PlayerManager.hpp\
|
2021-03-12 22:44:21 +00:00
|
|
|
src/PlayerMovement.hpp\
|
2021-03-12 22:18:00 +00:00
|
|
|
src/BuiltinCommands.hpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
src/settings.hpp\
|
2020-08-29 11:43:33 +00:00
|
|
|
src/TransportManager.hpp\
|
2020-09-09 17:06:22 +00:00
|
|
|
src/TableData.hpp\
|
2020-09-17 22:45:43 +00:00
|
|
|
src/ChunkManager.hpp\
|
2020-09-19 21:16:47 +00:00
|
|
|
src/BuddyManager.hpp\
|
2020-10-04 23:54:08 +00:00
|
|
|
src/GroupManager.hpp\
|
2020-12-02 09:00:11 +00:00
|
|
|
src/Monitor.hpp\
|
2020-11-28 13:29:06 +00:00
|
|
|
src/RacingManager.hpp\
|
2020-08-20 17:03:15 +00:00
|
|
|
|
2020-08-28 20:44:29 +00:00
|
|
|
COBJ=$(CSRC:.c=.o)
|
|
|
|
CXXOBJ=$(CXXSRC:.cpp=.o)
|
2020-08-28 18:02:03 +00:00
|
|
|
|
2020-08-28 20:44:29 +00:00
|
|
|
OBJ=$(COBJ) $(CXXOBJ)
|
2020-08-20 17:03:15 +00:00
|
|
|
|
2020-08-31 16:10:01 +00:00
|
|
|
HDR=$(CHDR) $(CXXHDR)
|
|
|
|
|
2020-08-20 17:03:15 +00:00
|
|
|
all: $(SERVER)
|
|
|
|
|
|
|
|
windows: $(SERVER)
|
|
|
|
|
2020-08-21 17:38:45 +00:00
|
|
|
# assign Windows-specific values if targeting Windows
|
2020-08-28 18:02:03 +00:00
|
|
|
windows : CC=$(WIN_CC)
|
2020-08-20 17:03:15 +00:00
|
|
|
windows : CXX=$(WIN_CXX)
|
2020-08-28 20:44:29 +00:00
|
|
|
windows : CFLAGS=$(WIN_CFLAGS)
|
2020-08-20 17:03:15 +00:00
|
|
|
windows : CXXFLAGS=$(WIN_CXXFLAGS)
|
|
|
|
windows : LDFLAGS=$(WIN_LDFLAGS)
|
|
|
|
windows : SERVER=$(WIN_SERVER)
|
2020-09-16 18:12:12 +00:00
|
|
|
|
2020-08-30 21:55:17 +00:00
|
|
|
.SUFFIX: .o .c .cpp .h .hpp
|
2020-08-28 18:02:03 +00:00
|
|
|
|
2020-08-31 16:10:01 +00:00
|
|
|
.c.o:
|
2020-08-28 20:44:29 +00:00
|
|
|
$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
|
2020-08-31 16:10:01 +00:00
|
|
|
.cpp.o:
|
2020-08-20 17:03:15 +00:00
|
|
|
$(CXX) -c $(CXXFLAGS) -o $@ $<
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-08-31 16:10:01 +00:00
|
|
|
# header timestamps are a prerequisite for OF object files
|
|
|
|
$(CXXOBJ): $(CXXHDR)
|
|
|
|
|
2020-08-28 20:44:29 +00:00
|
|
|
$(SERVER): $(OBJ) $(CHDR) $(CXXHDR)
|
2020-08-20 17:03:15 +00:00
|
|
|
mkdir -p bin
|
|
|
|
$(CXX) $(OBJ) $(LDFLAGS) -o $(SERVER)
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-09-16 18:12:12 +00:00
|
|
|
# compatibility with how cmake injects GIT_VERSION
|
|
|
|
version.h:
|
|
|
|
touch version.h
|
|
|
|
|
|
|
|
src/main.o: version.h
|
|
|
|
|
2020-08-30 21:55:17 +00:00
|
|
|
.PHONY: all windows clean nuke
|
2020-08-18 20:42:30 +00:00
|
|
|
|
2020-08-30 21:55:17 +00:00
|
|
|
# only gets rid of OpenFusion objects, so we don't need to
|
|
|
|
# recompile the libs every time
|
2020-08-20 17:03:15 +00:00
|
|
|
clean:
|
2020-09-16 18:12:12 +00:00
|
|
|
rm -f src/*.o $(SERVER) $(WIN_SERVER) version.h
|
2020-08-30 21:55:17 +00:00
|
|
|
|
|
|
|
# gets rid of all compiled objects, including the libraries
|
|
|
|
nuke:
|
2020-09-16 18:12:12 +00:00
|
|
|
rm -f $(OBJ) $(SERVER) $(WIN_SERVER) version.h
|