]> git.lyx.org Git - lyx.git/blobdiff - src/Makefile.am
Rename LATEX debug level to OUTFILE and use it for DocBook, HTML, and XML messages.
[lyx.git] / src / Makefile.am
index bca7c70471303b9e0e464e2af441b7985f0bc8b6..99a0f98ceb16895bb81e23a84b78bf27198a7ddc 100644 (file)
@@ -2,71 +2,94 @@ include $(top_srcdir)/config/common.am
 
 ############################### Core  ##############################
 
-DISTCLEANFILES += config.h libintl.h
+AM_CPPFLAGS += -I$(top_srcdir)/src
+AM_CPPFLAGS += $(BOOST_INCLUDES) $(ICONV_INCLUDES) $(ZLIB_INCLUDES)
+AM_CPPFLAGS += $(ENCHANT_CFLAGS) $(HUNSPELL_CFLAGS) $(MYTHES_INCLUDES)
+AM_CPPFLAGS += $(NOD_INCLUDES) $(QT_CPPFLAGS) $(QT_CORE_INCLUDES)
 
-MAINTAINERCLEANFILES += $(srcdir)/config.h.in
-
-AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src $(BOOST_INCLUDES)
+if BUILD_CLIENT_SUBDIR
+CLIENT = client
+endif
 
-SUBDIRS = support frontends .
+SUBDIRS = support frontends . $(CLIENT) tex2lyx convert
 
-EXTRA_DIST = config.h.in \
-       Section.h \
-       Section.cpp \
-       Variables.cpp \
-       Variables.h \
-       paper.h \
-       pch.h
+EXTRA_DIST = lyx_commit_hash.h.in \
+       CMakeLists.txt \
+       graphics/CMakeLists.txt \
+       insets/CMakeLists.txt \
+       mathed/CMakeLists.txt \
+       tests/CMakeLists.txt
 
-OTHERLIBS = $(BOOST_LIBS) $(INTLLIBS) $(AIKSAURUS_LIBS) @LIBS@ $(SOCKET_LIBS)
+OTHERLIBS = $(MYTHES_LIBS) $(ENCHANT_LIBS) $(HUNSPELL_LIBS) \
+            @LIBS@ $(ICONV_LIBS) $(ZLIB_LIBS) $(SOCKET_LIBS) \
+           $(LIBSHLWAPI) $(LIBPSAPI)
 
-noinst_LTLIBRARIES = liblyxcore.la
+noinst_LIBRARIES = liblyxcore.a
 bin_PROGRAMS = lyx
 
+lyx_LDFLAGS = $(AM_LDFLAGS) $(QT_LDFLAGS)
+
 lyx_LDADD = \
-       liblyxcore.la \
-       liblyxmathed.la \
-       liblyxinsets.la \
-       frontends/liblyxfrontends.la \
-       frontends/qt4/liblyxqt4.la \
-       liblyxgraphics.la \
-       support/liblyxsupport.la \
+       liblyxcore.a \
+       liblyxmathed.a \
+       liblyxinsets.a \
+       frontends/liblyxfrontends.a \
+       frontends/qt/liblyxqt.a \
+       liblyxgraphics.a \
+       support/liblyxsupport.a \
        $(OTHERLIBS) \
-       $(QT4_LIB) 
+       $(QT_LIB)
 
 if LYX_WIN_RESOURCE
 .rc.o:
-       cp $(top_srcdir)/development/Win32/packaging/icons/lyx_*32x32.ico .
-       windres -I. --preprocessor "$(CPP) -xc-header -DRC_INVOKED" $< -o $@
+       cp $(top_srcdir)/development/Win32/packaging/icons/lyx.ico .
+       cp $(top_srcdir)/development/Win32/packaging/icons/lyx_doc.ico .
+       $(RC) -I$(top_builddir) --preprocessor "$(CPP) -xc-header -DRC_INVOKED" $< -o $@
 endif
 
-#lyx_LDFLAGS=-Wl,-O1
+if INSTALL_MACOSX
+lyx_LDFLAGS += -framework AppKit -framework ApplicationServices \
+       -Wl,-rpath,@loader_path/../Frameworks \
+       -Wl,-rpath,@executable_path/../Frameworks \
+       -Wl,-headerpad_max_install_names
+endif
 
-BUILT_SOURCES = $(PCH_FILE)
+if INSTALL_MACOSX
+APPLESPELL = AppleSpellChecker.cpp AppleSpellChecker.h
+endif
 
 if USE_ASPELL
-ASPELL = ASpell.cpp ASpell_local.h
+ASPELL = AspellChecker.cpp AspellChecker.h
+PWL = PersonalWordList.cpp PersonalWordList.h
 endif
-if USE_PSPELL
-PSPELL = PSpell.cpp PSpell.h
+
+if USE_ENCHANT
+ENCHANT = EnchantChecker.cpp EnchantChecker.h
+PWL = PersonalWordList.cpp PersonalWordList.h
 endif
-if USE_ISPELL
-ISPELL = ISpell.cpp ISpell.h
+
+if USE_HUNSPELL
+HUNSPELL = HunspellChecker.cpp HunspellChecker.h
+PWL = PersonalWordList.cpp PersonalWordList.h
 endif
 
