automation

Makefile

Pass args to a command

The filter-out command removes the former arg from the latter args.

makefile example:

# allows passing args to make file
# see https://stackoverflow.com/a/47008498/3865083
# use below command to get the args:
# $(filter-out $@,$(MAKECMDGOALS))
%:
	@:
action:
	echo "$(filter-out $@,$(MAKECMDGOALS))"

Then those will behave the same :

make action foo bar baz
# OR
make foo bar action

Default goal

Add this:

.DEFAULT_GOAL := all

Phony

By default, make will skip tasks when the current folder contains action names. Phony deactivate this feature.

.PHONY: all

Instanciate variables

This way:

var := content

React ?

This page was last modified: