Skip to main content
1 of 3

In addition to all the things that @J_H has mentioned: the first target of a Makefile is its default target, i.e. the one that gets built if you just say make on the command line. Therefore, I always structure my Makefiles like this:

# Copyright blabla and other legal blurbs.

default: all

all: distrib run

# ...

Rationale: It makes the default target explicit and prevents you from accidentally changing it by placing another rule above it.

I also think that it is more common to have just one .PHONY instruction in a Makefile:

.PHONY: all clean run \
    distrib .force_rebuild

I have also re-ordered the phony targets to what I am used to.

But there is nothing wrong with your version. Keep it, if you prefer it.

The .PHONY also tends to appear at the end of the Makefile, after the targets, not at the beginning.