Boost logo

Boost-Build :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-12-28 08:50:44


On 12/26/2006 07:20 AM, Larry Evans wrote:
> What's the best way to get jam to do the equivalent of the Makefile
> code:
> <--------
> WHICH=gcc
> #WHICH=icc
> COMPILER.gcc=g++
> COMPILER.icc=icc
> COMPILE.gcc=$(COMPILER.gcc) -c -Wall -ftemplate-depth-100 -O0 -fno-inline
> COMPILE.icc=$(COMPILER.icc) -c -xc++ -O0 -Ob0
> LINK.gcc = $(COMPILER.gcc)
> LINK.icc = $(COMPILER.icc)
> INCS= -I"../../.." -I"../../../../.."
> SRC=seq_to_identity_tuple
> #SRC=ctor_template_test
> BEGIN.cpp="//delimit_macro_test_code"
>
> $(SRC).$(WHICH).E.cpp: $(SRC).cpp
> $(COMPILE.$(WHICH)) $(INCS) $(SRC).cpp -E\
> -C |csplit/$(BEGIN.cpp)/ {*}
> cat xx01|indent -bap - |sed -e 's/} template/}\n\n template/g'>
> $(SRC).$(WHICH).E.cpp
> >----------
>
> The purpose is to just see what BOOST_PP macros are producing. The
> BEGIN.cpp value is placed in the .cpp file just above the invokation
> of the BOOST_PP macro I'm interested in. For example:
[snip]
>
I was probably guilty of assuming everyone new what the above gnu
Makefile code does. With SRC as specified the target of the above
Makefile rule is:

src_to_identity_tuple.E.cpp:

The example code I provided was for when SRC=ctor instead of as
specified. The $(COMPILE.$(WHICH)) resolves to $(COMPILER.gcc)
which, of course, resolves to:

  $(COMPILER.gcc) -c -Wall ... $(SRC).cpp

which resolves to:

   g++ -c -Wall ... ctor.cpp

With the -E option, only the preprocessor is run. WIth the |csplit ...
the resulting output is split where BEGIN.cpp occurs in source code.
This avoids seeing all the preprocessor output before the output
of the preprocessor code I'm interested in debugging. All that
indent does is reformat the preprocessor output for easier reading.
I've forgottent what the sed part does, but I assume it just
adds an extra blank line to better delimit template declarations.

Hope that's clearer. Please let me know if any further
clarification is needed.

-regards,
Larry


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