makefile.discord 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Programs
  2. CC = gcc
  3. CXX = g++
  4. LINKER = g++
  5. # Configuration
  6. Build_Dir = build
  7. Source_Dir = ..
  8. APP = eq2world
  9. # LUA flags
  10. Lua_C_Flags = -DLUA_COMPAT_ALL -DLUA_USE_LINUX
  11. Lua_W_Flags = -Wall
  12. # World flags
  13. C_Flags = -I/usr/include/mariadb -I../depends/fmt/include -I../depends/recastnavigation/Detour/Include -I/usr/local/include/boost -I../depends/glm/ -march=native -pipe -pthread -std=c++17
  14. LD_Flags = -L/usr/lib/x86_64-linux-gnu -lz -lpthread -lmariadbclient -L../depends/recastnavigation/RecastDemo/Build/gmake/lib/Debug -lDebugUtils -lDetour -lDetourCrowd -lDetourTileCache -lRecast -L/usr/local/lib -rdynamic -lm -Wl,-E -ldl -lreadline -lboost_system -lboost_filesystem -lboost_iostreams -lboost_regex
  15. W_Flags = -Wall -Wno-reorder
  16. D_Flags = -DEQ2 -DWORLD -D_GNU_SOURCE
  17. # Setup Debug or Release build
  18. ifeq ($(BUILD),debug)
  19. # "Debug" build - minimum optimization, and debugging symbols
  20. C_Flags += -O -ggdb
  21. D_Flags += -DDEBUG -DDISCORD
  22. LD_Flags += -ldpp
  23. Current_Build_Dir := $(Build_Dir)/debug
  24. App_Filename = $(APP)_debug
  25. else
  26. # "Release" build - optimization, and no debug symbols
  27. C_Flags += -O2 -s -DNDEBUG
  28. Current_Build_Dir := $(Build_Dir)/release
  29. App_Filename = $(APP)
  30. endif
  31. # File lists
  32. World_Source = $(wildcard $(Source_Dir)/WorldServer/*.cpp) $(wildcard $(Source_Dir)/WorldServer/*/*.cpp)
  33. World_Objects = $(patsubst %.cpp,$(Current_Build_Dir)/%.o,$(subst $(Source_Dir)/,,$(World_Source)))
  34. Common_Source = $(wildcard $(Source_Dir)/common/*.cpp)
  35. Common_Objects = $(patsubst %.cpp,$(Current_Build_Dir)/%.o,$(subst $(Source_Dir)/,,$(Common_Source)))
  36. Lua_Source = $(wildcard $(Source_Dir)/LUA/*.c)
  37. Lua_Objects = $(patsubst %.c,$(Current_Build_Dir)/%.o,$(subst $(Source_Dir)/,,$(Lua_Source)))
  38. # Receipes
  39. all: $(APP)
  40. $(APP): $(Common_Objects) $(World_Objects) $(Lua_Objects)
  41. @echo Linking...
  42. @$(LINKER) $(W_Flags) $^ $(LD_Flags) -o $(App_Filename)
  43. @test -e $(APP) || /bin/true
  44. #@ln -s $(App_Filename) $(APP) || /bin/true
  45. @echo Finished building world.
  46. $(Current_Build_Dir)/LUA/%.o: $(Source_Dir)/LUA/%.c
  47. @mkdir -p $(dir $@)
  48. $(CC) -c $(Lua_C_Flags) $(Lua_W_Flags) $< -o $@
  49. $(Current_Build_Dir)/%.o: $(Source_Dir)/%.cpp
  50. @mkdir -p $(dir $@)
  51. $(CXX) -c $(C_Flags) $(D_Flags) $(W_Flags) $< -o $@
  52. #setup:
  53. # @test ! -e volumes.phys && ln -s $(Conf_Dir)/volumes.phys . || /bin/true
  54. # @test ! -e vgemu-structs.xml && ln -s $(Conf_Dir)/vgemu-structs.xml . || /bin/true
  55. # @$(foreach folder,$(wildcard $(Content_Dir)/scripts/*),test -d $(Content_Dir)/scripts && test ! -e $(notdir $(folder)) && ln -s $(folder) . || /bin/true)
  56. # @echo "Symlinks have been created."
  57. # @cp -n $(Conf_Dir)/vgemu-world.xml .
  58. # @echo "You need to edit your config file: vgemu-world.xml"
  59. release:
  60. @$(MAKE) "BUILD=release"
  61. debug:
  62. @$(MAKE) "BUILD=debug"
  63. clean:
  64. rm -rf $(filter-out %Lua,$(foreach folder,$(wildcard $(Current_Build_Dir)/*),$(folder))) $(App_Filename) $(APP)
  65. cleanlua:
  66. rm -rf $(Current_Build_Dir)/Lua
  67. cleanall:
  68. rm -rf $(Build_Dir) $(App_Filename) $(APP)
  69. #cleansetup:
  70. # rm volumes.phys vgemu-structs.xml $(foreach folder,$(wildcard $(Content_Dir)/scripts/*),$(notdir $(folder)))
  71. #docs: docs-world
  72. #docs-world:
  73. # @cd ../../doc; doxygen Doxyfile-World