Boost logo

Boost-Build :

From: Ilya Sokolov (fal_delivery_at_[hidden])
Date: 2006-06-10 08:26:00


hi!

Andrei Melnikov wrote:

> It's hard to review such large patches. I think it's better to
> separate it into several smaller patches. I think you should at least
> extract "minor non-functional code cleanups" into a separate patch. I
> think such cleanups are definitely improvements, and the subpatch
> should be applied immediately before the discussion of proposed
> <toolset>-cpp-pch framework can start.

ok, see latest patches. line endings in pch.jam are broken, so i sent my
version of this file instead of diffs.

> P.S. Due to some reason, the attachments have Content-disposition:
> inline, and gmail web interface (correctly) refuses to recognize them
> as attachments, so I couldn't save them.

sorry, i cant find any options in thunderburd to resolve this issue


# Copyright (c) 2005 Reece H. Dunn.
# Copyright (c) 2006 Ilya Sokolov
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)

##### Using Precompiled Headers (Quick Guide) #####
#
# Make precompiled mypch.hpp:
#
# import pch ;
# cpp-pch mypch
# : # sources
# [ cast _ pcheader : mypch.hpp ]
# : # requiremnts
# <toolset>msvc:<source>mypch.cpp
# ;
#
# Add cpp-pch to sources:
#
# exe hello
# : main.cpp hello.cpp
# : <pch>on:<source>mypch
# ;

import cast ;

toolsets-with-pch-support =
    msvc
    gcc
    dmc
  ;

#how to combine these rules?
rule msvc-cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    msvc-cpp-pch-t $(name)
        : $(sources)
        : $(requirements)
          <toolset>msvc # for alternative resolution
          <pch>on
        : $(default-build)
        : $(usage-requirements)
        ;

# how to do it?
# explicit $(name) ;
}
IMPORT $(__name__)
  : msvc-cpp-pch
  :
  : msvc-cpp-pch
  ;

rule msvc-c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    msvc-c-pch-t $(name)
        : $(sources)
        : $(requirements)
          <toolset>msvc # for alternative resolution
          <pch>on
        : $(default-build)
        : $(usage-requirements)
        ;

# how to do it?
# explicit $(name) ;
}
IMPORT $(__name__)
  : msvc-c-pch
  :
  : msvc-c-pch
  ;

rule gcc-cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    gcc-cpp-pch-t $(name)
        : $(sources)
        : $(requirements)
          <toolset>gcc # for alternative resolution
          <pch>on
        : $(default-build)
        : $(usage-requirements)
        ;

# how to do it?
# explicit $(name) ;
}
IMPORT $(__name__)
  : gcc-cpp-pch
  :
  : gcc-cpp-pch
  ;

rule gcc-c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    gcc-c-pch-t $(name)
        : $(sources)
        : $(requirements)
          <toolset>gcc # for alternative resolution
          <pch>on
        : $(default-build)
        : $(usage-requirements)
        ;

# how to do it?
# explicit $(name) ;
}
IMPORT $(__name__)
  : gcc-c-pch
  :
  : gcc-c-pch
  ;

rule dmc-cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    dmc-cpp-pch-t $(name)
        : $(sources)
        : $(requirements)
          <toolset>dmc # for alternative resolution
          <pch>on
        : $(default-build)
        : $(usage-requirements)
        ;

# how to do it?
# explicit $(name) ;
}
IMPORT $(__name__)
  : dmc-cpp-pch
  :
  : dmc-cpp-pch
  ;

rule dmc-c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    dmc-c-pch-t $(name)
        : $(sources)
        : $(requirements)
          <toolset>dmc # for alternative resolution
          <pch>on
        : $(default-build)
        : $(usage-requirements)
        ;

# how to do it?
# explicit $(name) ;
}
IMPORT $(__name__)
  : dmc-c-pch
  :
  : dmc-c-pch
  ;

rule cpp-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    for local toolset in $(toolsets-with-pch-support)
    {
        $(toolset)-cpp-pch $(name)
          : $(sources)
          : $(requirements)
          : $(default-build)
          : $(usage-requirements)
          ;
    }
}
IMPORT $(__name__)
  : cpp-pch
  :
  : cpp-pch
  ;