-# These four objects are linked as object files as they are not
-# referenced within the core and therefore are not picked up
-# by the linker without looping over libs. We do not want that,
-# and in fact libtools seems not able to do that.
 lyx_SOURCES = \
        main.cpp \
-       $(ASPELL) $(PSPELL) $(ISPELL) SpellBase.cpp \
+       $(APPLESPELL) \
+       $(ASPELL) \
+       BiblioInfo.h \
+       BiblioInfo.cpp \
        Box.cpp \
        Box.h \
+       Compare.cpp \
+       Compare.h \
        Dimension.cpp \
        Dimension.h \
-       PrinterParams.cpp \
-       PrinterParams.h \
+       $(ENCHANT) \
+       $(HUNSPELL) \
+       $(PWL) \
+       LaTeXFonts.cpp \
+       LaTeXFonts.h \
        Thesaurus.cpp \
        Thesaurus.h
 
@@ -74,209 +97,264 @@ if LYX_WIN_RESOURCE
 lyx_SOURCES += lyxwinres.rc
 endif
 
-liblyxcore_la_SOURCES = \
+SOURCEFILESCORE = \
        Author.cpp \
-       Author.h \
-       BiblioInfo.h \
-       BiblioInfo.cpp \
-       Bidi.cpp \
-       Bidi.h \
        boost.cpp \
        BranchList.cpp \
-       BranchList.h \
        Buffer.cpp \
        buffer_funcs.cpp \
+       BufferList.cpp \
+       BufferParams.cpp \
+       BufferView.cpp \
+       Bullet.cpp \
+       Changes.cpp \
+       Chktex.cpp \
+       CiteEnginesList.cpp \
+       CmdDef.cpp \
+       Color.cpp \
+       ConverterCache.cpp \
+       Converter.cpp \
+       CoordCache.cpp \
+       Counters.cpp \
+       Cursor.cpp \
+       CursorSlice.cpp \
+       CutAndPaste.cpp \
+       DepTable.cpp \
+       DocIterator.cpp \
+       Encoding.cpp \
+       BufferEncodings.cpp \
+       ErrorList.cpp \
+       Exporter.cpp \
+       factory.cpp \
+       Floating.cpp \
+       FloatList.cpp \
+       FontInfo.cpp \
+       FontList.cpp \
+       Font.cpp \
+       Format.cpp \
+       FuncRequest.cpp \
+       FuncStatus.cpp \
+       Graph.cpp \
+       IndicesList.cpp \
+       InsetIterator.cpp \
+       InsetList.cpp \
+       Intl.cpp \
+       KeyMap.cpp \
+       KeySequence.cpp \
+       Language.cpp \
+       LaTeX.cpp \
+       LaTeXFeatures.cpp \
+       LaTeXPackages.cpp \
+       LayoutFile.cpp \
+       LayoutModuleList.cpp \
+       Lexer.cpp \
+       LyX.cpp \
+       LyXAction.cpp \
+       lyxfind.cpp \
+       LyXRC.cpp \
+       LyXVC.cpp \
+       MetricsInfo.cpp \
+       ModuleList.cpp \
+       Mover.cpp \
+       output_docbook.cpp \
+       output.cpp \
+       output_latex.cpp \
+       output_xhtml.cpp \
+       OutputParams.cpp \
+       output_plaintext.cpp \
+       Paragraph.cpp \
+       ParagraphMetrics.cpp \
+       ParagraphParameters.cpp \
+       ParIterator.cpp \
+       PDFOptions.cpp \
+       Row.cpp \
+       RowPainter.cpp \
+       Server.cpp \
+       ServerSocket.cpp \
+       xml.cpp \
+       Session.cpp \
+       Spacing.cpp \
+       TexRow.cpp \
+       texstream.cpp \
+       Text.cpp \
+       Text2.cpp \
+       Text3.cpp \
+       TextClass.cpp \
+       TextMetrics.cpp \
+       TocBackend.cpp \
+       TocBuilder.cpp \
+       Trans.cpp \
+       Undo.cpp \
+       VCBackend.cpp \
+       version.cpp \
+       VSpace.cpp \
+       WordList.cpp
+
+HEADERFILESCORE = \
+       Author.h \
+       BranchList.h \
        buffer_funcs.h \
        Buffer.h \
-       BufferList.cpp \
+       BufferEncodings.h \
        BufferList.h \
-       BufferParams.cpp \
        BufferParams.h \
-       BufferView.cpp \
        BufferView.h \
-       Bullet.cpp \
        Bullet.h \
-       Changes.cpp \
+       Citation.h \
+       CiteEnginesList.h \
        Changes.h \
-       Chktex.cpp \
        Chktex.h \
-       Color.cpp \
+       CmdDef.h \
+       ColorCode.h \
        Color.h \
-       config.h.in \
-       ConverterCache.cpp \
+       ColorSet.h \
+       CompletionList.h \
        ConverterCache.h \
-       Converter.cpp \
        Converter.h \
-       CoordCache.cpp \
        CoordCache.h \
-       Counters.cpp \
        Counters.h \
-       Cursor.cpp \
        Cursor.h \
-       CursorSlice.cpp \
        CursorSlice.h \
-       CutAndPaste.cpp \
        CutAndPaste.h \
