Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-05-25 07:51:38


On Tuesday 24 May 2005 21:00, David Abrahams wrote:
> Every time I build the Boost.Python tests, it recompiles all the
> source files, despite having been successful already. I'm pretty sure
> this has something to do with the tricky fake response file target in
> common.response-file. Why is that needed anyway? The explanation
> there doesn't make any sense. The response file need only contain the
> names of the sources, and a dependency of the targets on the response
> file should be enough to ensure the response file gets built before
> any of the targets do.

I am pretty sure the rebuild happens because:
1. The compile action deletes the RSP file.
2. The rsp target is not marked as TEMPORARY.

Using the attached patch, I don't get any problems:
- building example/hello works fine (on windows)
- rebuilding does nothing, as expected

Can you try it?

- Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 --Boundary-00=_aTHlCYbCUL8x5u5 Content-Type: text/x-diff;
charset="iso-8859-1";
name="RSP2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="RSP2.diff"
Index: common.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/common.jam,v
retrieving revision 1.36
diff -u -r1.36 common.jam
--- common.jam	24 May 2005 15:27:30 -0000	1.36
+++ common.jam	25 May 2005 12:50:36 -0000
@@ -424,21 +424,22 @@
# Cause creation of response file, containing the sources in 'sources'
# All the targets in 'targets' will depend on response file, and response
# file will be created before the targets are built.
-rule response-file ( targets + : sources * : the-response-file : properties * )
+rule response-file ( targets + : sources * : the-response-file ? : properties * )
{
- # Manufacture a fake target for response file.
- # If response file is in targets, we're in trouble.
- # The actions for response file are already generated, and bjam thinks it's 
- # created. So setting dependency on response file will not help to create
- # it before other targets. So, we need another target.
- 
- local g = [ utility.ungrist $(the-response-file:G) ] ;
- local rsp = $(the-response-file:G=$(g)-rsp) ;
- LOCATE on $(rsp) = [ on $(the-response-file) return $(LOCATE) ] ; 
+ # TODO: now 'the-response-file' is just ignored. Need to remove
+ # the argument altother and adjust callers.
+ 
+ # Create a target for response file. Not that we add 'rsp' to the target
+ # name (without stripping suffix), so that response file names for c.exe
+ # and c.obj are different.
+ local rsp = $(targets[1]).rsp ;
+ RSP on $(targets) = $(rsp) ;
+ LOCATE on $(rsp) = [ on $(targets[1]) return $(LOCATE) ] ;
DEPENDS $(targets) : $(rsp) ;
- # Cause RSP to be recreated if sources are out-of-date.
- DEPENDS $(rsp) : $(sources) ;
- 
+ # Note: we don't need dependecy from response file on sources
+ # because response file only needs the names of the sources.
+ TEMPORARY $(rsp) ;
+ 
# Add libraries from <library> property to the list of sources.
local libraries ;
for local p in $(properties)
Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.37
diff -u -r1.37 msvc.jam
--- msvc.jam	25 May 2005 05:55:10 -0000	1.37
+++ msvc.jam	25 May 2005 12:50:36 -0000
@@ -225,12 +225,12 @@
# is it possible to combine these?
# make the generators non-composing, so that they don't convert each source
# into separate rsp file.
-generators.register-linker msvc.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE RSP : <toolset>msvc ;
-generators.register-linker msvc.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB RSP : <toolset>msvc ;
+generators.register-linker msvc.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>msvc ;
+generators.register-linker msvc.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>msvc ;
-generators.register-archiver msvc.archive : OBJ : STATIC_LIB RSP : <toolset>msvc ;
+generators.register-archiver msvc.archive : OBJ : STATIC_LIB : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c++ : CPP : OBJ : <toolset>msvc ;
-generators.register-c-compiler msvc.compile.c : C : OBJ RSP(%_cpp) : <toolset>msvc ;
+generators.register-c-compiler msvc.compile.c : C : OBJ : <toolset>msvc ;
generators.register-standard msvc.compile.rc : RC : OBJ(%_res) : <toolset>msvc ;
generators.override msvc.compile.rc : rc.resource-compile ;
@@ -267,9 +267,9 @@
flags msvc WHATEVER <toolset-msvc:version> ;
# The actions differ only by explicit selection of input language
-actions compile.c
+actions compile.c bind RSP
{
- $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"$(<[2]:W)" -c -Fo"$(<[1]:W)"
+ $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"$(RSP:W)" -c -Fo"$(<[1]:W)" && del "$(RSP)"
}
actions compile.c++ bind RSP
{
@@ -331,18 +331,18 @@
{ 
# The 'DEL' command would issue a message to stdout
# if the file does not exist, so need a check.
- actions archive 
+ actions archive bind RSP
{ 
if exist "$(<[1])" DEL "$(<[1])" 
- $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(<[2])"
+ $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(RSP)" && del "$(RSP)"
}
}
else
{
- actions archive 
+ actions archive bind RSP
{ 
$(RM) "$(<[1])"
- $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(<[2])"
+ $(.LD) /lib /NOLOGO /out:"$(<[1])" @"$(RSP)" && del "$(RSP)"
}
}
@@ -352,21 +352,22 @@
# rebuilt every time. I'm not sure that incremental linking is
# such a great idea in general, but in this case I'm sure we
# don't want it.
-actions link bind DEF_FILE
+actions link bind DEF_FILE RSP
{
- $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"$(<[2]:W)"
+ $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /LIBPATH:"$(LINKPATH:W)" $(USER_LINKFLAGS) @"$(RSP:W)" && del "$(RSP)"
}
-actions link.dll bind DEF_FILE
+actions link.dll bind DEF_FILE RSP
{
- $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(USER_LINKFLAGS) @"$(<[3]:W)"
+ $(.LD) /NOLOGO $(LINKFLAGS) /out:"$(<[1]:W)" /INCREMENTAL:NO /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:$(DEF_FILE) $(USER_LINKFLAGS) @"$(RSP:W)" && del "$(RSP)"
}
rule compile.c++ ( targets + : sources * : properties * )
{
- local response-file = $(targets[1]).rsp ;
- RSP on $(targets) = $(response-file) ;
- LOCATE on $(response-file) = [ on $(targets[1]) return $(LOCATE) ] ;
+# local response-file = $(targets[1]).rsp ;
+# RSP on $(targets) = $(response-file) ;
+# LOCATE on $(response-file) = [ on $(targets[1]) return $(LOCATE) ] ;
+# TEMPORARY $(response-file) ;
common.response-file $(targets) : $(sources) : $(response-file) : $(properties) ;
}
 --Boundary-00=_aTHlCYbCUL8x5u5-- 

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