rule c-pch ( name : sources * : requirements * : default-build * : usage-requirements * )
{
    for local toolset in $(toolsets-with-pch-support)
    {
        $(toolset)-c-pch $(name)
          : $(sources)
          : $(requirements)
          : $(default-build)
          : $(usage-requirements)
          ;
    }
}
IMPORT $(__name__)
  : c-pch
  :
  : c-pch
  ;


# Copyright (c) 2005 Reece H. Dunn.
# Copyright (c) 2006 Ilya Sokolov
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)

import type ;
import feature ;
import generators ;

type.register PCHEADER : pcheader ;

feature.feature pch : # control precompiled header (PCH) generation
    on
    off
  ;

feature.feature pch-header : : free dependency ;
feature.feature precompiled : : free dependency ;

class pch-generator : generator
{
    rule action-class ( )
    {
        return compile-action ;
    }
}

cvs -q diff -u -d -- msvc.jam (in directory J:\w\boost\boost\tools\build\v2\tools)
Index: msvc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/msvc.jam,v
retrieving revision 1.81
diff -u -d -r1.81 msvc.jam
--- msvc.jam 17 May 2006 12:57:53 -0000 1.81
+++ msvc.jam 8 Jun 2006 09:00:39 -0000
@@ -1,6 +1,7 @@
 # Copyright (c) 2003 David Abrahams.
 # Copyright (c) 2005 Vladimir Prus.
 # Copyright (c) 2005 Alexey Pakhunov.
+# Copyright (c) 2006 Ilya Sokolov.
 #
 # Use, modification and distribution is subject to the Boost Software
 # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
@@ -20,7 +21,6 @@
 import rc ;
 import midl ;
 import mc ;
-import pch ;
+import pch_base
 
 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 {
@@ -508,7 +508,106 @@
 generators.register-standard msvc.compile.mc : MC : H RC : <toolset>msvc ;
 generators.override msvc.compile.mc : mc.compile ;
 
-generators.register [ new pch-generator msvc.compile.pch : PCHEADER : OBJ PCH : <toolset>msvc ] ;
+##### Using Precompiled Headers on MSVC (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# msvc-cpp-pch mypch
+# : # sources
+# [ cast _ pcheader : mypch.hpp ]
+# mypch.cpp
+# ;
+#
+# Add msvc-cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <toolset>msvc,<pch>on:<source>mypch
+# ;
+
+type.register MSVC_PCH_T : pch ;
+
+type.register MSVC_C_PCH_T : c_pch : MSVC_PCH_T ;
+type.register MSVC_CPP_PCH_T : cpp_pch : MSVC_PCH_T ;
+
+feature pch-source : : free dependency ; # mypch.cpp
+
+class msvc-pch-generator : pch-generator
+{
+ import property-set ;
+
+ rule run ( project name ? : property-set : source-1 source-2 )
+ {
+ # searching header and source file in the sources
+ local sources = $(source-1) $(source-2) ;
+ local pch-header ;
+ local pch-source ;
+ for local s in $(sources)
+ {
+ if [ type.is-derived [ $(s).type ] PCHEADER ]
+ {
+ pch-header = $(s) ;
+ }
+ else if
+ [ type.is-derived [ $(s).type ] CPP ]
+ || [ type.is-derived [ $(s).type ] C ]
+ {
+ pch-source = $(s) ;
+ }
+ }
+
+ if ! $(pch-header)
+ {
+ errors.user-error "can't build pch without pch-header" ;
+ }
+
+ if ! $(pch-source)
+ {
+ errors.user-error "can't build pch without pch-source" ;
+ }
+
+ local generated =
+ [
+ generator.run $(project) $(name)
+ : [
+ property-set.create
+ <pch-source>$(pch-source) # mypch.cpp
+ [ $(property-set).raw ]
+ ]
+ : $(sources)
+ ]
+ ;
+
+ local precompiled ;
+ for local g in $(generated)
+ {
+ if [ type.is-derived [ $(g).type ] MSVC_PCH_T ]
+ {
+ precompiled = $(g) ;
+ }
+ }
+
+ return
+ [
+ property-set.create
+ <pch-header>$(pch-header) # mypch.hpp
+ <precompiled>$(precompiled) # mypch.pch
+ ]
+ $(generated)
+ ;
+ }
+}
+
+generators.register [ new msvc-pch-generator msvc.compile.c.pch : PCHEADER : MSVC_C_PCH_T OBJ : <toolset>msvc ] ;
+generators.register [ new msvc-pch-generator msvc.compile.c++.pch : PCHEADER : MSVC_CPP_PCH_T OBJ : <toolset>msvc ] ;
+
+flags msvc.compile PRECOMPILED <pch>on : <precompiled> ;
+flags msvc.compile PCH_SOURCE <pch>on : <pch-source> ;
+flags msvc.compile PCH_HEADER <pch>on : <pch-header> ;
 
 #
 # Declare flags and action for compilation
@@ -560,44 +659,48 @@
 flags msvc.compile UNDEFS <undef> ;
 flags msvc.compile INCLUDES <include> ;
 
-flags msvc.compile PCH_SOURCE <pch-source> ;
-flags msvc.compile PCH_HEADER <pch>on : <pch-header> ;
-flags msvc.compile PCH_FILE <pch>on : <pch-file> ;
-
 rule compile.c ( targets + : sources * : properties * )
 {
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
     DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
- DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
 }
 
 rule compile.c++ ( targets + : sources * : properties * )
 {
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
     DEPENDS $(<) : [ on $(<) return $(PCH_HEADER) ] ;
- DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
 }
 
-rule compile.pch ( targets + : sources * : properties * )
+rule compile.c.pch ( targets + : sources * : properties * )
 {
     DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
 }
 
+rule compile.c++.pch ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PCH_SOURCE) ] ;
+}
 
 # The actions differ only by explicit selection of input language
