Torque2D.mk 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. APPNAME := ../../../Torque2D
  2. 2D_SOURCES := $(shell find ../../source/2d/ -name "*.cc") + \
  3. $(shell find ../../source/2d/ -name "*.cpp")
  4. ALGORITHM_SOURCES := $(shell find ../../source/algorithm/ -name "*.cc") + \
  5. $(shell find ../../source/algorithm/ -name "*.c")
  6. ASSETS_SOURCES := $(shell find ../../source/assets/ -name "*.cc")
  7. AUDIO_SOURCES := $(shell find ../../source/audio/ -name "*.cc")
  8. BITMAPFONT_SOURCES := $(shell find ../../source/bitmapFont/ -name "*.cc")
  9. BOX2D_SOURCES := $(shell find ../../source/Box2D/ -name "*.cpp")
  10. COLLECTION_SOURCES := $(shell find ../../source/collection/ -name "*.cc")
  11. COMPONENT_SOURCES := $(shell find ../../source/component/ -name "*.cpp")
  12. CONSOLE_SOURCES := $(shell find ../../source/console/ -name "*.cc")
  13. DEBUG_SOURCES := $(shell find ../../source/debug/ -name "*.cc")
  14. DELEGATES_SOURCES := $(shell find ../../source/delegates/ -name "*.cc")
  15. GAME_SOURCES := $(shell find ../../source/game/ -name "*.cc")
  16. GRAPHICS_SOURCES := $(shell find ../../source/graphics/ -name "*.cc")
  17. GUI_SOURCES := $(shell find ../../source/gui/ -name "*.cc")
  18. INPUT_SOURCES := $(shell find ../../source/input/ -name "*.cc")
  19. IO_SOURCES := $(shell find ../../source/io/ -name "*.cc")
  20. MATH_SOURCES := $(shell find ../../source/math/ -name "*.cc") + \
  21. $(shell find ../../source/math/ -name "*.cpp")
  22. MEMORY_SOURCES := $(shell find ../../source/memory/ -name "*.cc")
  23. MESSAGING_SOURCES := $(shell find ../../source/messaging/ -name "*.cc")
  24. MODULE_SOURCES := $(shell find ../../source/module/ -name "*.cc")
  25. NETWORK_SOURCES := $(shell find ../../source/network/ -name "*.cc")
  26. PERSISTENCE_SOURCES := $(shell find ../../source/persistence/ -name "*.cc") + \
  27. $(shell find ../../source/persistence/ -name "*.cpp")
  28. PLATFORM_SOURCES := $(shell find ../../source/platform/ -name "*.cc") + \
  29. $(shell find ../../source/platform/ -name "*.cpp")
  30. PLATFORM_UNIX_SOURCES := $(shell find ../../source/platformX86UNIX/ -name "*.cc")
  31. SIM_SOURCES := $(shell find ../../source/sim/ -name "*.cc") + \
  32. $(shell find ../../source/sim/ -name "*.cpp")
  33. STRING_SOURCES := $(shell find ../../source/string/ -name "*.cc") + \
  34. $(shell find ../../source/string/ -name "*.cpp")
  35. SOURCES := $(2D_SOURCES) + \
  36. $(ALGORITHM_SOURCES) + \
  37. $(ASSETS_SOURCES) + \
  38. $(AUDIO_SOURCES) + \
  39. $(BITMAPFONT_SOURCES) + \
  40. $(BOX2D_SOURCES) + \
  41. $(COLLECTION_SOURCES) + \
  42. $(COMPONENT_SOURCES) + \
  43. $(CONSOLE_SOURCES) + \
  44. $(DEBUG_SOURCES) + \
  45. $(DELEGATES_SOURCES) + \
  46. $(GAME_SOURCES) + \
  47. $(GRAPHICS_SOURCES) + \
  48. $(GUI_SOURCES) + \
  49. $(INPUT_SOURCES) + \
  50. $(IO_SOURCES) + \
  51. $(MATH_SOURCES) + \
  52. $(MEMORY_SOURCES) + \
  53. $(MESSAGING_SOURCES) + \
  54. $(MODULE_SOURCES) + \
  55. $(NETWORK_SOURCES) + \
  56. $(PERSISTENCE_SOURCES) + \
  57. $(PLATFORM_SOURCES) + \
  58. $(PLATFORM_UNIX_SOURCES) + \
  59. $(SIM_SOURCES) + \
  60. $(STRING_SOURCES)
  61. LDFLAGS := -g -m64
  62. LDLIBS := -lstdc++ -lm -ldl -lpthread -lrt -lX11 -lXft -lSDL -lopenal
  63. CFLAGS := -std=c++17 -MMD -I. -Wfatal-errors -Wunused -m64 -msse -march=x86-64 -pipe
  64. CFLAGS += -I/usr/include
  65. CFLAGS += -I/usr/include/freetype2
  66. CFLAGS += -I../../source
  67. CFLAGS += -I../../source/persistence/rapidjson/include
  68. CFLAGS += -I../../lib/ljpeg
  69. CFLAGS += -I../../lib/zlib
  70. CFLAGS += -I../../lib/lpng
  71. CFLAGS += -I../../lib/freetype
  72. CFLAGS += -I../../lib/libvorbis/include
  73. CFLAGS += -I../../lib/libogg/include
  74. CFLAGS += -I../../lib/openal/LINUX/
  75. CFLAGS += -DLINUX
  76. CFLAGS += -D__amd64__
  77. CFLAGS += -DTORQUE_64
  78. CFLAGS_DEBUG := $(CFLAGS) -ggdb
  79. CFLAGS_DEBUG += -DTORQUE_DEBUG
  80. CFLAGS_DEBUG += -DTORQUE_DEBUG_GUARD
  81. CFLAGS_DEBUG += -DTORQUE_NET_STATS
  82. CFLAGS += -Og
  83. NASMFLAGS := -f elf64 -D LINUX
  84. CC := gcc
  85. LD := gcc
  86. APP_TARGETS += $(APPNAME)
  87. APP_TARGETS_DEBUG += $(APPNAME)_DEBUG
  88. OBJS := $(patsubst ../../source/%,Release/%.o,$(SOURCES))
  89. OBJS := $(filter %.o, $(OBJS))
  90. OBJS_DEBUG := $(patsubst ../../source/%,Debug/%.o,$(SOURCES))
  91. OBJS_DEBUG := $(filter %.o,$(OBJS_DEBUG))
  92. $(APP_TARGETS): $(OBJS) $(LIB_TARGETS)
  93. @echo Linking release
  94. $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIB_TARGETS) $(LDLIBS)
  95. $(APP_TARGETS_DEBUG): $(OBJS_DEBUG) $(LIB_TARGETS_DEBUG)
  96. @echo Linking debug
  97. $(LD) $(LDFLAGS) -o $@ $(OBJS_DEBUG) $(LIB_TARGETS_DEBUG) $(LDLIBS)
  98. Release/%.asm.o: ../../source/%.asm
  99. @echo Building release asm $@
  100. @mkdir -p $(dir $@)
  101. nasm $(NASMFLAGS) $< -o $@
  102. Release/%.o: ../../source/%
  103. @echo Building release object $@
  104. @mkdir -p $(dir $@)
  105. $(CC) -c $(CFLAGS) $< -o $@
  106. Debug/%.asm.o: ../../source/%.asm
  107. @echo Building debug asm $@
  108. @mkdir -p $(dir $@)
  109. nasm $(NASMFLAGS) $< -o $@
  110. Debug/%.o: ../../source/%
  111. @echo Building debug object $@
  112. @mkdir -p $(dir $@)
  113. $(CC) -c $(CFLAGS_DEBUG) $< -o $@
  114. release: $(APP_TARGETS)
  115. debug: $(APP_TARGETS_DEBUG)
  116. .PHONY: $(APP_TARGETS) $(APP_TARGETS_DEBUG)
  117. DEPS += $(patsubst %.o,%.d,$(OBJS))
  118. DEPS += $(patsubst %.o,%.d,$(OBJS_DEBUG))
  119. APPNAME :=
  120. SOURCES :=