Skip to content

Variables not Expanded in Included Fragment #145

Description

@olivia-banks

Imagine a situation like the below:

.
├── foo.c
├── build
    └── build.ninja     # parent
└── support
    └── fragment.ninja  # child

Where the user invokes n2 in the build directory, which then:

# build/build.ninja

# Sets some variables
proj_root = ..

# Includes the fragment (child)
include ../support/fragment.ninja

Inside the fragment file, we might do something like:

# support/fragment.ninja

build foo.o: cc ${proj_root}/foo.c

However, if we do something like this, we get an error like:

n2: error: ../support/fragment.ninja: input /foo.c missing

This is not a failure that happens on ninja or samu.


olivia@exbop build % for impl in ninja samu n2; do
        rm -f foo.o
        echo $impl; $impl
done
ninja
ninja: warning: build log version is too old; starting over
[1/1] cc -c -o foo.o ../foo.c
samu
[1/1] cc -c -o foo.o ../foo.c
n2
n2: error: ../support/fragment.ninja:6: input /foo.c missing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions