Skip to content

Cannot specify multiple targets using a variable #82

@rulatir

Description

@rulatir

Specifying multiple targets for a rule doesn't work if the targets are specified via a variable. Multiple targets written directly in the rule work. A single target in a variable also works.

This will fail with "no theoretical build path to target1" (it works with GNU Make):

targets := target1 target2

all: target1 target2

$(targets): somesource
    recipe

.PHONY: all

This works:

all: target1 target2

target1 target2: somesource
    recipe

.PHONY: all

And surprisingly this also works:

targets := just-one-target

all: just-one-target

$(targets): somesource
    recipe

.PHONY: all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions