📝 Edit on GitHub
Default target
Setting the default command if no args are given to
make
When running make
without arguments, it will run the first command in the file.
help:
@echo 'Welcome!'
install:
@echo 'Installing deps...'
Running without an argument execute the first.
$ make
Welcome!
Traditionally, a Makefile will have an all
or default
command.
The target word can be anything must be setup first in the file in order to be the default when running without arguments.
default: install
help:
@echo 'Welcome!'
install:
@echo 'Installing deps...'
Running without an argument execute the first - here, the default
option.
$ make
Installing deps...
The GNU docs recommend all
but the default
makes more sense to me. The all
can be useful if there are many steps to run while default
I would setup as one command.
default: install
all: install build test
Alternatively use .DEFAULT_GOAL
e.g.
.DEFAULT_GOAL = build
dev: deps serve
build: deps site
See the docs