-       debug.cpp \
-       debug.h \
-       DepTable.cpp \
        DepTable.h \
        DispatchResult.h \
-       DocIterator.cpp \
        DocIterator.h \
-       EmbeddedFiles.h \
-       EmbeddedFiles.cpp \
-       Encoding.cpp \
+       DocumentClassPtr.h \
        Encoding.h \
-       ErrorList.cpp \
        ErrorList.h \
-       Exporter.cpp \
        Exporter.h \
-       factory.cpp \
        factory.h \
-       Floating.cpp \
        Floating.h \
-       FloatList.cpp \
        FloatList.h \
-       Font.cpp \
        Font.h \
-       FontIterator.cpp \
-       FontIterator.h \
-       Format.cpp \
+       FontEnums.h \
+       FontInfo.h \
+       FontList.h \
        Format.h \
-       FuncRequest.cpp \
+       FuncCode.h \
        FuncRequest.h \
-       FuncStatus.cpp \
        FuncStatus.h \
-       gettext.cpp \
-       gettext.h \
-       Graph.cpp \
        Graph.h \
-       Importer.cpp \
-       Importer.h \
-       InsetIterator.cpp \
+       IndicesList.h \
        InsetIterator.h \
-       InsetList.cpp \
        InsetList.h \
-       Intl.cpp \
        Intl.h \
-       KeyMap.cpp \
        KeyMap.h \
-       KeySequence.cpp \
        KeySequence.h \
-       Language.cpp \
        Language.h \
-       LaTeX.cpp \
-       LaTeXFeatures.cpp \
        LaTeXFeatures.h \
+       LaTeXPackages.h \
        LaTeX.h \
-       Layout.cpp \
        Layout.h \
-       LayoutEnum.h \
-       Length.cpp \
-       Length.h \
-       lengthcommon.cpp \
-       lengthcommon.h \
-       Lexer.cpp \
+       LayoutEnums.h \
+       LayoutFile.h \
+       LayoutModuleList.h \
        Lexer.h \
-       lfuns.h \
-       LyXAction.cpp \
        LyXAction.h \
-       LyX.cpp \
-       lyxfind.cpp \
        lyxfind.h \
-       LyXFunc.cpp \
-       LyXFunc.h \
        LyX.h \
-       lyxlayout_ptr_fwd.h \
-       LyXRC.cpp \
        LyXRC.h \
-       Server.cpp \
-       Server.h \
-       ServerSocket.cpp \
-       ServerSocket.h \
-       LyXVC.cpp \
        LyXVC.h \
-       MenuBackend.cpp \
-       MenuBackend.h \
-       Messages.cpp \
-       Messages.h \
-       MetricsInfo.cpp \
        MetricsInfo.h \
-       ModuleList.cpp \
        ModuleList.h \
-       Mover.cpp \
        Mover.h \
-       output.cpp \
-       output_docbook.cpp \
        output_docbook.h \
        output.h \
-       output_latex.cpp \
+       OutputEnums.h \
        output_latex.h \
-       OutputParams.cpp \
+       output_xhtml.h \
        OutputParams.h \
-       output_plaintext.cpp \
        output_plaintext.h \
        paper.h \
-       Paragraph.cpp \
-       paragraph_funcs.cpp \
-       paragraph_funcs.h \
        Paragraph.h \
        ParagraphList.h \
-       ParagraphMetrics.cpp \
        ParagraphMetrics.h \
-       ParagraphParameters.cpp \
        ParagraphParameters.h \
-       ParIterator.cpp \
        ParIterator.h \
-       PDFOptions.cpp \
        PDFOptions.h \
-       Row.cpp \
        Row.h \
-       rowpainter.cpp \
-       rowpainter.h \
-       Session.cpp \
+       RowFlags.h \
+       RowPainter.h \
+       Server.h \
+       ServerSocket.h \
        Session.h \
-       sgml.cpp \
-       sgml.h \
-       Spacing.cpp \
+       xml.h \
        Spacing.h \
-       SpellBase.h \
-       TexRow.cpp \
+       SpellChecker.h \
        TexRow.h \
-       TexStream.cpp \
-       TexStream.h \
+       texstream.h \
        Text.h \
-       Text.cpp \
-       Text2.cpp \
-       Text3.cpp \
-       TextClass.cpp \
        TextClass.h \
-       TextClassList.cpp \
-       TextClassList.h \
-       TextMetrics.cpp \
        TextMetrics.h \
-       TocBackend.cpp \
+       Toc.h \
        TocBackend.h \
-       ToolbarBackend.cpp \
-       ToolbarBackend.h \
-       Trans.cpp \
+       TocBuilder.h \
        Trans.h \
-       Undo.cpp \
        Undo.h \
        update_flags.h \
-       VCBackend.cpp \
        VCBackend.h \
-       version.cpp \
        version.h \
+       VSpace.h \
        WordLangTuple.h \
