Torque2D.mk 5.1 KB

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