Using Makefiles in Python projects

David bouncingcats at gmail.com
Thu Nov 7 18:30:28 EST 2019


On Fri, 8 Nov 2019 at 09:43, Cameron Simpson <cs at cskk.id.au> wrote:

[...]

>     _help:
>             @echo '_build: make $(py_static_bundle)'
>             @echo '_deploy_tip: formally deploy the current tip to the dev host dev tree:'
>             @echo '_sync_dev: rsync the current working files into the dev tip tree'

[...]

> Things to note:
>
> "Virtual targets" are actions rather than result files, and start with
> an underscore.
>
> The default target is _help, which recites a description of the other
> targets.

Hi, as you might be aware, the above recipe will not be run if a file
named '_help' exists.

The Gnu make documentation term for what you call "virtual targets"
is "phony targets", and it discusses them here:
https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targets

I would add the line:
.PHONY: _help
And similar for all the other phony targets.

Doing this has other advantages as described in the linked docs.
In particular, it saves 'make' wasting time searching for built-in
implicit rules
that might build these never-built targets. 'make -d' will reveal this.


More information about the Python-list mailing list