-       VSpace.cpp \
-       VSpace.h
+       WordList.h
+
+STANDALONEFILES = \
+       Layout.cpp
+
+
+.PHONY: update_commit_hash
+
+LCH_V_CHK = $(lch__v_CHK_@AM_V@)
+lch__v_CHK_ = $(lch__v_CHK_@AM_DEFAULT_V@)
+lch__v_CHK_0 = @echo "  CHK      lyx_commit_hash.h";
+lch__v_CHK_1 =
+
+update_commit_hash:
+       $(LCH_V_CHK)rm -f hash-temp ; \
+       hash=`cd "$(top_srcdir)" && git log -1 --pretty=format:%H 2>/dev/null || echo none` ; \
+       sed s/@LYX_GIT_COMMIT_HASH@/$$hash/ "$(srcdir)"/lyx_commit_hash.h.in >hash-temp ; \
+       cmp -s lyx_commit_hash.h hash-temp || cp hash-temp lyx_commit_hash.h ; \
+       rm -f hash-temp
+
+lyx_commit_hash.h: update_commit_hash
+
+BUILT_SOURCES = lyx_commit_hash.h
+CLEANFILES = lyx_commit_hash.h
+
+liblyxcore_a_SOURCES = $(SOURCEFILESCORE) $(STANDALONEFILES) $(HEADERFILESCORE)
+
+
+#########################  Qt stuff  ##############################
+
+MOCHEADER = Compare.h PreviewLoader.h
+
+if INSTALL_WINDOWS
+
+MOCHEADER += Server.h
+MOCFLAG = -D_WIN32
+
+endif
+
+MOCEDFILES = $(MOCHEADER:%.h=moc_%.cpp)
+
+BUILT_SOURCES += $(MOCEDFILES)
+CLEANFILES += $(MOCEDFILES)
+
+moc_PreviewLoader.cpp: graphics/PreviewLoader.h
+       $(AM_V_GEN)$(QT_MOC) $(MOCFLAG) -o $@ $<
+
+moc_%.cpp: %.h
+       $(AM_V_GEN)$(QT_MOC) $(MOCFLAG) -o $@ $<
+
+liblyxcore_a_DEPENDENCIES = $(MOCEDFILES)
+
 ############################### Graphics ##############################
 
-noinst_LTLIBRARIES += liblyxgraphics.la
+noinst_LIBRARIES += liblyxgraphics.a
 
-liblyxgraphics_la_SOURCES = \
+liblyxgraphics_a_SOURCES = \
+       graphics/epstools.h \
+       graphics/epstools.cpp \
        graphics/GraphicsCache.h \
        graphics/GraphicsCache.cpp \
        graphics/GraphicsCacheItem.h \
@@ -284,293 +362,392 @@ liblyxgraphics_la_SOURCES = \
        graphics/GraphicsConverter.h \
        graphics/GraphicsConverter.cpp \
        graphics/GraphicsImage.h \
-       graphics/GraphicsImage.cpp \
        graphics/GraphicsLoader.h \
        graphics/GraphicsLoader.cpp \
        graphics/GraphicsParams.cpp \
        graphics/GraphicsParams.h \
-       graphics/LoaderQueue.h \
-       graphics/LoaderQueue.cpp \
        graphics/GraphicsTypes.h \
-       graphics/GraphicsTypes.cpp \
        graphics/PreviewImage.h \
        graphics/PreviewImage.cpp \
        graphics/PreviewLoader.h \
-       graphics/PreviewLoader.cpp \
-       graphics/Previews.h \
-       graphics/Previews.cpp
+       graphics/PreviewLoader.cpp
 
 
 ############################### Mathed  ##############################
 
-EXTRA_DIST += mathed/InsetFormulaMacro.cpp
+noinst_LIBRARIES += liblyxmathed.a
 
-noinst_LTLIBRARIES += liblyxmathed.la
-
-liblyxmathed_la_SOURCES = \
+SOURCEFILESMATHED = \
        mathed/InsetMathAMSArray.cpp \
-       mathed/InsetMathAMSArray.h \
        mathed/InsetMathArray.cpp \
-       mathed/InsetMathArray.h \
        mathed/InsetMathBig.cpp \
-       mathed/InsetMathBig.h \
-       mathed/InsetMathBinom.cpp \
-       mathed/InsetMathBinom.h \
        mathed/InsetMathBoldSymbol.cpp \
-       mathed/InsetMathBoldSymbol.h \
        mathed/InsetMathBox.cpp \
-       mathed/InsetMathBoxed.cpp \
-       mathed/InsetMathBoxed.h \
-       mathed/InsetMathBox.h \
        mathed/InsetMathBrace.cpp \
-       mathed/InsetMathBrace.h \
        mathed/InsetMath.cpp \
+       mathed/InsetMathCancel.cpp \
+       mathed/InsetMathCancelto.cpp \
        mathed/InsetMathCases.cpp \
-       mathed/InsetMathCases.h \
        mathed/InsetMathChar.cpp \
-       mathed/InsetMathChar.h \
+       mathed/InsetMathClass.cpp \
        mathed/InsetMathColor.cpp \
-       mathed/InsetMathColor.h \
-       mathed/CommandInset.cpp \
-       mathed/CommandInset.h \
+       mathed/InsetMathCommand.cpp \
        mathed/InsetMathComment.cpp \
-       mathed/InsetMathComment.h \
        mathed/InsetMathDecoration.cpp \
        mathed/InsetMathDecoration.h \
        mathed/InsetMathDelim.cpp \
