On Mon, 2012-01-16 at 13:26 +0000, Tim Murphy wrote: > There might be some question about how the variable "$(FILE)" would > look if you tried to iterate over its contents. e.g. would one see an > iteration for each word and with "\n"s marking lines or is each line > an "atom" for want of a better word.
It would work the same way as if you had done: define FILE this is the first line this is the second line this is the third line endef $(foreach W,$(FILE),$(info $W)) In other words, every whitespace-separated token is a word. Newlines are just another form of whitespace, to make functions. There is no way to operate on "lines" in this model. I suppose, if this is something people really want, we could make the input mode fancier. For example, we could say that $(file < input) would read the entire "input" file and expand to its contents as I mentioned before. On the other hand $(file << input) would read a single line from the file "input"; every time it was invoked with the same filename it would read the next line from that file. This gets very complicated of course: how do you know when you're done? Just returning the empty string isn't good enough since you'd stop on the first blank line. Unless you preserved the newline, which is gross... basically you'd need to $(strip ...) every returned value before using it. Can you have multiple input files open at the same time, or will reading from a different filename automatically close the previous read? If you can have multiple input files open do you need a way to "abort" a read operation? Etc. Line-by-line reading is really problematic. I'm not sure I want to get into that. -- ------------------------------------------------------------------------------- Paul D. Smith <psm...@gnu.org> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make