Skip to content

Instantly share code, notes, and snippets.

@o11c
Created August 13, 2014 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save o11c/fd668e544a15b941ea0d to your computer and use it in GitHub Desktop.
Save o11c/fd668e544a15b941ea0d to your computer and use it in GitHub Desktop.
total makefile forwarding done right (probably)
.DEFAULT_GOAL := all
.PHONY: ${MAKECMDGOALS}
$(filter-out all,${MAKECMDGOALS}) all: .forward-all ;
.forward-all:
${MAKE} -C build ${MAKECMDGOALS}
${MAKEFILE_LIST}: ;
.SUFFIXES:
@cjxgm
Copy link

cjxgm commented Mar 11, 2015

When I call

$ make foo bar baz

foo, bar and baz are all forwarded successfully but it will also output:

make: Nothing to be done for 'bar'.
make: Nothing to be done for 'baz'.

but no such output for foo
Any idea?

@cjxgm
Copy link

cjxgm commented Mar 11, 2015

Ok, I figured it out, this did the trick:

$(filter-out all,${MAKECMDGOALS}) all: .forward-all
    @# no-op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment