Boost logo

Boost-Build :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-01-02 11:48:18


----- Original Message -----
From: "Craig McPheeters" <cmcpheeters_at_[hidden]>

> > What is "the space and newline expansion trick?"
> > If I can use it to get around the line length limitation, it would be
> > great. Currently I am resorting to response files, but that's not
> > universally applicable.
>
> It works when there are other ways to get arguments in to a command, such
> as response files. rc.exe doesn't allow them, so its harder to work with.
> The space/newline trick is in the archives, I should reply to an earlier
> message in the jamming mail list, I'm still sorta on holiday. The trick
> is:
>
> SPACE = " " ;
> NEWLINE = "
> ";
>
> and then in an action block, if you have a bunch of files you want linked
> for example:
>
> @echo off
> set tmpfile="$(<).tmp"
> if exist %tmpfile% $(RM) %tmpfile%
> $(TOUCH) %tmpfile%
> echo$(SPACE)$(>)>>%tmpfile%$(NEWLINE)
> ...
> $(LINK) ... @%tmpfile% ...
>
> That can create a really huge .bat file, but its ok, as each of the lines
is
> short. The echo line expands into one line for each $(>) file.

Looking at this nefarious technique again, I see that it has certain
advantages over what I've been doing. For one thing, in my scheme, if the
link fails the response file is never removed. If I've forgotten a library,
the response file is wrong and needs to be rebuilt, but according to the
dates, it appears to be up-to-date. The downside of your scheme is that it's
difficult to factor out the common logic for creating the response files
from my many toolset definitions, but I don't think that's serious enough to
avoid using it. In fact, I expect that it won't be an issue in an upcoming
revision of the build system.

A question: why the explicit $(TOUCH)? Won't the redirected echo update the
modification date? And why does the mod. date matter, anyway? The response
file never appears in the dependency graph.

-Dave

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk