The attached patch allows to ./configure --enable-monolithic-controllers
which will at compile time create a file 'lyxcontrollers.cpp' #including 
all controller .cpp files. This will then be compiled in one go
_without_ using precompiled headers (they slow the process down in this
case)

On my machine this brings a full build in src/frontend/controllers.
from 3:10 to 0:54 minutes. 

Time for ccache based re-build without change is down from 40 to 2.5(!)
seconds.

Even time for null build is down from 1.1 to 0.9 seconds.

Typical use would be to have such --enable-monolithic-* for
{core,mathed,insets,controllers,frontends,qt4,tex2lyx,client,boost}
implemented and 'switched on' for all the areas one is not currently
working on (or invert that logic at some point of time).

Andre'
Index: src/frontends/controllers/Makefile.am
===================================================================
--- src/frontends/controllers/Makefile.am       (revision 19626)
+++ src/frontends/controllers/Makefile.am       (working copy)
@@ -1,100 +1,117 @@
 include $(top_srcdir)/config/common.am
 
-EXTRA_DIST = pch.h BCView.tmpl
+EXTRA_DIST = BCView.tmpl
 
-BUILT_SOURCES = $(PCH_FILE)
+AM_CPPFLAGS += -I$(top_srcdir)/src $(BOOST_INCLUDES)
 
 pkglib_LTLIBRARIES = liblyxcontrollers.la
 
-AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src $(BOOST_INCLUDES)
-
-liblyxcontrollers_la_SOURCES= \
+SOURCEFILES = \
        Dialog.cpp \
-       Dialog.h \
        Kernel.cpp \
-       Kernel.h \
-       BCView.h \
        BCView.cpp \
        ButtonController.cpp \
+       ButtonPolicy.cpp \
+       ControlAboutlyx.cpp \
+       ControlBibtex.cpp \
+       ControlBox.cpp \
+       ControlBranch.cpp \
+       ControlCharacter.cpp \
+       ControlChanges.cpp \
+       ControlCitation.cpp \
+       ControlCommand.cpp \
+       ControlCommandBuffer.cpp \
+       ControlDocument.cpp \
+       ControlErrorList.cpp \
+       ControlERT.cpp \
+       ControlExternal.cpp \
+       ControlFloat.cpp \
+       ControlGraphics.cpp \
+       ControlInclude.cpp \
+       ControlListings.cpp \
+       ControlLog.cpp \
+       ControlViewSource.cpp \
+       ControlMath.cpp \
+       ControlNote.cpp \
+       ControlParagraph.cpp \
+       ControlPrefs.cpp \
+       ControlPrint.cpp \
+       ControlRef.cpp \
+       ControlSearch.cpp \
+       ControlSendto.cpp \
+       ControlShowFile.cpp \
+       ControlSpellchecker.cpp \
+       ControlTabular.cpp \
+       ControlTabularCreate.cpp \
+       ControlTexinfo.cpp \
+       ControlThesaurus.cpp \
+       ControlToc.cpp \
+       ControlVSpace.cpp \
+       ControlWrap.cpp \
+       frontend_helpers.cpp 
+
+HEADERFILES = \
+       Kernel.h \
        ButtonController.h \
-       ButtonPolicy.cpp \
        ButtonPolicy.h \
-       ControlAboutlyx.cpp \
        ControlAboutlyx.h \
-       ControlBibtex.cpp \
        ControlBibtex.h \
-       ControlBox.cpp \
        ControlBox.h \
-       ControlBranch.cpp \
        ControlBranch.h \
-       ControlCharacter.cpp \
        ControlCharacter.h \
-       ControlChanges.cpp \
        ControlChanges.h \
-       ControlCitation.cpp \
        ControlCitation.h \
-       ControlCommand.cpp \
        ControlCommand.h \
-       ControlCommandBuffer.cpp \
        ControlCommandBuffer.h \
-       ControlDocument.cpp \
        ControlDocument.h \
-       ControlErrorList.cpp \
        ControlErrorList.h \
-       ControlERT.cpp \
        ControlERT.h \
-       ControlExternal.cpp \
        ControlExternal.h \
-       ControlFloat.cpp \
        ControlFloat.h \
-       ControlGraphics.cpp \
        ControlGraphics.h \
-       ControlInclude.cpp \
        ControlListings.h \
-       ControlListings.cpp \
        ControlInclude.h \
-       ControlLog.cpp \
        ControlLog.h \
-       ControlViewSource.cpp \
        ControlViewSource.h \
-       ControlMath.cpp \
        ControlMath.h \
-       ControlNote.cpp \
        ControlNote.h \
-       ControlParagraph.cpp \
        ControlParagraph.h \
-       ControlPrefs.cpp \
        ControlPrefs.h \
-       ControlPrint.cpp \
        ControlPrint.h \
-       ControlRef.cpp \
        ControlRef.h \
-       ControlSearch.cpp \
        ControlSearch.h \
-       ControlSendto.cpp \
        ControlSendto.h \
-       ControlShowFile.cpp \
        ControlShowFile.h \
-       ControlSpellchecker.cpp \
        ControlSpellchecker.h \
-       ControlTabular.cpp \
        ControlTabular.h \
-       ControlTabularCreate.cpp \
        ControlTabularCreate.h \
-       ControlTexinfo.cpp \
        ControlTexinfo.h \
-       ControlThesaurus.cpp \
        ControlThesaurus.h \
-       ControlToc.cpp \
        ControlToc.h \
-       ControlVSpace.cpp \
        ControlVSpace.h \
-       ControlWrap.cpp \
        ControlWrap.h \
-       frontend_helpers.cpp \
        frontend_helpers.h
 
+if MONOLITHIC_CONTROLLERS
 
+lyxcontrollers.cpp:
+       echo -e '$(patsubst %,#include "%"\n,$(SOURCEFILES))' > $@
+
+BUILT_SOURCES = lyxcontrollers.cpp
+
+liblyxcontrollers_la_SOURCES = lyxcontrollers.cpp $(HEADERFILES) 
+
+else
+
+EXTRA_DIST += pch.h
+BUILT_SOURCES = $(PCH_FILE)
+AM_CPPFLAGS += $(PCH_FLAGS)
+
+liblyxcontrollers_la_SOURCES = $(SOURCEFILES) $(HEADERFILES)
+
+endif
+
+
 ################################# Tests ################################
 
 EXTRA_DIST += tests/test_biblio

Index: configure.ac
===================================================================
--- configure.ac        (revision 19635)
+++ configure.ac        (working copy)
@@ -412,6 +412,24 @@
   [enable_monolithic_boost=no])
 AM_CONDITIONAL(MONOLITHIC_BOOST, test $enable_monolithic_boost = yes)
 
+AC_ARG_ENABLE(monolithic-controllers,
+  AC_HELP_STRING([--enable-monolithic-controllers],
+               [Use monolithic controllers compilations]),,
+  [enable_monolithic_controllers=no])
+AM_CONDITIONAL(MONOLITHIC_CONTROLLERS, test $enable_monolithic_controllers = 
yes)
+
 AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
 AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
 AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])

Reply via email to