Reputation: 5728
Can I create a makefile which will behave as if some options were passed to make
executable?
Upvotes: 4
Views: 2492
Reputation: 25523
Generally speaking, you can't. But in practice you can rerun your make session with proper options as follows:
ifndef __mk_ready
MAKEFLAGS += --jobs=10
MAKEFLAGS += --no-print-directory
.DEFAULT_GOAL := all
% :
@$(MAKE) __mk_ready=1 $@
else
# ...
endif # __mk_ready
Upvotes: 3
Reputation: 5159
As far as I know it's not possible to modify e.g. the -j
value or add the behaviour of -d
run-time in a Makefile. However, one nice workaround is adding a target like this:
debug: make -d debugtarget
Now make debug
works just like make -d debugtarget
. You can even make "debug" your default target and get the same effect with just make
.
Upvotes: 3