-actions compile.c bind PCH_HEADER PCH_FILE
+actions compile.c bind PCH_HEADER PRECOMPILED
 {
- $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PCH_FILE:W)"
+ $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PRECOMPILED:W)"
 }
 
-actions compile.c++ bind PCH_HEADER PCH_FILE
+actions compile.c++ bind PCH_HEADER PRECOMPILED
 {
- $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PCH_FILE:W)"
+ $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" -Yu"$(PCH_HEADER:D=)" -Fp"$(PRECOMPILED:W)"
 }
 
-actions compile.pch bind PCH_SOURCE
+actions compile.c.pch bind PCH_SOURCE
 {
- $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[1]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[2]:W)"
+ $(.CC) /Zm800 -nologo -TC -U$(UNDEFS) $(CFLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[2]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[1]:W)" /Yl__bjam_pch_symbol
 }
 
+actions compile.c++.pch bind PCH_SOURCE
+{
+ $(.CC) /Zm800 -nologo -TP -U$(UNDEFS) $(CFLAGS) $(C++FLAGS) $(OPTIONS) @"@($(<[1]:W).rsp:E=$(nl)"$(PCH_SOURCE:W)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")" -c -Fo"$(<[2]:W)" /Yc"$(>[1]:D=)" -Fp"$(<[1]:W)" /Yl__bjam_pch_symbol
+}
 
 actions compile.rc
 {

cvs -q diff -u -d -- gcc.jam (in directory J:\w\boost\boost\tools\build\v2\tools)
Index: gcc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/gcc.jam,v
retrieving revision 1.76
diff -u -d -r1.76 gcc.jam
--- gcc.jam 24 May 2006 10:37:55 -0000 1.76
+++ gcc.jam 8 Jun 2006 09:29:22 -0000
@@ -1,6 +1,8 @@
 # Copyright (c) 2001 David Abrahams.
 # Copyright (c) 2002-2003 Rene Rivera.
 # Copyright (c) 2002-2003 Vladimir Prus.
+# Copyright (c) 2005 Reece H. Dunn.
+# Copyright (c) 2006 Ilya Sokolov.
 #
 # Use, modification and distribution is subject to the Boost Software
 # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
@@ -16,6 +18,7 @@
 import set ;
 import common ;
 import errors ;
+#import pch_base ;
 
 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
 {
@@ -144,6 +147,66 @@
 generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ;
 generators.register-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ;
 
+##### Using Precompiled Headers on GCC (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# gcc-cpp-pch mypch : [ cast _ pcheader : mypch.hpp ] ;
+# # NOTE: ^^^^^ names should be equal ^^^^^
+#
+# Add gcc-cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <toolset>gcc,<pch>on:<source>mypch
+# ;
+
+# real suffixes will be setled later
+type.register GCC_PCH_T : gch ;
+type.register GCC_C_PCH_T : c_gch : GCC_PCH_T ;
+type.register GCC_CPP_PCH_T : cpp_gch : GCC_PCH_T ;
+
+class gcc-pch-generator : pch-generator
+{
+ import project ;
+ import property-set ;
+
+ rule run ( project name ? : property-set : header )
+ {
+ local header-name = [ $(header).name ] ;
+ local header-basename = $(header-name:B) ;
+ if $(header-basename) != $(name)
+ {
+ local location = [ $(project).project-module ] ;
+ errors.user-error "in" $(location)": base name of header file `"$(header-name)"' should be the same as gcc-pch target name `"$(name)"'" ;
+ }
+
+ local header-suffix = [ MATCH "^(.)*" : $(header-name:S) ] ;
+ local pch-suffix = $(header-suffix).gch ;
+
+ type.change-generated-target-suffix GCC_C_PCH_T : <toolset>gcc : $(pch-suffix) ;
+ type.change-generated-target-suffix GCC_CPP_PCH_T : <toolset>gcc : $(pch-suffix) ;
+
+ local precompiled =
+ [
+ generator.run $(project) $(name)
+ : $(property-set)
+ : $(header)
+ ]
+ ;
+
+ return
+ [ property-set.create <precompiled>$(precompiled) ]
+ $(precompiled)
+ ;
+ }
+}
+
+generators.register [ new gcc-pch-generator gcc.compile.c.pch : PCHEADER : GCC_C_PCH_T : <toolset>gcc ] ;
+generators.register [ new gcc-pch-generator gcc.compile.c++.pch : PCHEADER : GCC_CPP_PCH_T : <toolset>gcc ] ;
+
+flags gcc.compile PRECOMPILED <pch>on : <precompiled> ;
 
 # Declare flags and action for compilation
 flags gcc.compile OPTIONS <optimization>off : -O0 ;
@@ -205,6 +273,16 @@
     {
         LANG on $(<) = "-x c++" ;
     }
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
 }
 
-
-actions compile.c++
+actions compile.c++ bind PRECOMPILED
 {
- "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-128 $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+ "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-128 $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PRECOMPILED:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
 }
 
 rule compile.c
@@ -231,14 +299,24 @@
     #{
         LANG on $(<) = "-x c" ;
     #}
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
 }
 
