stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Black <abl...@roguewave.com>
Subject Re: svn commit: r463535 - in /incubator/stdcxx/trunk: etc/config/makefile.common etc/config/makefile.rules util/cmdopt.cpp util/display.cpp util/output.cpp util/runall.cpp util/target.h
Date Wed, 18 Oct 2006 22:41:59 GMT
Martin Sebor wrote:
> Andrew Black wrote:
> 
> [...]
>> I believe the attached patch might be an option that doesn't rely on 
>> bash, though it has a slight inelegant feel to it.  In particular, the 
>> part reading '(echo $$cache > /dev/null)' is a hack to keep bash from 
>> losing the cache variable in the pipeline (perhaps 'export cache' 
>> should be used instead?).
> 
> I'm not sure I understand what this does. The pipe takes the
> stdout of the echo $cache >/dev/null command, not that of the
> prior command. Doesn't that lose the output of the compiler?
> 
> Martin

In my (somewhat limited) testing, it does not.  What is happening is 
that the output of the list of commands is being sent through the 
pipeline, rather than the output of the last command executed, 
reflecting the bash documentation on pipelines.  It would be somewhat 
possible to clarify this behavior by adding {}s around the compile 
command and the output redirection sequence, but this would result in a 
minor rethink of how to define redirected commands.

The definition of the shell grammar rules can be found at
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_10

--Andrew Black

> 
>> I have tested this change on Linux, Solaris and HPUX, and it appears 
>> to behave correctly on all three.
>>
>> --Andrew Black
>>
>> Log:
>>     * makefile.common (TEEOPTS): Always tee output to $@.log, prevent 
>> setting of LOGFILE from breaking result capturing. (Reimplementation 
>> of rev 463535, reverted in rev 463850 due to loss of return code from 
>> compile/link commands)
>>     * makefile.rules (%.o: %(AS_EXT), %.o: %.cpp, %: %.o, %: %.cpp): 
>> Add $(TEEOPTS) to compile/link line so that output is routed to log 
>> files. (Reverts rev 463850, which reverted rev 463535)
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: etc/config/makefile.common
>> ===================================================================
>> --- etc/config/makefile.common    (revision 464511)
>> +++ etc/config/makefile.common    (working copy)
>> @@ -141,10 +141,13 @@
>>  # file to write log of the build to
>>  LOGFILE = /dev/null
>>  
>> -# if LOGFILE is being created, tee command output into it
>> +# if LOGFILE is not being created, tee command output into target.log
>> +# otherwise, tee command output into both target.log and LOGFILE.
>>  # IMPORTANT: $(TEEOPTS) must be last on the command line
>> -ifneq ($(LOGFILE),/dev/null)
>> -  TEEOPTS = 2>&1 | tee -a $(LOGFILE)
>> +ifeq ($(LOGFILE),/dev/null)
>> +  TEEOPTS = 2>&1 ; cache=$$?; (echo $$cache > /dev/null) | tee 
>> $@.log; (exit $$cache)
>> +else
>> +  TEEOPTS = 2>&1 ; cache=$$?; (echo $$cache > /dev/null) | tee $@.log

>> | tee -a $(LOGFILE); (exit $$cache)
>>  endif
>>  
>>  # determine the name of the results file against which to compute 
>> regressions
>> Index: etc/config/makefile.rules
>> ===================================================================
>> --- etc/config/makefile.rules    (revision 464511)
>> +++ etc/config/makefile.rules    (working copy)
>> @@ -60,16 +60,16 @@
>>      ifneq ($(AS_EXT),".")
>>  
>>  %.o: %$(AS_EXT)
>> -    $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
>> +    $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< $(TEEOPTS)
>>  
>>      endif   # ifneq ($(AS_EXT),".")
>>    endif   # ifneq ($(AS_EXT),)
>>  
>>  %.o: %.cpp
>> -    $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
>> +    $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< $(TEEOPTS)
>>  
>>  %: %.o
>> -    $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS)
>> +    $(LD) $< -o $@ $(LDFLAGS) $(LDLIBS) $(TEEOPTS)
>>  
>>  # disable compilation and linking in the same step
>>  # %: %.cpp
>> @@ -78,7 +78,7 @@
>>  
>>  # compile and link in one step to eliminate the space overhead of .o 
>> files
>>  %: %.cpp
>> -    $(CXX) $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS)
>> +    $(CXX) $< -o $@ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LDLIBS) 
>> $(TEEOPTS)
>>  
>>  endif   # eq ($(NO_DOT_O),)
>>  
>> Index: etc/config/src/libc_decl.sh
>> ===================================================================
>> --- etc/config/src/libc_decl.sh    (revision 464511)
>> +++ etc/config/src/libc_decl.sh    (working copy)
>> @@ -275,7 +275,7 @@
>>          continue
>>      fi
>>  
>> -    if [ "$hdr_base" == math ] ; then
>> +    if [ "$hdr_base" = "math" ] ; then
>>          lib=m
>>      else
>>          lib=c
> 

Mime
View raw message