help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

global .EXTRA_PREREQS not quite right...


From: Britton Kerin
Subject: global .EXTRA_PREREQS not quite right...
Date: Sun, 13 Jun 2021 12:57:10 -0800

As it is it easily creates a bunch of circular dependencies that
require the user to manually specify target-local .EXTRA_PREREQS for a
bunch of targets to avoid.

For example:

.PHONY: dependency_checks
dependency_checks: avrdude_version_check \
                                   avrgcc_version_check   \
                                   avrlibc_version_check

.PHONY: avrdude_version_check
avrdude_version_check:
        # check avrdude version

.PHONY: avrgcc_version_check
avrgcc_version_check:
        # check avr gcc version

.PHONY: avrlibc_check
avrlibc_check:
        # check avr libc version

.EXTRA_PREREQS = dependency_checks

Ends up creating circular dependencies.  It can be expressed with a
variable listing the individual checks of course but it seems
unnatural to require this, or avoided with target-local overrides of
.EXTRA_PREREQS but that gets painful fast and doesn't fix the general
problem.

The general problem is that Make is adding .EXTRA_PREREQS to prereqs
of targets in global .EXTRA_PREREQS, which is not what is wanted.

Adding links from every node in the DAG seems somewhat weird in
general.  This isn't what usually gets done when similar things are
being done manually: instead only the DAG roots get the dependency,
and everything triggers off those.

An .EXTRA_DAG_ROOTS_PREREQS by itself wouldn't quite do it either
though, since e.g. .c files wouldn't have associated recipes so
wouldn't trigger rebuilds.  It would also need to be possible to have
a touch $@ recipe automagically added for roots.  Or something.

Maybe a reasonable solution is obvious to somebody?

Britton



reply via email to

[Prev in Thread] Current Thread [Next in Thread]