-
-actions compile.c
+actions compile.c bind PRECOMPILED
 {
- "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+ "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PRECOMPILED:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
 }
 
+actions compile.c++.pch
+{
+ "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+}
+
+actions compile.c.pch
+{
+ "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
+}
+
 rule compile.asm
 {
     LANG on $(<) = "-x assembler-with-cpp" ;

cvs -q diff -u -d -- dmc.jam (in directory J:\w\boost\boost\tools\build\v2\tools)
Index: dmc.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/dmc.jam,v
retrieving revision 1.6
diff -u -d -r1.6 dmc.jam
--- dmc.jam 24 Apr 2006 14:09:51 -0000 1.6
+++ dmc.jam 8 Jun 2006 13:14:16 -0000
@@ -3,6 +3,7 @@
 # (C) Copyright Christof Meerwald 2003.
 # (C) Copyright Aleksey Gurtovoy 2004.
 # (C) Copyright Arjan Knepper 2006.
+# (C) Copyright Ilya Sokolov 2006.
 #
 # Distributed under the Boost Software License, Version 1.0. (See
 # accompanying file LICENSE_1_0.txt or copy at
@@ -15,6 +16,9 @@
 import feature generators common ;
 import toolset : flags ;
 import sequence regex ;
+import "class" : new ;
+import type ;
+import pch_base ;
 
 feature.extend toolset : dmc ;
 
@@ -55,8 +59,77 @@
 generators.register-c-compiler dmc.compile.c++ : CPP : OBJ : <toolset>dmc ;
 generators.register-c-compiler dmc.compile.c : C : OBJ : <toolset>dmc ;
 
+##### Using Precompiled Headers on DMC (Quick Guide) #####
+#
+# Make precompiled mypch.hpp:
+#
+# import pch ;
+# dmc-cpp-pch mypch : [ cast _ pcheader : mypch.hpp ] ;
+# # NOTE: ^^^^^ names should be equal ^^^^^
+#
+# Add dmc-cpp-pch to sources:
+#
+# exe hello
+# : main.cpp hello.cpp
+# : <toolset>dmc,<pch>on:<source>mypch
+# ;
+
+type.register DMC_PCH_T : sym ;
+
+type.register DMC_C_PCH_T : c_sym : DMC_PCH_T ;
+type.register DMC_CPP_PCH_T : cpp_sym : DMC_PCH_T ;
+
+type.set-generated-target-suffix DMC_C_PCH_T : <toolset>dmc : sym ;
+type.set-generated-target-suffix DMC_CPP_PCH_T : <toolset>dmc : sym ;
+
+class dmc-pch-generator : pch-generator
+{
+ import project ;
+ import property-set ;
+
+ rule run ( project name ? : property-set : header )
+ {
+ local header-name = [ $(header).name ] ;
+ local header-basename = $(header-name:B) ;
+ if $(header-basename) != $(name)
+ {
+ local location = [ $(project).project-module ] ;
+ errors.user-error "in" $(location)": base name of header file `"$(header-name)"' should be the same as dmc-pch target name `"$(name)"'" ;
+ }
+
+ local generated =
+ [
+ generator.run $(project) $(name)
+ : $(property-set)
+ : $(header)
+ ]
+ ;
+
+ local precompiled ;
+ for local g in $(generated)
+ {
+ if [ type.is-derived [ $(g).type ] DMC_PCH_T ]
+ {
+ precompiled = $(g) ;
+ }
+ }
+
+ return
+ [ property-set.create <precompiled>$(precompiled) ]
+ $(generated)
+ ;
+ }
+}
+
+generators.register [ new dmc-pch-generator dmc.compile.c.pch : PCHEADER : DMC_C_PCH_T OBJ : <toolset>dmc ] ;
+generators.register [ new dmc-pch-generator dmc.compile.c++.pch : PCHEADER : DMC_CPP_PCH_T OBJ : <toolset>dmc ] ;
+
+flags dmc.compile PRECOMPILED <pch>on : <precompiled> ;
+flags dmc.compile.c PCH <pch>on : -H ;
+flags dmc.compile.c++ PCH <pch>on : -H ;
 
 # Declare flags
+
 # dmc optlink has some limitation on the amount of debug-info included. Therefore only linenumbers are enabled in debug builds.
 # flags dmc.compile OPTIONS <debug-symbols>on : -g ;
 flags dmc.compile OPTIONS <debug-symbols>on : -gl ;
@@ -68,6 +141,7 @@
 flags dmc.compile OPTIONS <optimization>space : -o+space ;
 flags dmc.compile OPTIONS <exception-handling>on : -Ae ;
 flags dmc.compile OPTIONS <rtti>on : -Ar ;
+flags dmc.compile OPTIONS <rtti>on/<pch>on : -HI"typeinfo.h" ;
 # FIXME:
 # Compiling sources to be linked into a shared lib (dll) the -WD cflag should be used
 # Compiling sources to be linked into a static lib (lib) or executable the -WA cflag should be used
@@ -97,38 +171,84 @@
 }
 
-actions compile.c
+actions compile.c bind PRECOMPILED
 {
- "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o"$(<)" "$(>)"
+ "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(PCH) -HD"$(PRECOMPILED:D)" -HH"$(PRECOMPILED:B)" -o"$(<)" "$(>)"
 }
 
-actions compile.c++
+actions compile.c++ bind PRECOMPILED
 {
- "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o"$(<)" "$(>)"
+ "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" $(PCH) -HD"$(PRECOMPILED:D)" -HH"$(PRECOMPILED:B)" -o"$(<)" "$(>)"
+}
+
+rule compile.c ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
+}
+
+rule compile.c++ ( targets + : sources * : properties * )
+{
+ DEPENDS $(<) : [ on $(<) return $(PRECOMPILED) ] ;
+}
+
+actions compile.c.pch
+{
+ "$(.root)dmc" -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -HD"$(<[1]:D)" -HF"$(<[1])" -o"$(<[2])" "$(>)"
+}
+
+actions compile.c++.pch
+{
+ "$(.root)dmc" -cpp -c -Ab $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -HD"$(<[1]:D)" -HF"$(<[1])" -o"$(<[2])" "$(>)"
 }
 


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