Makefile 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. # Top-level Kohi makefile
  2. # Run make setup to setup the build environment. This needs to be done once, unless a repo update calls for it.
  3. # Run make build-debug to build debug versions of kohi, its test libraries, its plugins, and the testbed project.
  4. # Run make build-release to build debug versions of kohi, its test libraries, its plugins, and the testbed project.
  5. # Run make all-debug to build everything in debug mode. This doesn't usually need to be done, build-debug is typically enough after the first build.
  6. # Run make all-release to build everything in release mode. This doesn't usually need to be done, build-debug is typically enough after the first build.
  7. # Run make clean To clean everything. This should especially be done if changing from debug->release or vice versa.
  8. #
  9. # To build just a portion of things, you can target certain things to be built:
  10. # kohi-debug: builds just utils, Core and Runtime.
  11. # kohi-tests-debug: Build core and runtime tests (with core and runtime if needed)
  12. # kohi-plugins-debug: Rebuilds all plugins, plus Kohi core/runtime if needed. Tests are skipped.
  13. # testbed-debug: Builds testbed, plus kohi and plugins if needed. Tests are skipped.
  14. #
  15. UNAME_S :=
  16. ifneq ($(OS),Windows_NT)
  17. UNAME_S = $(shell uname -s)
  18. endif
  19. ifeq ($(OS),Windows_NT)
  20. PLATFORM := win32
  21. else ifeq ($(UNAME_S),Linux)
  22. PLATFORM := linux
  23. else ifeq ($(UNAME_S),Darwin)
  24. PLATFORM := macos
  25. else
  26. $(error Unsupported platform)
  27. endif
  28. .PHONY: all-debug all-release clean scaffold scaffold-win32 scaffold-linux scaffold-macos kohi-tools-debug copy-top-level copy-top-level-win32 copy-top-level-linux copy-top-level-macos tools-clean clean-top-level clean-top-level-win32 clean-top-level-linux clean-top-level-macos
  29. .PHONY: utils-debug core-debug core-tests-debug runtime-debug runtime-tests-debug plugin-audio-openal-debug plugin-renderer-vulkan-debug plugin-renderer-ui-kui-debug plugin-renderer-utils-debug tools-debug testbed-klib-debug testbed-kapp-debug
  30. .PHONY: kohi-debug kohi-tests-debug kohi-plugins-debug testbed-debug
  31. .PHONY: utils-release core-release core-tests-release runtime-release runtime-tests-release plugin-audio-openal-release plugin-renderer-vulkan-release plugin-renderer-ui-kui-release plugin-renderer-utils-release tools-release testbed-klib-release testbed-kapp-release
  32. .PHONY: kohi-release kohi-tests-release kohi-plugins-release testbed-release
  33. .PHONY: utils-clean core-clean core-tests-clean runtime-clean runtime-tests-clean plugin-audio-openal-clean plugin-renderer-vulkan-clean plugin-renderer-ui-kui-clean plugin-renderer-utils-clean tools-clean testbed-klib-clean testbed-kapp-clean
  34. .PHONY: kohi-clean kohi-tests-clean kohi-plugins-clean testbed-clean
  35. .PHONY: setup build-debug build-release
  36. # Setup: This really just needs to be done once to setup the environment, etc. Unless repo updates demand it.
  37. setup: scaffold utils-debug copy-utils
  38. # Scaffold folder structure needed for top-level operations.
  39. scaffold: scaffold-$(PLATFORM)
  40. .NOTPARALLEL: scaffold
  41. scaffold-win32:
  42. @if not exist bin mkdir bin
  43. @if not exist misc mkdir misc
  44. scaffold-linux scaffold-macos:
  45. @mkdir -p bin
  46. @mkdir -p misc
  47. copy-utils: copy-utils-$(PLATFORM)
  48. copy-utils-win32:
  49. copy utils\bin\* misc
  50. copy-utils-linux copy-utils-macos:
  51. cp utils/bin/* misc
  52. copy-top-level: copy-top-level-$(PLATFORM)
  53. .NOTPARALLEL: copy-top-level
  54. copy-top-level-win32: copy-utils
  55. copy kohi.core\bin\* bin
  56. copy kohi.core.tests\bin\* bin
  57. copy kohi.runtime\bin\* bin
  58. copy kohi.runtime.tests\bin\* bin
  59. copy kohi.plugin.audio.openal\bin\* bin
  60. copy kohi.plugin.renderer.vulkan\bin\* bin
  61. copy kohi.plugin.ui.kui\bin\* bin
  62. copy kohi.plugin.utils\bin\* bin
  63. copy kohi.tools\bin\* bin
  64. copy testbed.klib\bin\* bin
  65. copy testbed.kapp\bin\* bin
  66. copy "$(ASSIMP)\bin\x64\*assimp*.dll" bin
  67. copy-top-level-linux copy-top-level-macos: copy-utils
  68. cp kohi.core/bin/* bin
  69. cp kohi.core.tests/bin/* bin
  70. cp kohi.runtime/bin/* bin
  71. cp kohi.runtime.tests/bin/* bin
  72. cp kohi.plugin.audio.openal/bin/* bin
  73. cp kohi.plugin.renderer.vulkan/bin/* bin
  74. cp kohi.plugin.ui.kui/bin/* bin
  75. cp kohi.plugin.utils/bin/* bin
  76. cp kohi.tools/bin/* bin
  77. cp testbed.klib/bin/* bin
  78. cp testbed.kapp/bin/* bin
  79. # Debug builds
  80. all-debug: setup kohi-debug kohi-tests-debug kohi-plugins-debug kohi-tools-debug testbed-debug copy-top-level
  81. build-debug: kohi-debug kohi-tests-debug kohi-plugins-debug kohi-tools-debug testbed-debug copy-top-level
  82. kohi-debug: core-debug runtime-debug
  83. kohi-tests-debug: kohi-debug core-tests-debug runtime-tests-debug
  84. kohi-plugins-debug: kohi-debug plugin-audio-openal-debug plugin-renderer-vulkan-debug plugin-renderer-ui-kui-debug plugin-renderer-utils-debug
  85. testbed-debug: kohi-debug kohi-plugins-debug testbed-klib-debug testbed-kapp-debug
  86. utils-debug:
  87. $(MAKE) -C utils all-debug
  88. core-debug:
  89. $(MAKE) -C kohi.core all-debug
  90. core-tests-debug:
  91. $(MAKE) -C kohi.core.tests all-debug
  92. runtime-debug:
  93. $(MAKE) -C kohi.runtime all-debug
  94. runtime-tests-debug:
  95. $(MAKE) -C kohi.runtime.tests all-debug
  96. plugin-audio-openal-debug:
  97. $(MAKE) -C kohi.plugin.audio.openal all-debug
  98. plugin-renderer-vulkan-debug:
  99. $(MAKE) -C kohi.plugin.renderer.vulkan all-debug
  100. plugin-renderer-ui-kui-debug:
  101. $(MAKE) -C kohi.plugin.ui.kui all-debug
  102. plugin-renderer-utils-debug:
  103. $(MAKE) -C kohi.plugin.utils all-debug
  104. kohi-tools-debug:
  105. $(MAKE) -C kohi.tools all-debug
  106. testbed-klib-debug:
  107. $(MAKE) -C testbed.klib all-debug
  108. testbed-kapp-debug:
  109. $(MAKE) -C testbed.kapp all-debug
  110. # Release builds
  111. all-release: setup kohi-release kohi-tests-release kohi-plugins-release kohi-tools-release testbed-release copy-top-level
  112. build-release: kohi-release kohi-tests-release kohi-plugins-release kohi-tools-release testbed-release copy-top-level
  113. kohi-release: core-release runtime-release
  114. kohi-tests-release: kohi-release core-tests-release runtime-tests-release
  115. kohi-plugins-release: kohi-release plugin-audio-openal-release plugin-renderer-vulkan-release plugin-renderer-ui-kui-release plugin-renderer-utils-release
  116. testbed-release: kohi-release kohi-plugins-release testbed-klib-release testbed-kapp-release
  117. utils-release:
  118. $(MAKE) -C utils all-release
  119. core-release:
  120. $(MAKE) -C kohi.core all-release
  121. core-tests-release:
  122. $(MAKE) -C kohi.core.tests all-release
  123. runtime-release:
  124. $(MAKE) -C kohi.runtime all-release
  125. runtime-tests-release:
  126. $(MAKE) -C kohi.runtime.tests all-release
  127. plugin-audio-openal-release:
  128. $(MAKE) -C kohi.plugin.audio.openal all-release
  129. plugin-renderer-vulkan-release:
  130. $(MAKE) -C kohi.plugin.renderer.vulkan all-release
  131. plugin-renderer-ui-kui-release:
  132. $(MAKE) -C kohi.plugin.ui.kui all-release
  133. plugin-renderer-utils-release:
  134. $(MAKE) -C kohi.plugin.utils all-release
  135. kohi-tools-release:
  136. $(MAKE) -C kohi.tools all-release
  137. plugin-testbed-klib-release:
  138. $(MAKE) -C testbed.klib all-release
  139. plugin-testbed-kapp-release:
  140. $(MAKE) -C testbed.kapp all-release
  141. # Clean "builds"
  142. clean: utils-clean kohi-clean kohi-tests-clean kohi-plugins-clean tools-clean testbed-clean clean-top-level
  143. kohi-clean: utils-clean core-clean runtime-clean clean-top-level
  144. kohi-tests-clean: core-tests-clean runtime-tests-clean clean-top-level
  145. kohi-plugins-clean: utils-clean kohi-clean plugin-audio-openal-clean plugin-renderer-vulkan-clean plugin-renderer-ui-kui-clean plugin-renderer-utils-clean clean-top-level
  146. testbed-clean: utils-clean testbed-klib-clean testbed-kapp-clean clean-top-level
  147. clean-top-level: clean-top-level-$(PLATFORM)
  148. .NOTPARALLEL: clean-top-level
  149. clean-top-level-win32:
  150. if exist bin del /s /q bin\*.*
  151. if exist obj del /s /q obj\*.*
  152. clean-top-level-linux clean-top-level-macos:
  153. rm -rf bin/*
  154. utils-clean:
  155. $(MAKE) -C utils clean
  156. core-clean:
  157. $(MAKE) -C kohi.core clean
  158. core-tests-clean:
  159. $(MAKE) -C kohi.core.tests clean
  160. runtime-clean:
  161. $(MAKE) -C kohi.runtime clean
  162. runtime-tests-clean:
  163. $(MAKE) -C kohi.runtime.tests clean
  164. plugin-audio-openal-clean:
  165. $(MAKE) -C kohi.plugin.audio.openal clean
  166. plugin-renderer-vulkan-clean:
  167. $(MAKE) -C kohi.plugin.renderer.vulkan clean
  168. plugin-renderer-ui-kui-clean:
  169. $(MAKE) -C kohi.plugin.ui.kui clean
  170. plugin-renderer-utils-clean:
  171. $(MAKE) -C kohi.plugin.utils clean
  172. tools-clean:
  173. $(MAKE) -C kohi.tools clean
  174. plugin-testbed-klib-clean:
  175. $(MAKE) -C testbed.klib clean
  176. plugin-testbed-kapp-clean:
  177. $(MAKE) -C testbed.kapp clean