Makefile 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. VERSION = -std=c++14
  2. CFLAGS = $(shell pkg-config --cflags glfw3)
  3. LDFLAGS = $(shell pkg-config --static --libs glfw3) -lGL -lGLEW -lpng
  4. all: game_client game_server
  5. test_client: game_client
  6. optirun ./game_client
  7. run_client: game_client
  8. #vblank_mode=0 optirun ./game_client
  9. optirun ./game_client
  10. game_client: MainClient.cpp\
  11. Clock.o DirectRenderer.o KeyManager.o Mesh.o MouseManager.o Shader.o\
  12. Texture.o Utils.o Wrapper.o ShaderProgram.o WorldShader.o FramebufferRectangle.o\
  13. SSAOShader.o SSAOBlurShader.o WorldPostShader.o OverlayShader.o\
  14. Matrix3D.o Matrix3DStack.o StackOverflow.o StackUnderflow.o Vector3D.o Plane3D.o Camera3D.o\
  15. Client.o\
  16. Block.o Blocks.o BlockAir.o\
  17. Face.o GUI.o StartMenu.o\
  18. Chunk.o World.o ChunkRenderer.o ClientChunkProvider.o BlockRenderer.o BlockRenderers.o EntityRenderer.o
  19. g++ $(VERSION) -o $@ MainClient.cpp Clock.o DirectRenderer.o KeyManager.o Mesh.o MouseManager.o Shader.o\
  20. Texture.o Utils.o Wrapper.o ShaderProgram.o WorldShader.o FramebufferRectangle.o\
  21. SSAOShader.o SSAOBlurShader.o WorldPostShader.o OverlayShader.o\
  22. Matrix3D.o Matrix3DStack.o StackOverflow.o StackUnderflow.o Vector3D.o Plane3D.o Camera3D.o\
  23. Client.o\
  24. Block.o Blocks.o BlockAir.o\
  25. Face.o GUI.o StartMenu.o\
  26. Chunk.o World.o ChunkRenderer.o ClientChunkProvider.o BlockRenderer.o BlockRenderers.o EntityRenderer.o $(LDFLAGS)
  27. # ------------------------------------------------------------------------------
  28. # Engine
  29. # ------------------------------------------------------------------------------
  30. Clock.o: engine/Clock.cpp engine/Clock.h
  31. g++ $(VERSION) -c engine/Clock.cpp -o $@
  32. DirectRenderer.o: engine/DirectRenderer.cpp engine/DirectRenderer.h\
  33. math/Matrix3D.h engine/Texture.h engine/Utils.h engine/Wrapper.h
  34. g++ $(VERSION) -c engine/DirectRenderer.cpp -o $@
  35. KeyManager.o: engine/KeyManager.cpp engine/KeyManager.h
  36. g++ $(VERSION) -c engine/KeyManager.cpp -o $@
  37. Mesh.o: engine/Mesh.cpp engine/Mesh.h
  38. g++ $(VERSION) -c engine/Mesh.cpp -o $@
  39. MouseManager.o: engine/MouseManager.cpp engine/MouseManager.h
  40. g++ $(VERSION) -c engine/MouseManager.cpp -o $@
  41. Shader.o: engine/Shader.cpp engine/Shader.h\
  42. math/Plane3D.h math/Vector3D.h math/Matrix3D.h math/Matrix3DStack.h\
  43. engine/Utils.h engine/Wrapper.h
  44. g++ $(VERSION) -c engine/Shader.cpp -o $@
  45. Texture.o: engine/Texture.cpp engine/Texture.h
  46. g++ $(VERSION) -c engine/Texture.cpp -o $@
  47. Utils.o: engine/Utils.cpp engine/Utils.h
  48. g++ $(VERSION) -c engine/Utils.cpp -o $@
  49. Wrapper.o: engine/Wrapper.cpp engine/Wrapper.h\
  50. engine/shader/ShaderProgram.h math/Vector3D.h math/Matrix3D.h\
  51. engine/shader/WorldShader.h engine/Shader.h\
  52. engine/shader/SSAOShader.h engine/shader/SSAOBlurShader.h\
  53. engine/shader/FramebufferRectangle.h engine/shader/WorldPostShader.h\
  54. engine/shader/OverlayShader.h engine/Mesh.h
  55. g++ $(VERSION) -c engine/Wrapper.cpp -o $@
  56. ShaderProgram.o: engine/shader/ShaderProgram.cpp engine/shader/ShaderProgram.h
  57. g++ $(VERSION) -c engine/shader/ShaderProgram.cpp -o $@
  58. WorldShader.o: engine/shader/WorldShader.cpp engine/shader/WorldShader.h\
  59. engine/shader/ShaderProgram.h engine/Wrapper.h
  60. g++ $(VERSION) -c engine/shader/WorldShader.cpp -o $@
  61. FramebufferRectangle.o: engine/shader/FramebufferRectangle.cpp engine/shader/FramebufferRectangle.h\
  62. engine/Wrapper.h
  63. g++ $(VERSION) -c engine/shader/FramebufferRectangle.cpp -o $@
  64. SSAOShader.o: engine/shader/SSAOShader.cpp engine/shader/SSAOShader.h\
  65. engine/shader/ShaderProgram.h engine/Wrapper.h
  66. g++ $(VERSION) -c engine/shader/SSAOShader.cpp -o $@
  67. SSAOBlurShader.o: engine/shader/SSAOBlurShader.cpp engine/shader/SSAOBlurShader.h\
  68. engine/shader/ShaderProgram.h engine/Wrapper.h
  69. g++ $(VERSION) -c engine/shader/SSAOBlurShader.cpp -o $@
  70. WorldPostShader.o: engine/shader/WorldPostShader.cpp engine/shader/WorldPostShader.h\
  71. engine/shader/ShaderProgram.h engine/Wrapper.h
  72. g++ $(VERSION) -c engine/shader/WorldPostShader.cpp -o $@
  73. OverlayShader.o: engine/shader/OverlayShader.cpp engine/shader/OverlayShader.h\
  74. engine/shader/ShaderProgram.h math/Matrix3D.h engine/Wrapper.h
  75. g++ $(VERSION) -c engine/shader/OverlayShader.cpp -o $@
  76. # ------------------------------------------------------------------------------
  77. # Client
  78. # ------------------------------------------------------------------------------
  79. Client.o: client/Client.h client/Client.cpp\
  80. engine/KeyManager.h engine/MouseManager.h engine/Clock.h\
  81. engine/Shader.h engine/DirectRenderer.h\
  82. client/rendering/gui/GUIs.h client/rendering/gui/GUI.h client/rendering/gui/StartMenu.h
  83. g++ $(VERSION) -c client/Client.cpp -o $@
  84. ChunkRenderer.o: client/rendering/ChunkRenderer.h client/rendering/ChunkRenderer.cpp world/IChunkListener.h\
  85. client/rendering/block/BlockRenderers.h client/rendering/block/BlockRenderer.h\
  86. engine/Mesh.h engine/Shader.h engine/Texture.h engine/DirectRenderer.h\
  87. world/IChunkListener.h math/Camera3D.h
  88. g++ $(VERSION) -c client/rendering/ChunkRenderer.cpp -o $@
  89. ClientChunkProvider.o: client/rendering/ClientChunkProvider.h client/rendering/ClientChunkProvider.cpp world/IChunkProvider.h\
  90. world/IChunkProvider.h
  91. g++ $(VERSION) -c client/rendering/ClientChunkProvider.cpp -o $@
  92. BlockRenderer.o: client/rendering/block/BlockRenderer.h client/rendering/block/BlockRenderer.cpp engine/Mesh.h utils/Face.h
  93. g++ $(VERSION) -c client/rendering/block/BlockRenderer.cpp -o $@
  94. BlockRenderers.o: client/rendering/block/BlockRenderers.h client/rendering/block/BlockRenderers.cpp block/Block.h client/rendering/block/BlockRenderer.h
  95. g++ $(VERSION) -c client/rendering/block/BlockRenderers.cpp -o $@
  96. EntityRenderer.o: client/rendering/entity/EntityRenderer.h client/rendering/entity/EntityRenderer.cpp\
  97. engine/Shader.h math/Camera3D.h engine/DirectRenderer.h engine/Mesh.h\
  98. engine/Texture.h engine/Utils.h
  99. g++ $(VERSION) -c client/rendering/entity/EntityRenderer.cpp -o $@
  100. GUI.o: client/rendering/gui/GUI.h client/rendering/gui/GUI.cpp\
  101. engine/KeyManager.h engine/MouseManager.h engine/Shader.h engine/DirectRenderer.h
  102. g++ $(VERSION) -c client/rendering/gui/GUI.cpp -o $@
  103. StartMenu.o: client/rendering/gui/StartMenu.h client/rendering/gui/StartMenu.cpp\
  104. client/rendering/gui/GUI.h
  105. g++ $(VERSION) -c client/rendering/gui/StartMenu.cpp -o $@
  106. # ------------------------------------------------------------------------------
  107. # Utils
  108. # ------------------------------------------------------------------------------
  109. Face.o: utils/Face.h utils/Face.cpp
  110. g++ $(VERSION) -c utils/Face.cpp -o $@
  111. # ------------------------------------------------------------------------------
  112. # Block
  113. # ------------------------------------------------------------------------------
  114. Block.o: block/Block.h block/Block.cpp utils/Face.h
  115. g++ $(VERSION) -c block/Block.cpp -o $@
  116. Blocks.o: block/Blocks.h block/Blocks.cpp block/Block.h block/BlockAir.h
  117. g++ $(VERSION) -c block/Blocks.cpp -o $@
  118. BlockAir.o: block/BlockAir.h block/BlockAir.cpp block/Block.h
  119. g++ $(VERSION) -c block/BlockAir.cpp -o $@
  120. # ------------------------------------------------------------------------------
  121. # World
  122. # ------------------------------------------------------------------------------
  123. Chunk.o: world/Chunk.h world/Chunk.cpp\
  124. block/Block.h block/Blocks.h
  125. g++ $(VERSION) -c world/Chunk.cpp -o $@
  126. World.o: world/World.h world/World.cpp\
  127. world/Chunk.h world/IChunkProvider.h world/IChunkListener.h data/UnsortedArrayList.h
  128. g++ $(VERSION) -c world/World.cpp -o $@
  129. # ------------------------------------------------------------------------------
  130. # Math
  131. # ------------------------------------------------------------------------------
  132. Matrix3D.o: math/Matrix3D.h math/Matrix3D.cpp
  133. g++ $(VERSION) -c math/Matrix3D.cpp -o $@
  134. Matrix3DStack.o: math/Matrix3DStack.h math/Matrix3DStack.cpp\
  135. math/Matrix3D.h math/StackOverflow.h math/StackUnderflow.h
  136. g++ $(VERSION) -c math/Matrix3DStack.cpp -o $@
  137. StackOverflow.o: math/StackOverflow.h math/StackOverflow.cpp
  138. g++ $(VERSION) -c math/StackOverflow.cpp -o $@
  139. StackUnderflow.o: math/StackUnderflow.h math/StackUnderflow.cpp
  140. g++ $(VERSION) -c math/StackUnderflow.cpp -o $@
  141. Vector3D.o: math/Vector3D.h math/Vector3D.cpp
  142. g++ $(VERSION) -c math/Vector3D.cpp -o $@
  143. Plane3D.o: math/Plane3D.h math/Plane3D.cpp\
  144. math/Vector3D.h
  145. g++ $(VERSION) -c math/Plane3D.cpp -o $@
  146. Camera3D.o: math/Camera3D.h math/Camera3D.cpp\
  147. math/Vector3D.h math/Matrix3D.h math/Plane3D.h math/Camera3D.h\
  148. engine/Wrapper.h engine/Utils.h
  149. g++ $(VERSION) -c math/Camera3D.cpp -o $@
  150. # ------------------------------------------------------------------------------
  151. # server
  152. # ------------------------------------------------------------------------------
  153. run_server: game_server
  154. ./game_server
  155. game_server: MainServer.cpp GameServer.o Stream.o Server.o
  156. g++ $(VERSION) -o $@ MainServer.cpp GameServer.o Stream.o Server.o -lpthread
  157. GameServer.o: server/GameServer.h server/GameServer.cpp network/server/Server.h
  158. g++ $(VERSION) -c server/GameServer.cpp -o $@
  159. # ------------------------------------------------------------------------------
  160. # network
  161. # ------------------------------------------------------------------------------
  162. Server.o: network/server/Server.h network/server/Server.cpp\
  163. network/server/IServerListener.h network/stream/Stream.h
  164. g++ $(VERSION) -c network/server/Server.cpp -o $@
  165. Stream.o: network/stream/Stream.h network/stream/Stream.cpp
  166. g++ $(VERSION) -c network/stream/Stream.cpp -o $@
  167. # ------------------------------------------------------------------------------
  168. # tests
  169. # ------------------------------------------------------------------------------
  170. run_tests: test
  171. ./test
  172. test: MainTest.cpp data/UnsortedArrayList.h data/HashMap.h
  173. g++ $(VERSION) -o $@ MainTest.cpp
  174. # ------------------------------------------------------------------------------
  175. # clean
  176. # ------------------------------------------------------------------------------
  177. clean:
  178. rm -f game_server game_client *.o test
  179. clean_o:
  180. rm -f *.o