-       mathed/InsetMathDelim.h \
-       mathed/InsetMathDFrac.cpp \
-       mathed/InsetMathDFrac.h \
+       mathed/InsetMathDiagram.cpp \
        mathed/InsetMathDiff.cpp \
-       mathed/InsetMathDiff.h \
        mathed/InsetMathDots.cpp \
-       mathed/InsetMathDots.h \
+       mathed/InsetMathEnsureMath.cpp \
        mathed/InsetMathEnv.cpp \
-       mathed/InsetMathEnv.h \
        mathed/InsetMathExFunc.cpp \
-       mathed/InsetMathExFunc.h \
        mathed/InsetMathExInt.cpp \
-       mathed/InsetMathExInt.h \
-       mathed/InsetMathFBox.cpp \
-       mathed/InsetMathFBox.h \
        mathed/InsetMathFont.cpp \
-       mathed/InsetMathFont.h \
        mathed/InsetMathFontOld.cpp \
-       mathed/InsetMathFontOld.h \
-       mathed/InsetMathFracBase.cpp \
-       mathed/InsetMathFracBase.h \
        mathed/InsetMathFrac.cpp \
-       mathed/InsetMathFrac.h \
-       mathed/InsetMathFrameBox.cpp \
-       mathed/InsetMathFrameBox.h \
        mathed/InsetMathGrid.cpp \
+       mathed/InsetMathHull.cpp \
+       mathed/InsetMathKern.cpp \
+       mathed/InsetMathLefteqn.cpp \
+       mathed/InsetMathLim.cpp \
+       mathed/InsetMathMacro.cpp \
+       mathed/InsetMathMacroArgument.cpp \
+       mathed/InsetMathMacroTemplate.cpp \
+       mathed/InsetMathMatrix.cpp \
+       mathed/InsetMathNest.cpp \
+       mathed/InsetMathNumber.cpp \
+       mathed/InsetMathOverset.cpp \
+       mathed/InsetMathPar.cpp \
+       mathed/InsetMathPhantom.cpp \
+       mathed/InsetMathRef.cpp \
+       mathed/InsetMathRoot.cpp \
+       mathed/InsetMathScript.cpp \
+       mathed/InsetMathSideset.cpp \
+       mathed/InsetMathSize.cpp \
+       mathed/InsetMathSpace.cpp \
+       mathed/InsetMathSpecialChar.cpp \
+       mathed/InsetMathSplit.cpp \
+       mathed/InsetMathSqrt.cpp \
+       mathed/InsetMathStackrel.cpp \
+       mathed/InsetMathString.cpp \
+       mathed/InsetMathSubstack.cpp \
+       mathed/InsetMathSymbol.cpp \
+       mathed/InsetMathTabular.cpp \
+       mathed/InsetMathUnderset.cpp \
+       mathed/InsetMathUnknown.cpp \
+       mathed/InsetMathXArrow.cpp \
+       mathed/InsetMathXYMatrix.cpp \
+       mathed/MacroTable.cpp \
+       mathed/MathAtom.cpp \
+       mathed/MathAutoCorrect.cpp \
+       mathed/MathClass.cpp \
+       mathed/MathData.cpp \
+       mathed/MathExtern.cpp \
+       mathed/MathFactory.cpp \
+       mathed/MathParser.cpp \
+       mathed/MathRow.cpp \
+       mathed/MathStream.cpp \
+       mathed/MathSupport.cpp \
+       mathed/TextPainter.cpp
+
+HEADERFILESMATHED = \
+       mathed/InsetMathAMSArray.h \
+       mathed/InsetMathArray.h \
+       mathed/InsetMathBig.h \
+       mathed/InsetMathBoldSymbol.h \
+       mathed/InsetMathBox.h \
+       mathed/InsetMathBrace.h \
+       mathed/InsetMathCancel.h \
+       mathed/InsetMathCancelto.h \
+       mathed/InsetMathCases.h \
+       mathed/InsetMathChar.h \
+       mathed/InsetMathClass.h \
+       mathed/InsetMathColor.h \
+       mathed/InsetMathCommand.h \
+       mathed/InsetMathComment.h \
+       mathed/InsetMathDelim.h \
+       mathed/InsetMathDiff.h \
+       mathed/InsetMathDots.h \
+       mathed/InsetMathEnsureMath.h \
+       mathed/InsetMathEnv.h \
+       mathed/InsetMathExFunc.h \
+       mathed/InsetMathExInt.h \
+       mathed/InsetMathFont.h \
+       mathed/InsetMathFontOld.h \
+       mathed/InsetMathFrac.h \
        mathed/InsetMathGrid.h \
        mathed/InsetMath.h \
-       mathed/InsetMathHull.cpp \
        mathed/InsetMathHull.h \
-       mathed/InsetMathKern.cpp \
        mathed/InsetMathKern.h \
-       mathed/InsetMathLefteqn.cpp \
        mathed/InsetMathLefteqn.h \
-       mathed/InsetMathLim.cpp \
        mathed/InsetMathLim.h \
