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, as below.

The target word can be anything must be set up 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 set up 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

Alternatively, set the default like this, if all was not first.

.DEFAULT_GOAL := all

Multiple files

If you have two files for make commands, in the imported file becomes the first and its first target will be the default.

So either add a default to the second:

  • Makefile
      include release.mk
        
      default: install
        
      install:
      	# ...
    
  • release.mk
      default: install
        
      tag:
      	# ...
    

Or make sure the import is after the default:

  • Makefile
      default: install
        
      include release.mk
        
      install:
      	# ...
    
  • release.mk
      tag:
      	# ...