2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 00:12:11 +00:00

Make response files work

[SVN r29401]
This commit is contained in:
Dave Abrahams
2005-06-03 12:00:35 +00:00
parent f1a98f8139
commit 44c5dff7eb
3 changed files with 49 additions and 41 deletions

View File

@@ -424,21 +424,22 @@ actions copy
# 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.
# TODO: now 'the-response-file' is just ignored. Need to remove
# the argument altother and adjust callers.
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) ] ;
# 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)
@@ -457,7 +458,7 @@ rule response-file ( targets + : sources * : the-response-file : properties * )
}
sources += $(xlibraries) ;
response-file-1 $(rsp) : $(sources[1]) ;
if $(sources[2-])
{

View File

@@ -42,12 +42,12 @@ generators.register-c-compiler como-win.compile.c : C : OBJ
generators.register-linker como-win.link
: OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
: EXE RSP
: EXE
: <toolset>como <toolset-como:platform>win ;
# Note that status of shared libraries support is not clear, so we don't
# define the link.dll generator.
generators.register-archiver como-winc.archive
: OBJ : STATIC_LIB RSP
: OBJ : STATIC_LIB
: <toolset>como <toolset-como:platform>win ;
flags como-win C++FLAGS <exception-handling>off : --no_exceptions ;
@@ -92,9 +92,9 @@ rule link ( targets + : sources * : properties * )
}
# for como, we repeat all libraries so that dependencies are always resolved
actions link bind LIBRARIES
actions link bind LIBRARIES RSP
{
$(CONFIG_COMMAND) --no_version --no_prelink_verbose $(LINKFLAGS) -o "$(<[1]:S=)" @"$(<[2])" "$(LIBRARIES)" "$(FINDLIBS:S=.lib)"
$(CONFIG_COMMAND) --no_version --no_prelink_verbose $(LINKFLAGS) -o "$(<[1]:S=)" @"$(RSP:W)" "$(LIBRARIES)" "$(FINDLIBS:S=.lib)" && del "$(RSP)"
}
actions compile.c
@@ -114,9 +114,9 @@ rule archive ( targets + : sources * : properties * )
common.response-file $(targets) : $(sources) : $(targets[2]) : $(properties) ;
}
actions updated together piecemeal archive
actions updated together piecemeal archive bind RSP
{
$(CONFIG_COMMAND) --no_version --no_prelink_verbose --prelink_object @"$(>)"
lib $(ARFLAGS) /nologo /out:"$(<:S=.lib)" @"$(>)"
$(CONFIG_COMMAND) --no_version --no_prelink_verbose --prelink_object @"$(RSP:W)"
lib $(ARFLAGS) /nologo /out:"$(<:S=.lib)" @"$(RSP:W)" && del "$(RSP)"
}

View File

@@ -227,12 +227,12 @@ rule default-paths ( version ? )
# 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-archiver msvc.archive : OBJ : STATIC_LIB RSP : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c++ : CPP : OBJ RSP(%_cpp) : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c : C : OBJ RSP(%_cpp) : <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 : <toolset>msvc ;
generators.register-c-compiler msvc.compile.c++ : CPP : OBJ : <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 ;
@@ -246,7 +246,15 @@ flags msvc.compile CFLAGS <optimization>off : /Od ;
flags msvc.compile CFLAGS <inlining>off : /Ob0 ;
flags msvc.compile CFLAGS <inlining>on : /Ob1 ;
flags msvc.compile CFLAGS <inlining>full : /Ob2 ;
flags msvc.compile CFLAGS <exception-handling>on : /EHsc ;
feature.feature asynch-exceptions : off on : propagated ;
feature.feature extern-c-nothrow : off on : propagated ;
flags msvc.compile CFLAGS <base-target-type>CPP/<exception-handling>on/<asynch-exceptions>off : /EHs ;
flags msvc.compile CFLAGS <base-target-type>CPP/<exception-handling>on/<asynch-exceptions>on : /EHa ;
flags msvc.compile CFLAGS <base-target-type>CPP/<exception-handling>on/<extern-c-nothrow>off : /EHc- ;
flags msvc.compile CFLAGS <base-target-type>CPP/<exception-handling>on/<extern-c-nothrow>on : /EHc ;
flags msvc.compile CFLAGS <rtti>on : /GR ;
flags msvc.compile CFLAGS <runtime-debugging>off/<link-runtime>shared : /MD ;
flags msvc.compile CFLAGS <runtime-debugging>on/<link-runtime>shared : /MDd ;
@@ -255,7 +263,6 @@ flags msvc.compile CFLAGS <runtime-debugging>off/<link-runtime>static/<threading
flags msvc.compile CFLAGS <runtime-debugging>on/<link-runtime>static/<threading>single : /MLd ;
flags msvc.compile CFLAGS <runtime-debugging>off/<link-runtime>static/<threading>multi : /MT ;
flags msvc.compile CFLAGS <runtime-debugging>on/<link-runtime>static/<threading>multi : /MTd ;
flags msvc.compile CFLAGS <base-target-type>CPP : /EHsc ;
flags msvc.compile USER_CFLAGS <cflags> : ;
flags msvc.compile.c++ USER_CFLAGS <cxxflags> : ;
@@ -267,13 +274,13 @@ flags msvc.compile UNDEFS <undef> ;
flags msvc.compile INCLUDES <include> ;
# 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++
actions compile.c++ bind RSP
{
$(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"$(<[2]:W)" -c -Fo"$(<[1]:W)"
$(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) @"$(RSP:W)" -c -Fo"$(<[1]:W)"
}
actions compile.rc
@@ -331,18 +338,18 @@ if [ os.name ] in NT
{
# 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,20 +359,20 @@ else
# 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)"
$(MANIFEST)$(<[1]).manifest $(OUTPUTRESOURCE)$(<[1]);#2
}
rule compile.c++ ( targets + : sources * : properties * )
{
common.response-file $(targets) : $(sources) : $(targets[2]) : $(properties) ;
common.response-file $(targets) : $(sources) : $(response-file) : $(properties) ;
}
rule compile.c ( targets + : sources * : properties * )