VCVRack / rack-plugin-toolchain

53 stars 12 forks source link

Add MFLAGS to pass make options to Docker build. #3

Closed cschol closed 3 years ago

cschol commented 3 years ago

Adding MFLAGS allows passing "-j N" to the Docker build from the invoking command line.

AndrewBelt commented 3 years ago

Does $(MAKE) contain all makefile arguments? Try echo $(MAKE)

cschol commented 3 years ago

It does not contain the -j argument. $(MAKE) is already there and it didn't pass on the -j from the top-level.

Example w/o MFLAGS (current master):

docker run --rm --interactive --tty --volume=/home/cschol/src/library-v1/repos/FehlerFabrik-Suite/:/home/build/plugin-src --volume=/home/cschol/src/rack-plugin-toolchain/plugin-build:/home/build/rack-plugin-toolchain/plugin-build --env PLUGIN_DIR=/home/build/plugin-src rack-plugin-toolchain:1 /bin/bash -c "make plugin-build"

Example with MFLAGS:

docker run --rm --interactive --tty --volume=/home/cschol/src/library-v1/repos/FehlerFabrik-Suite/:/home/build/plugin-src --volume=/home/cschol/src/rack-plugin-toolchain/plugin-build:/home/build/rack-plugin-toolchain/plugin-build --env PLUGIN_DIR=/home/build/plugin-src rack-plugin-toolchain:1 /bin/bash -c "make plugin-build -j8 --jobserver-auth=3,4"
AndrewBelt commented 3 years ago

Ah, I see how this works. https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#Options_002fRecursion The make flags are passed to sub-makes via the MAKEFLAGS environment variable, not the MAKE variable. Obviously environment variables aren't passed to the Docker environment, so MFLAGS is needed.