Build: automatically detect ninja build system when running "make"
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 12 Aug 2019 13:20:31 +0000 (15:20 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 12 Aug 2019 13:24:23 +0000 (15:24 +0200)
So that you don't have to specify "make ninja" every time.

GNUmakefile

index 1ad7cc4fc2796f5d3d0187a9ea1877e1a6756b74..2cd2c1a74430f879f2892da1d6860cf8501630c0 100644 (file)
@@ -230,11 +230,15 @@ endif
 # -----------------------------------------------------------------------------
 # build tool
 
-ifneq "$(findstring ninja, $(MAKECMDGOALS))" ""
-       BUILD_COMMAND:=ninja
+ifeq "$(findstring ninja, $(MAKECMDGOALS))" ""
        BUILD_CMAKE_ARGS:=$(BUILD_CMAKE_ARGS) -G Ninja
+       BUILD_COMMAND:=ninja
 else
-       BUILD_COMMAND:=make -s
+       ifneq ("$(wildcard $(BUILD_DIR)/build.ninja)","")
+               BUILD_COMMAND:=ninja
+       else
+               BUILD_COMMAND:=make -s
+       endif
 endif
 
 # -----------------------------------------------------------------------------