-       mathed/MathMacro.cpp \
-       mathed/MathMacro.h \
-       mathed/InsetMathMakebox.cpp \
-       mathed/InsetMathMakebox.h \
-       mathed/InsetMathMatrix.cpp \
+       mathed/InsetMathMacro.h \
+       mathed/InsetMathMacroArgument.h \
+       mathed/InsetMathMacroTemplate.h \
        mathed/InsetMathMatrix.h \
-       mathed/InsetMathNest.cpp \
        mathed/InsetMathNest.h \
-       mathed/InsetMathNumber.cpp \
        mathed/InsetMathNumber.h \
-       mathed/InsetMathOverset.cpp \
        mathed/InsetMathOverset.h \
-       mathed/InsetMathPar.cpp \
        mathed/InsetMathPar.h \
-       mathed/InsetMathPhantom.cpp \
        mathed/InsetMathPhantom.h \
-       mathed/InsetMathRef.cpp \
        mathed/InsetMathRef.h \
-       mathed/InsetMathRoot.cpp \
        mathed/InsetMathRoot.h \
-       mathed/InsetMathScript.cpp \
        mathed/InsetMathScript.h \
-       mathed/InsetMathSize.cpp \
+       mathed/InsetMathSideset.h \
        mathed/InsetMathSize.h \
-       mathed/InsetMathSpace.cpp \
        mathed/InsetMathSpace.h \
-       mathed/InsetMathSplit.cpp \
+       mathed/InsetMathSpecialChar.h \
        mathed/InsetMathSplit.h \
-       mathed/InsetMathSqrt.cpp \
        mathed/InsetMathSqrt.h \
-       mathed/InsetMathStackrel.cpp \
        mathed/InsetMathStackrel.h \
-       mathed/InsetMathString.cpp \
        mathed/InsetMathString.h \
-       mathed/InsetMathSubstack.cpp \
        mathed/InsetMathSubstack.h \
-       mathed/InsetMathSymbol.cpp \
        mathed/InsetMathSymbol.h \
-       mathed/InsetMathTabular.cpp \
        mathed/InsetMathTabular.h \
-       mathed/InsetMathTFrac.cpp \
-       mathed/InsetMathTFrac.h \
-       mathed/InsetMathUnderset.cpp \
        mathed/InsetMathUnderset.h \
-       mathed/InsetMathUnknown.cpp \
        mathed/InsetMathUnknown.h \
-       mathed/InsetMathXArrow.cpp \
        mathed/InsetMathXArrow.h \
-       mathed/InsetMathXYMatrix.cpp \
        mathed/InsetMathXYMatrix.h \
-       mathed/MathAtom.cpp \
+       mathed/InsetMathDiagram.h \
        mathed/MathAtom.h \
-       mathed/MathAutoCorrect.cpp \
        mathed/MathAutoCorrect.h \
-       mathed/MathData.cpp \
+       mathed/MathClass.h \
        mathed/MathData.h \
-       mathed/MathExtern.cpp \
+       mathed/MathCompletionList.h \
        mathed/MathExtern.h \
-       mathed/MathFactory.cpp \
        mathed/MathFactory.h \
-       mathed/MathGridInfo.h \
-       mathed/MathMacroArgument.cpp \
-       mathed/MathMacroArgument.h \
-       mathed/MacroTable.cpp \
        mathed/MacroTable.h \
-       mathed/MathMacroTemplate.cpp \
-       mathed/MathMacroTemplate.h \
-       mathed/MathParser.cpp \
        mathed/MathParser.h \
+       mathed/MathParser_flags.h \
+       mathed/MathRow.h \
        mathed/ReplaceData.h \
-       mathed/MathStream.cpp \
        mathed/MathStream.h \
-       mathed/MathSupport.cpp \
        mathed/MathSupport.h \
-       mathed/TextPainter.cpp \
-       mathed/TextPainter.h 
-#      mathed/InsetMathMBox.cpp
-#      mathed/InsetMathMBox.h
+       mathed/TextPainter.h
 
-############################### Insets  ##############################
+liblyxmathed_a_SOURCES = $(SOURCEFILESMATHED) $(HEADERFILESMATHED)
 
-noinst_LTLIBRARIES += liblyxinsets.la
 
-EXTRA_DIST += \
-       insets/InsetTheorem.cpp \
-       insets/InsetTheorem.h
+############################### Insets  ##############################
 
-liblyxinsets_la_SOURCES = \
-       insets/MailInset.cpp \
-       insets/MailInset.h \
+noinst_LIBRARIES += liblyxinsets.a
+
+SOURCEFILESINSETS = \
        insets/ExternalSupport.cpp \
-       insets/ExternalSupport.h \
        insets/ExternalTemplate.cpp \
-       insets/ExternalTemplate.h \
        insets/ExternalTransforms.cpp \
+       insets/RenderButton.cpp \
+       insets/RenderGraphic.cpp \
+       insets/RenderPreview.cpp \
+       insets/Inset.cpp \
+       insets/InsetArgument.cpp \
+       insets/InsetBibitem.cpp \
+       insets/InsetBibtex.cpp \
+       insets/InsetBox.cpp \
+       insets/InsetBranch.cpp \
+       insets/InsetCaption.cpp \
+       insets/InsetCaptionable.cpp \
+       insets/InsetCitation.cpp \
+       insets/InsetCollapsible.cpp \
+       insets/InsetCommand.cpp \
+       insets/InsetCommandParams.cpp \
+       insets/InsetCounter.cpp \
+       insets/InsetERT.cpp \
+       insets/InsetExternal.cpp \
+       insets/InsetFlex.cpp \
+       insets/InsetFloat.cpp \
+       insets/InsetFloatList.cpp \
+       insets/InsetFoot.cpp \
+       insets/InsetFootlike.cpp \
+       insets/InsetGraphicsParams.cpp \
+       insets/InsetGraphics.cpp \
+       insets/InsetHyperlink.cpp \
+       insets/InsetInclude.cpp \
+       insets/InsetIndex.cpp \
+       insets/InsetInfo.cpp \
+       insets/InsetIPA.cpp \
+       insets/InsetIPAMacro.cpp \
+       insets/InsetLabel.cpp \
+       insets/InsetLayout.cpp \
+       insets/InsetLine.cpp \
+       insets/InsetListings.cpp \
+       insets/InsetListingsParams.cpp \
+       insets/InsetMarginal.cpp \
+       insets/InsetNewline.cpp \
+       insets/InsetNewpage.cpp \
+       insets/InsetNomencl.cpp \
+       insets/InsetNote.cpp \
+       insets/InsetPhantom.cpp \
+       insets/InsetPreview.cpp \
+       insets/InsetQuotes.cpp \
+       insets/InsetRef.cpp \
+       insets/InsetScript.cpp \
+       insets/InsetSeparator.cpp \
+       insets/InsetSpace.cpp \
+       insets/InsetSpecialChar.cpp \
+       insets/InsetTabular.cpp \
+       insets/InsetText.cpp \
+       insets/InsetTOC.cpp \
+       insets/InsetVSpace.cpp \
+       insets/InsetWrap.cpp
+
+HEADERFILESINSETS = \
+       insets/ExternalSupport.h \
+       insets/ExternalTemplate.h \
        insets/ExternalTransforms.h \
        insets/RenderBase.h \
-       insets/RenderButton.cpp \
        insets/RenderButton.h \
-       insets/RenderGraphic.cpp \
        insets/RenderGraphic.h \
-       insets/RenderPreview.cpp \
        insets/RenderPreview.h \
        insets/Inset.h \
-       insets/Inset.cpp \
-       insets/InsetBibitem.cpp \
+       insets/InsetArgument.h \
        insets/InsetBibitem.h \
-       insets/InsetBibtex.cpp \
        insets/InsetBibtex.h \
-       insets/InsetBox.cpp \
        insets/InsetBox.h \
-       insets/InsetBranch.cpp \
        insets/InsetBranch.h \
-       insets/InsetCaption.cpp \
        insets/InsetCaption.h \
-       insets/InsetCitation.cpp \
+       insets/InsetCaptionable.h \
        insets/InsetCitation.h \
        insets/InsetCode.h \
-       insets/InsetCollapsable.cpp \
-       insets/InsetCollapsable.h \
-       insets/InsetCommand.cpp \
+       insets/InsetCollapsible.h \
        insets/InsetCommand.h \
-       insets/InsetCommandParams.cpp \
        insets/InsetCommandParams.h \
-       insets/InsetEnvironment.cpp \
-       insets/InsetEnvironment.h \
-       insets/InsetERT.cpp \
+       insets/InsetCounter.h \
        insets/InsetERT.h \
-       insets/InsetExternal.cpp \
        insets/InsetExternal.h \
        insets/InsetFlex.h \
-       insets/InsetFlex.cpp \
        insets/InsetFloat.h \
-       insets/InsetFloat.cpp \
-       insets/InsetFloatList.cpp \
-       insets/InsetFloatList.h \
-       insets/InsetFoot.cpp \
        insets/InsetFoot.h \
-       insets/InsetFootlike.cpp \
+       insets/InsetFloatList.h \
        insets/InsetFootlike.h \
        insets/InsetGraphicsParams.h \
-       insets/InsetGraphicsParams.cpp \
-       insets/InsetGraphics.cpp \
        insets/InsetGraphics.h \
-       insets/InsetHFill.cpp \
-       insets/InsetHFill.h \
-       insets/InsetInclude.cpp \
+       insets/InsetHyperlink.h \
        insets/InsetInclude.h \
-       insets/InsetIndex.cpp \
        insets/InsetIndex.h \
-       insets/InsetInfo.cpp \
        insets/InsetInfo.h \
-       insets/InsetLabel.cpp \
+       insets/InsetIPA.h \
+       insets/InsetIPAMacro.h \
+       insets/InsetPreview.h \
        insets/InsetLabel.h \
-       insets/InsetLine.cpp \
+       insets/InsetLayout.h \
        insets/InsetLine.h \
        insets/InsetListings.h \
-       insets/InsetListings.cpp \
        insets/InsetListingsParams.h \
-       insets/InsetListingsParams.cpp \
        insets/InsetMarginal.h \
-       insets/InsetMarginal.cpp \
-       insets/InsetNewline.cpp \
        insets/InsetNewline.h \
-       insets/InsetNomencl.cpp \
+       insets/InsetNewpage.h \
        insets/InsetNomencl.h \
-       insets/InsetNote.cpp \
        insets/InsetNote.h \
