-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variables don't work in order-only dependency list #720
Comments
I guess a work-around would be to have a phony target gather the dependencies and then depend on the phony target, but this corner case should be documented, IMO. |
I ended up doing exactly that. In my case I have many targets that depend on many exported header files. Without this trick, the generator has to repeat the very long list over and over again. So much so, this actually produces a slowdown in ninja_syntax.py trying to word-wrap the lists, and makes the ninja file massive (workaround: have very long lines!) The manual says that variables are "shorter reusable names for strings" (i.e. not lists-of-strings), so I guess the behaviour isn't surprising. Perhaps we need arrays? That's a pretty big change though! |
Unfortunately the "use a phony target as an alias" doesn't quite work as you lose some transitivity:
You get the same problem if
I think the problem is that If you change the |
That's as to be expected I think. This issue specifically mentioned order-only dependencies for a reason (though I understand that the reasoning there was not readily specified). |
What about Perl-like array prefixes? Something like this: # "f 3.txt" has a space
@myfiles = f1.txt f2.txt f$ 3.txt
# Expands to f1.txt f2.txt "f 3.txt" f4.txt
@myfiles2 = $@myfiles f4.txt
# Expands to an empty string, as strings cannot contain arrays
# Strings and arrays may have the same name
# Alternative array reference syntax $@{array}
myfiles = $@{myfiles}
rule touch
command = touch $out
build $@myfiles: touch All uses of The inputs and outputs of a |
This fails to build: is this intended?
The text was updated successfully, but these errors were encountered: