Skip to content
Permalink
Browse files

samples/**/external_lib: invoke $(MAKE) instead of make

Recursive make should be invoked as $(MAKE) and not "make" for reasons
documented at
 https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html

$(MAKE) is what CMake puts in all the CMakeFiles/Makefile2 it generates,
it doesn't use "make" either.

Issue found thanks to the following warning:
 build.log:make[4]: warning: jobserver unavailable: using -j1.
                    Add '+' to parent make rule.

If CMake is invoked with -GNinja or other then fall back on "make" as
before and pray that it's available.

Fast reproduction with:
   make -j2 -C build clean mylib_project VERBOSE=1

Build directories have been compared before/after this change and
there's zero difference except the generated
mylib_project.dir/build.make file (and the warning above) when using
make.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information...
marc-hb authored and galak committed Jun 28, 2019
1 parent ba894d8 commit d8c5c9dcf12eda7e5edb86e3ce4971e750d0c7af
Showing with 8 additions and 1 deletion.
  1. +8 −1 samples/application_development/external_lib/CMakeLists.txt
@@ -34,14 +34,21 @@ set(mylib_build_dir ${CMAKE_CURRENT_BINARY_DIR}/mylib)
set(MYLIB_LIB_DIR ${mylib_build_dir}/lib)
set(MYLIB_INCLUDE_DIR ${mylib_src_dir}/include)

if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
# https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html
set(submake "$(MAKE)")
else() # Obviously no MAKEFLAGS. Let's hope a "make" can be found somewhere.
set(submake "make")
endif()

ExternalProject_Add(
mylib_project # Name for custom target
PREFIX ${mylib_build_dir} # Root dir for entire project
SOURCE_DIR ${mylib_src_dir}
BINARY_DIR ${mylib_src_dir} # This particular build system is invoked from the root
CONFIGURE_COMMAND "" # Skip configuring the project, e.g. with autoconf
BUILD_COMMAND
make
${submake}
PREFIX=${mylib_build_dir}
CC=${CMAKE_C_COMPILER}
AR=${CMAKE_AR}

0 comments on commit d8c5c9d

Please sign in to comment.
You can’t perform that action at this time.