Skip to content

Instantly share code, notes, and snippets.

@sagar5258
Last active October 16, 2015 07:06
# Makefile without defining .DEFAULT_GOAL,
# Default goal is the target of the first rule.
# Query the default goal.
ifeq ($(.DEFAULT_GOAL),)
$(warning no default goal is set)
endif
.PHONY: foo
foo: ; @echo $@
$(warning default goal is $(.DEFAULT_GOAL))
.PHONY: bar
bar: ; @echo $@
$(warning default goal is $(.DEFAULT_GOAL))
#S@: Gives the name of the target of the rule.
#Command:
#make
#Output:
#Makefile:5: no default goal is set
#Makefile:9: default goal is foo
#foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment