makefile 3.2 KB

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