-       insets/InsetOptArg.cpp \
-       insets/InsetOptArg.h \
-       insets/InsetPagebreak.cpp \
-       insets/InsetPagebreak.h \
-       insets/InsetQuotes.cpp \
+       insets/InsetPhantom.h \
        insets/InsetQuotes.h \
-       insets/InsetRef.cpp \
        insets/InsetRef.h \
-       insets/InsetSpace.cpp \
+       insets/InsetScript.h \
+       insets/InsetSeparator.h \
        insets/InsetSpace.h \
-       insets/InsetSpecialChar.cpp \
        insets/InsetSpecialChar.h \
-       insets/InsetTabular.cpp \
        insets/InsetTabular.h \
-       insets/InsetText.cpp \
        insets/InsetText.h \
-       insets/InsetTOC.cpp \
        insets/InsetTOC.h \
-       insets/InsetUrl.cpp \
-       insets/InsetUrl.h \
-       insets/InsetVSpace.cpp \
        insets/InsetVSpace.h \
-       insets/InsetWrap.h \
-       insets/InsetWrap.cpp
+       insets/InsetWrap.h
+
+liblyxinsets_a_SOURCES = $(SOURCEFILESINSETS) $(HEADERFILESINSETS)
+
+
+############################## Tests ##################################
+
+EXTRA_DIST += \
+       tests/test_ExternalTransforms \
+       tests/test_ListingsCaption \
+       tests/test_layout \
+       tests/test_Length \
+       tests/regfiles/ExternalTransforms \
+       tests/regfiles/Length \
+       tests/regfiles/ListingsCaption \
+       tests/dummy_functions.cpp \
+       tests/boost.cpp
+
+TESTS = tests/test_ExternalTransforms tests/test_ListingsCaption \
+       tests/test_layout tests/test_Length
+
+alltests: check alltests-recursive
+
+alltests-recursive: check_layout
+       @srcdir=$(srcdir) $(srcdir)/tests/test_layout; \
+       if test $$? -eq 0; then \
+               echo -e "====================\nlayout tests passed.\n===================="; \
+       else \
+               echo -e "====================\nlayout tests failed.\n===================="; \
+       fi
+       cd tex2lyx; $(MAKE) alltests-recursive
+
+updatetests:
+       cd tex2lyx; $(MAKE) updatetests
+
+check_PROGRAMS = \
+       check_ExternalTransforms \
+       check_Length \
+       check_ListingsCaption \
+       check_layout
+
+if INSTALL_MACOSX
+ADD_FRAMEWORKS = -framework QtGui -framework QtCore -framework AppKit -framework ApplicationServices
+endif
+
+TESTS_LIBS = support/liblyxsupport.a \
+       $(LIBICONV) @LIBS@ \
+       $(ICONV_LIBS) $(ZLIB_LIBS) $(QT_LIB) $(LIBSHLWAPI)
+
+check_layout_CPPFLAGS = $(AM_CPPFLAGS)
+check_layout_LDADD = $(check_layout_LYX_OBJS) $(TESTS_LIBS)
+check_layout_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
+check_layout_SOURCES = \
+       tests/check_layout.cpp \
+       tests/dummy_functions.cpp \
+       tests/boost.cpp
+check_layout_LYX_OBJS = \
+       insets/InsetLayout.o \
+       CiteEnginesList.o \
+       Color.o \
+       Counters.o \
+       Floating.o \
+       FloatList.o \
+       FontInfo.o \
+       Layout.o \
+       LayoutFile.o \
+       Lexer.o \
+       ModuleList.o \
+       Spacing.o \
+       TextClass.o
+
+check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS)
+check_ExternalTransforms_LDADD = $(check_ExternalTransforms_LYX_OBJS) $(TESTS_LIBS)
+check_ExternalTransforms_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
+check_ExternalTransforms_SOURCES = \
+       tests/check_ExternalTransforms.cpp \
+       tests/dummy_functions.cpp \
+       tests/boost.cpp
+check_ExternalTransforms_LYX_OBJS = \
+       graphics/GraphicsParams.o \
+       insets/ExternalTransforms.o
+
+check_Length_CPPFLAGS = $(AM_CPPFLAGS)
+check_Length_LDADD = $(TESTS_LIBS)
+check_Length_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
+check_Length_SOURCES = \
+       tests/check_Length.cpp \
+       tests/dummy_functions.cpp \
+       tests/boost.cpp
 
-#      insets/insetlist.C \
-#      insets/insetlist.h \
-#      insets/insetsection.h \
-#      insets/insetsection.C \
-#      insets/InsetTheorem.cpp \
-#      insets/InsetTheorem.h
+check_ListingsCaption_CPPFLAGS = $(AM_CPPFLAGS)
+check_ListingsCaption_LDADD = $(check_ListingsCaption_LYX_OBJS) $(TESTS_LIBS)
+check_ListingsCaption_LDFLAGS = $(QT_LDFLAGS) $(ADD_FRAMEWORKS)
+check_ListingsCaption_SOURCES = \
+       tests/check_ListingsCaption.cpp \
+       tests/dummy_functions.cpp \
+       tests/boost.cpp
+check_ListingsCaption_LYX_OBJS =
 
+.PHONY: alltests alltests-recursive updatetests