<?xml version="1.0" ?>
<makefile>

    <requires version="0.2.10"/>
    <using module="datafiles"/>

<!-- necessary if wx-config can not be used -->
    <option name="WXDIR" category="path" never_empty="1">
        <values></values>
        <default-value></default-value>
    </option>

<!-- this option allows to build the application with either the
     Static or DLL configuration of wxWidgets -->
    <option name="USEDLL">
        <values>0,1</values>
        <values-description>,DLL</values-description>
        <default-value>0</default-value>
    </option>
    <set var="WXUSINGDLL">
        <if cond="USEDLL=='1'">WXUSINGDLL</if>
    </set>

<!-- Unicode only from now on -->
    <set var="U_OPT">u</set>

<!-- this option allows to build the application with either the
     Debug or Release configuration of wxWidgets and IBPP -->
    <option name="FINAL">
        <values>0,1</values>
        <values-description>Debug,Release</values-description>
        <default-value>0</default-value>
    </option>
    <set var="D_OPT">
        <if cond="FINAL=='0'">d</if>
    </set>
    <set var="DEBUGINFO">
        <if cond="FINAL=='0'">on</if>
        <if cond="FINAL=='1'">off</if>
    </set>
    <set var="OPTIMIZE">
        <if cond="FINAL=='0'">off</if>
        <if cond="FINAL=='1'">size</if>
    </set>

<!-- this option allows to build the application with either the
     dynamic or static runtime libraries -->
    <option name="STATICRTL">
        <values>0,1</values>
        <values-description>Dynamic,Static</values-description>
        <default-value>0</default-value>
    </option>
    <set var="R_OPT">
        <if cond="STATICRTL=='1'">s</if>
    </set>
    <set var="RTL_TYPE">
        <if cond="STATICRTL=='0'">dynamic</if>
        <if cond="STATICRTL=='1'">static</if>
    </set>

<!-- this option allows to build the application for WIN64 -->
    <if cond="FORMAT in ['msvc','msvc6prj','msvs2008prj']">
        <option name="TARGET_CPU">
            <default-value>$(DOLLAR)(CPU)</default-value>
            <description>
The target processor architecture must be specified when it is not X86.
This does not affect the compiler output, so you still need to make sure
your environment is set up appropriately with the correct compiler in the
PATH. Rather it affects some options passed to some of the common build
utilities such as the resource compiler and the linker.

Accepted values: AMD64, IA64.
            </description>
        </option>
    </if>
    <if cond="not (FORMAT in ['msvc','msvc6prj','msvs2008'])">
        <set var="TARGET_CPU"/>
    </if>
    <set var="DIR_SUFFIX_CPU">
        <if cond="TARGET_CPU=='amd64'">_amd64</if>
        <if cond="TARGET_CPU=='AMD64'">_amd64</if>
        <if cond="TARGET_CPU=='ia64'">_ia64</if>
        <if cond="TARGET_CPU=='IA64'">_ia64</if>
    </set>
    <set var="LINK_TARGET_CPU">
        <if cond="TARGET_CPU=='amd64'">/MACHINE:AMD64</if>
        <if cond="TARGET_CPU=='AMD64'">/MACHINE:AMD64</if>
        <if cond="TARGET_CPU=='ia64'">/MACHINE:IA64</if>
        <if cond="TARGET_CPU=='IA64'">/MACHINE:IA64</if>
    </set>


    <define-tag name="headers" rules="dll,lib,exe">
        <if cond="FORMAT in ['msvc6prj','msvs2008prj']">
            <msvc-project-files>
                $(value)
            </msvc-project-files>
        </if>
    </define-tag>


<!-- stuff common for IBPP library and FlameRobin executable -->

    <template id="fr_common">
        <runtime-libs>$(RTL_TYPE)</runtime-libs>
        <threading>multi</threading>

        <debug-info>$(DEBUGINFO)</debug-info>
        <optimize>$(OPTIMIZE)</optimize>

        <if cond="FORMAT in ['msvc6prj','msvc','msvs2008prj']">
            <ldflags>/nologo</ldflags>
            <ldflags>/subsystem:windows</ldflags>
            <ldflags>$(LINK_TARGET_CPU)</ldflags>
        </if>

        <cxx-rtti>on</cxx-rtti>
        <cxx-exceptions>on</cxx-exceptions>
        <warnings>max</warnings>
    </template>

    <set var="BUILDDIR">
        <if cond="TOOLSET=='win32'">$(COMPILER)$(U_OPT)$(R_OPT)$(D_OPT)$(DIR_SUFFIX_CPU)</if>
        <if cond="TOOLSET!='win32'">.</if>
    </set>

    <set var="SOURCEDIR">src</set>
    <set var="RESDIR">res</set>

    <!-- IBPP needs one of these defined for the target platform -->
    <set var="IBPPPLATFORMDEFINE">
        <if cond="PLATFORM_MACOSX=='1'">IBPP_DARWIN</if>
        <if cond="PLATFORM_UNIX=='1'">IBPP_LINUX</if>
        <if cond="PLATFORM_WIN32=='1'">IBPP_WINDOWS</if>
    </set>


<!-- build FlameRobin executable -->

    <template id="wx">
        <if cond="FORMAT!='autoconf'">
            <set var="WXDIR">$(DOLLAR)(WXDIR)</set>
        </if>
        <if cond="FORMAT=='autoconf'">
            <define>HAVE_FRCONFIG_H</define>
        </if>

        <!-- Set debug info here -->
        <set var="WXDEBUG">
            <if cond="FINAL=='0'">__WXDEBUG__</if>
        </set>

        <set var="DEBUGFLAG">
            <if cond="FINAL=='0'">_DEBUG</if>
        </set>

        <define>$(WXDEBUG)</define>
        <define>$(DEBUGFLAG)</define>

        <if cond="FORMAT in ['mingw']">
            <define>HAVE_W32API_H</define>
        </if>

        <if cond="FORMAT in ['mingw','msvc6prj','msvc','msvs2008prj']">
            <define>_WINDOWS</define>
            <define>__WINDOWS__</define>
            <define>WINVER=0x400</define>
            <define>WIN32</define>
            <define>__WIN32__</define>
            <define>__WIN95__</define>
            <define>STRICT</define>

            <define>__WXMSW__</define>
            <define>wxUSE_GUI=1</define>
            <define>wxUSE_REGEX=1</define>
            <define>wxUSE_UNICODE=1</define>
            <define>WIN32_LEAN_AND_MEAN</define>

            <set var="WX_PORT">wxmsw</set>
<!-- set this to 28 for wxWidgets 2.8.X, to 30 for wxWidgets 3.2.x-->
            <set var="WX_VERSION">32</set>

            <set var="WX_LIB_DIR" make_var="1">
                <if cond="USEDLL=='1'">$(WXDIR)/lib/$(COMPILER)$(DIR_SUFFIX_CPU)_dll</if>
                <if cond="USEDLL=='0'">$(WXDIR)/lib/$(COMPILER)$(DIR_SUFFIX_CPU)_lib</if>
            </set>

            <include>$(WX_LIB_DIR)/msw$(U_OPT)$(D_OPT)</include>
            <include>$(WXDIR)/contrib/include</include>
            <include>$(WXDIR)/include</include>

            <lib-path>$(WX_LIB_DIR)</lib-path>

            <!-- another nice thing that wx-config will take care of -->
            <sys-lib>$(WX_PORT)$(WX_VERSION)$(U_OPT)$(D_OPT)_aui</sys-lib>
            <sys-lib>$(WX_PORT)$(WX_VERSION)$(U_OPT)$(D_OPT)_stc</sys-lib>
            <sys-lib>$(WX_PORT)$(WX_VERSION)$(U_OPT)$(D_OPT)_html</sys-lib>
            <sys-lib>$(WX_PORT)$(WX_VERSION)$(U_OPT)$(D_OPT)_adv</sys-lib>
            <sys-lib>$(WX_PORT)$(WX_VERSION)$(U_OPT)$(D_OPT)_core</sys-lib>
            <sys-lib>wxbase$(WX_VERSION)$(U_OPT)$(D_OPT)_xml</sys-lib>
            <sys-lib>wxbase$(WX_VERSION)$(U_OPT)$(D_OPT)</sys-lib>
            <if cond="WX_VERSION>='32'">
                <sys-lib>wxscintilla$(D_OPT)</sys-lib>
            </if>
            <sys-lib>wxexpat$(D_OPT)</sys-lib>
            <sys-lib>wxtiff$(D_OPT)</sys-lib>
            <sys-lib>wxjpeg$(D_OPT)</sys-lib>
            <sys-lib>wxpng$(D_OPT)</sys-lib>
            <sys-lib>wxzlib$(D_OPT)</sys-lib>
            <sys-lib>wxregex$(U_OPT)$(D_OPT)</sys-lib>

            <sys-lib>kernel32</sys-lib>
            <sys-lib>user32</sys-lib>
            <sys-lib>gdi32</sys-lib>
            <sys-lib>winspool</sys-lib>
            <sys-lib>comdlg32</sys-lib>
            <sys-lib>advapi32</sys-lib>
            <sys-lib>shell32</sys-lib>
            <sys-lib>ole32</sys-lib>
            <sys-lib>oleaut32</sys-lib>
            <sys-lib>uuid</sys-lib>
            <sys-lib>comctl32</sys-lib>
            <sys-lib>rpcrt4</sys-lib>
            <sys-lib>wsock32</sys-lib>
        </if>
    </template>

    <set var="FR_HEADERFILES">
        $(SOURCEDIR)/frutils.h
        $(SOURCEDIR)/frversion.h
        $(SOURCEDIR)/Isaac.h
        $(SOURCEDIR)/logger.h
        $(SOURCEDIR)/main.h
        $(SOURCEDIR)/MasterPassword.h
        $(SOURCEDIR)/revisioninfo.h
        $(SOURCEDIR)/statementHistory.h
        $(SOURCEDIR)/config/Config.h
        $(SOURCEDIR)/config/DatabaseConfig.h
        $(SOURCEDIR)/config/LocalSettings.h
        $(SOURCEDIR)/core/ArtProvider.h
        $(SOURCEDIR)/core/CodeTemplateProcessor.h
        $(SOURCEDIR)/core/FRDecimal.h
        $(SOURCEDIR)/core/FRError.h
        $(SOURCEDIR)/core/FRInt128.h
        $(SOURCEDIR)/core/ObjectWithHandle.h
        $(SOURCEDIR)/core/Observer.h
        $(SOURCEDIR)/core/ProcessableObject.h
        $(SOURCEDIR)/core/ProgressIndicator.h
        $(SOURCEDIR)/core/StringUtils.h
        $(SOURCEDIR)/core/Subject.h
        $(SOURCEDIR)/core/TemplateProcessor.h
        $(SOURCEDIR)/core/URIProcessor.h
        $(SOURCEDIR)/core/Visitor.h
        $(SOURCEDIR)/engine/MetadataLoader.h
        $(SOURCEDIR)/gui/AboutBox.h
        $(SOURCEDIR)/gui/AdvancedMessageDialog.h
        $(SOURCEDIR)/gui/AdvancedSearchFrame.h
        $(SOURCEDIR)/gui/BackupFrame.h
        $(SOURCEDIR)/gui/BackupRestoreBaseFrame.h
        $(SOURCEDIR)/gui/BaseDialog.h
        $(SOURCEDIR)/gui/BaseFrame.h
        $(SOURCEDIR)/gui/CommandIds.h
        $(SOURCEDIR)/gui/CommandManager.h
        $(SOURCEDIR)/gui/ConfdefTemplateProcessor.h
        $(SOURCEDIR)/gui/ContextMenuMetadataItemVisitor.h
        $(SOURCEDIR)/gui/CreateIndexDialog.h
        $(SOURCEDIR)/gui/DatabaseRegistrationDialog.h
        $(SOURCEDIR)/gui/DataGeneratorFrame.h
        $(SOURCEDIR)/gui/EditBlobDialog.h
        $(SOURCEDIR)/gui/EventWatcherFrame.h
        $(SOURCEDIR)/gui/ExecuteSql.h
        $(SOURCEDIR)/gui/ExecuteSqlFrame.h
        $(SOURCEDIR)/gui/FieldPropertiesDialog.h
        $(SOURCEDIR)/gui/FindDialog.h
        $(SOURCEDIR)/gui/FRLayoutConfig.h
        $(SOURCEDIR)/gui/FRStyle.h
        $(SOURCEDIR)/gui/GUIURIHandlerHelper.h
        $(SOURCEDIR)/gui/HtmlHeaderMetadataItemVisitor.h
        $(SOURCEDIR)/gui/HtmlTemplateProcessor.h
        $(SOURCEDIR)/gui/InsertDialog.h
        $(SOURCEDIR)/gui/InsertParametersDialog.h
        $(SOURCEDIR)/gui/MainFrame.h
        $(SOURCEDIR)/gui/MetadataItemPropertiesFrame.h
        $(SOURCEDIR)/gui/MultilineEnterDialog.h
        $(SOURCEDIR)/gui/PreferencesDialog.h
        $(SOURCEDIR)/gui/PrivilegesDialog.h
        $(SOURCEDIR)/gui/ProgressDialog.h
        $(SOURCEDIR)/gui/ReorderFieldsDialog.h
        $(SOURCEDIR)/gui/RestoreFrame.h
        $(SOURCEDIR)/gui/ServerRegistrationDialog.h
        $(SOURCEDIR)/gui/ServiceBaseFrame.h
        $(SOURCEDIR)/gui/ShutdownFrame.h
        $(SOURCEDIR)/gui/ShutdownStartupBaseFrame.h
        $(SOURCEDIR)/gui/SimpleHtmlFrame.h
        $(SOURCEDIR)/gui/StartupFrame.h
        $(SOURCEDIR)/gui/StatementHistoryDialog.h
        $(SOURCEDIR)/gui/StyleGuide.h
        $(SOURCEDIR)/gui/UserDialog.h
        $(SOURCEDIR)/gui/UsernamePasswordDialog.h
        $(SOURCEDIR)/gui/controls/ControlUtils.h
        $(SOURCEDIR)/gui/controls/DataGrid.h
        $(SOURCEDIR)/gui/controls/DataGridRowBuffer.h
        $(SOURCEDIR)/gui/controls/DataGridRows.h
        $(SOURCEDIR)/gui/controls/DataGridTable.h
        $(SOURCEDIR)/gui/controls/DBHTreeControl.h
        $(SOURCEDIR)/gui/controls/DndTextControls.h
        $(SOURCEDIR)/gui/controls/LogTextControl.h
        $(SOURCEDIR)/gui/controls/PrintableHtmlWindow.h
        $(SOURCEDIR)/gui/controls/TextControl.h
        $(SOURCEDIR)/metadata/CharacterSet.h
        $(SOURCEDIR)/metadata/Collation.h
        $(SOURCEDIR)/metadata/collection.h
        $(SOURCEDIR)/metadata/column.h
        $(SOURCEDIR)/metadata/constraints.h
        $(SOURCEDIR)/metadata/CreateDDLVisitor.h
        $(SOURCEDIR)/metadata/database.h
        $(SOURCEDIR)/metadata/domain.h
        $(SOURCEDIR)/metadata/exception.h
        $(SOURCEDIR)/metadata/function.h
        $(SOURCEDIR)/metadata/generator.h
        $(SOURCEDIR)/metadata/Index.h
        $(SOURCEDIR)/metadata/MetadataClasses.h
        $(SOURCEDIR)/metadata/metadataitem.h
        $(SOURCEDIR)/metadata/MetadataItemCreateStatementVisitor.h
        $(SOURCEDIR)/metadata/MetadataItemDescriptionVisitor.h
        $(SOURCEDIR)/metadata/MetadataItemURIHandlerHelper.h
        $(SOURCEDIR)/metadata/MetadataItemVisitor.h
        $(SOURCEDIR)/metadata/MetadataTemplateManager.h
        $(SOURCEDIR)/metadata/package.h
        $(SOURCEDIR)/metadata/parameter.h
        $(SOURCEDIR)/metadata/privilege.h
        $(SOURCEDIR)/metadata/procedure.h
        $(SOURCEDIR)/metadata/relation.h
        $(SOURCEDIR)/metadata/role.h
        $(SOURCEDIR)/metadata/root.h
        $(SOURCEDIR)/metadata/server.h
        $(SOURCEDIR)/metadata/table.h
        $(SOURCEDIR)/metadata/trigger.h
        $(SOURCEDIR)/metadata/User.h
        $(SOURCEDIR)/metadata/view.h
        $(SOURCEDIR)/sql/Identifier.h
        $(SOURCEDIR)/sql/IncompleteStatement.h
        $(SOURCEDIR)/sql/MultiStatement.h
        $(SOURCEDIR)/sql/SelectStatement.h
        $(SOURCEDIR)/sql/SqlStatement.h
        $(SOURCEDIR)/sql/SqlTokenizer.h
        $(SOURCEDIR)/sql/StatementBuilder.h
    </set>

    <set var="FR_PLATFORMSPECIFICSOURCES">
        <if cond="PLATFORM_UNIX=='1'">
            $(SOURCEDIR)/gui/gtk/StyleGuideGTK.cpp
        </if>
        <if cond="PLATFORM_MACOSX=='1'">
            $(SOURCEDIR)/gui/mac/StyleGuideMAC.cpp
        </if>
        <if cond="PLATFORM_WIN32=='1'">
            $(SOURCEDIR)/gui/msw/StyleGuideMSW.cpp
        </if>
    </set>

    <set var="FR_SOURCEFILES">
        $(SOURCEDIR)/addconstrainthandler.cpp
        $(SOURCEDIR)/databasehandler.cpp
        $(SOURCEDIR)/frprec.cpp
        $(SOURCEDIR)/frutils.cpp
        $(SOURCEDIR)/logger.cpp
        $(SOURCEDIR)/main.cpp
        $(SOURCEDIR)/MasterPassword.cpp
        $(SOURCEDIR)/objectdescriptionhandler.cpp
        $(SOURCEDIR)/statementHistory.cpp
        $(SOURCEDIR)/config/Config.cpp
        $(SOURCEDIR)/config/DatabaseConfig.cpp
        $(SOURCEDIR)/config/LocalSettings.cpp
        $(SOURCEDIR)/core/ArtProvider.cpp
        $(SOURCEDIR)/core/CodeTemplateProcessor.cpp
        $(SOURCEDIR)/core/FRDecimal.cpp
        $(SOURCEDIR)/core/FRError.cpp
        $(SOURCEDIR)/core/FRInt128.cpp
        $(SOURCEDIR)/core/Observer.cpp
        $(SOURCEDIR)/core/ProgressIndicator.cpp
        $(SOURCEDIR)/core/StringUtils.cpp
        $(SOURCEDIR)/core/Subject.cpp
        $(SOURCEDIR)/core/TemplateProcessor.cpp
        $(SOURCEDIR)/core/URIProcessor.cpp
        $(SOURCEDIR)/core/Visitor.cpp
        $(SOURCEDIR)/engine/MetadataLoader.cpp
        $(SOURCEDIR)/gui/AboutBox.cpp
        $(SOURCEDIR)/gui/AdvancedMessageDialog.cpp
        $(SOURCEDIR)/gui/AdvancedSearchFrame.cpp
        $(SOURCEDIR)/gui/BackupFrame.cpp
        $(SOURCEDIR)/gui/BackupRestoreBaseFrame.cpp
        $(SOURCEDIR)/gui/BaseDialog.cpp
        $(SOURCEDIR)/gui/BaseFrame.cpp
        $(SOURCEDIR)/gui/CommandManager.cpp
        $(SOURCEDIR)/gui/ConfdefTemplateProcessor.cpp
        $(SOURCEDIR)/gui/ContextMenuMetadataItemVisitor.cpp
        $(SOURCEDIR)/gui/CreateIndexDialog.cpp
        $(SOURCEDIR)/gui/DatabaseRegistrationDialog.cpp
        $(SOURCEDIR)/gui/DataGeneratorFrame.cpp
        $(SOURCEDIR)/gui/EditBlobDialog.cpp
        $(SOURCEDIR)/gui/EventWatcherFrame.cpp
        $(SOURCEDIR)/gui/ExecuteSql.cpp
        $(SOURCEDIR)/gui/ExecuteSqlFrame.cpp
        $(SOURCEDIR)/gui/FieldPropertiesDialog.cpp
        $(SOURCEDIR)/gui/FindDialog.cpp
        $(SOURCEDIR)/gui/FRLayoutConfig.cpp
        $(SOURCEDIR)/gui/FRStyle.cpp
        $(SOURCEDIR)/gui/GUIURIHandlerHelper.cpp
        $(SOURCEDIR)/gui/HtmlHeaderMetadataItemVisitor.cpp
        $(SOURCEDIR)/gui/HtmlTemplateProcessor.cpp
        $(SOURCEDIR)/gui/InsertDialog.cpp
        $(SOURCEDIR)/gui/InsertParametersDialog.cpp
        $(SOURCEDIR)/gui/MainFrame.cpp
        $(SOURCEDIR)/gui/MetadataItemPropertiesFrame.cpp
        $(SOURCEDIR)/gui/MultilineEnterDialog.cpp
        $(SOURCEDIR)/gui/PreferencesDialog.cpp
        $(SOURCEDIR)/gui/PreferencesDialogSettings.cpp
        $(SOURCEDIR)/gui/PrivilegesDialog.cpp
        $(SOURCEDIR)/gui/ProgressDialog.cpp
        $(SOURCEDIR)/gui/ReorderFieldsDialog.cpp
        $(SOURCEDIR)/gui/RestoreFrame.cpp
        $(SOURCEDIR)/gui/ServerRegistrationDialog.cpp
        $(SOURCEDIR)/gui/ServiceBaseFrame.cpp
        $(SOURCEDIR)/gui/ShutdownFrame.cpp
        $(SOURCEDIR)/gui/ShutdownStartupBaseFrame.cpp
        $(SOURCEDIR)/gui/SimpleHtmlFrame.cpp
        $(SOURCEDIR)/gui/StartupFrame.cpp
        $(SOURCEDIR)/gui/StatementHistoryDialog.cpp
        $(SOURCEDIR)/gui/StyleGuide.cpp
        $(SOURCEDIR)/gui/UserDialog.cpp
        $(SOURCEDIR)/gui/UsernamePasswordDialog.cpp
        $(SOURCEDIR)/gui/controls/ControlUtils.cpp
        $(SOURCEDIR)/gui/controls/DataGrid.cpp
        $(SOURCEDIR)/gui/controls/DataGridRowBuffer.cpp
        $(SOURCEDIR)/gui/controls/DataGridRows.cpp
        $(SOURCEDIR)/gui/controls/DataGridTable.cpp
        $(SOURCEDIR)/gui/controls/DBHTreeControl.cpp
        $(SOURCEDIR)/gui/controls/DndTextControls.cpp
        $(SOURCEDIR)/gui/controls/LogTextControl.cpp
        $(SOURCEDIR)/gui/controls/PrintableHtmlWindow.cpp
        $(SOURCEDIR)/gui/controls/TextControl.cpp
        $(SOURCEDIR)/metadata/CharacterSet.cpp
        $(SOURCEDIR)/metadata/Collation.cpp
        $(SOURCEDIR)/metadata/column.cpp
        $(SOURCEDIR)/metadata/constraints.cpp
        $(SOURCEDIR)/metadata/CreateDDLVisitor.cpp
        $(SOURCEDIR)/metadata/database.cpp
        $(SOURCEDIR)/metadata/domain.cpp
        $(SOURCEDIR)/metadata/exception.cpp
        $(SOURCEDIR)/metadata/function.cpp
        $(SOURCEDIR)/metadata/generator.cpp
        $(SOURCEDIR)/metadata/Index.cpp
        $(SOURCEDIR)/metadata/metadataitem.cpp
        $(SOURCEDIR)/metadata/MetadataItemCreateStatementVisitor.cpp
        $(SOURCEDIR)/metadata/MetadataItemDescriptionVisitor.cpp
        $(SOURCEDIR)/metadata/MetadataItemURIHandlerHelper.cpp
        $(SOURCEDIR)/metadata/MetadataItemVisitor.cpp
        $(SOURCEDIR)/metadata/MetadataTemplateCmdHandler.cpp
        $(SOURCEDIR)/metadata/MetadataTemplateManager.cpp
        $(SOURCEDIR)/metadata/package.cpp
        $(SOURCEDIR)/metadata/parameter.cpp
        $(SOURCEDIR)/metadata/privilege.cpp
        $(SOURCEDIR)/metadata/procedure.cpp
        $(SOURCEDIR)/metadata/relation.cpp
        $(SOURCEDIR)/metadata/role.cpp
        $(SOURCEDIR)/metadata/root.cpp
        $(SOURCEDIR)/metadata/server.cpp
        $(SOURCEDIR)/metadata/table.cpp
        $(SOURCEDIR)/metadata/trigger.cpp
        $(SOURCEDIR)/metadata/User.cpp
        $(SOURCEDIR)/metadata/view.cpp
        $(SOURCEDIR)/sql/Identifier.cpp
        $(SOURCEDIR)/sql/IncompleteStatement.cpp
        $(SOURCEDIR)/sql/MultiStatement.cpp
        $(SOURCEDIR)/sql/SelectStatement.cpp
        $(SOURCEDIR)/sql/SqlStatement.cpp
        $(SOURCEDIR)/sql/SqlTokenizer.cpp
        $(SOURCEDIR)/sql/StatementBuilder.cpp

        $(FR_PLATFORMSPECIFICSOURCES)
    </set>

    <set var="CONFIGOPTIONSDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/conf-defs</if>
        <if cond="FORMAT!='autoconf'">conf-defs</if>
    </set>
    <set var="CONFIGOPTIONSFILES">
        fr_settings.confdef
        db_settings.confdef
    </set>

    <set var="HTMLDOCSDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/docs</if>
        <if cond="FORMAT!='autoconf'">docs</if>
    </set>
    <set var="HTMLDOCFILES">
        fr_license.html
        fr_whatsnew.html
        html.css
    </set>

    <set var="CODETEMPLATEDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/code-templates</if>
        <if cond="FORMAT!='autoconf'">code-templates</if>
    </set>
    <set var="CODETEMPLATEFILES">
        create_trigger.confdef
        create_trigger.info
        create_trigger.template
        create_change_trigger.confdef
        create_change_trigger.info
        create_change_trigger.template
        create_selectable_execute_block.confdef
        create_selectable_execute_block.info
        create_selectable_execute_block.template
        create_selectable_procedure.confdef
        create_selectable_procedure.info
        create_selectable_procedure.template
        delete.confdef
        delete.info
        delete.template
        extract_full_ddl.info
        extract_full_ddl.template
        insert.confdef
        insert.info
        insert.template
        select.confdef
        select.info
        select.template
        template_info.confdef
        update.confdef
        update.info
        update.template
    </set>

    <set var="HTMLTEMPLATEDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/html-templates</if>
        <if cond="FORMAT!='autoconf'">html-templates</if>
    </set>
    <set var="HTMLTEMPLATEFILES">
		ALLloading.html
		COLLATION.html
		COLLATIONprivileges.html
		DATABASE.html
		DATABASEtriggers.html
		DDL.html
		dependencies.html
		DOMAIN.html
		DOMAINprivileges.html
		EXCEPTION.html
		EXCEPTIONprivileges.html
		FUNCTION.html
		FUNCTIONprivileges.html
		GENERATOR.html
		GENERATORprivileges.html
		header.html
		INDEX.html
		INDEXprivileges.html
		PACKAGE.html
		PACKAGEprivileges.html
		PROCEDURE.html
		PROCEDUREprivileges.html
		ROLE.html
		ROLEprivileges.html
		SERVER.html
		TABLE.html
		TABLEconstraints.html
		TABLEindices.html
		TABLEprivileges.html
		TABLEtriggers.html
		TRIGGER.html
		UDF.html
		UDFprivileges.html
		VIEW.html
		VIEWprivileges.html
		VIEWtriggers.html
		compute.png
		drop.png
		ok.png
		ok2.png
		redx.png
		view.png
    </set>

    <set var="RESOURCEDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/res</if>
        <if cond="FORMAT!='autoconf'">res</if>
    </set>

    <set var="SYSTEMPLATEDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/sys-templates</if>
        <if cond="FORMAT!='autoconf'">sys-templates</if>
    </set>
    <set var="SYSTEMPLATEFILES">
        browse_data.template
        execute_procedure.template
        save_as_csv.confdef
        save_as_csv.template
    </set>

    <set var="XMLSTYLEDIR">
        <if cond="FORMAT=='autoconf'">$(DOLLAR)(srcdir)/xml-styles</if>
        <if cond="FORMAT!='autoconf'">xml-styles</if>
    </set>
    <set var="XMLSTYLEFILES">
		Bespin.xml
		Black board.xml
		Choco.xml
		DansLeRuSH-Dark.xml
		DarkModeDefault.xml
		Deep Black.xml
		Hello Kitty.xml
		HotFudgeSundae.xml
		khaki.xml
		Mono Industrial.xml
		Monokai.xml
		MossyLawn.xml
		Navajo.xml
		Obsidian.xml
		Plastic Code Wrap.xml
		Ruby Blue.xml
		Solarized.xml
		Solarized-light.xml
		stylers.xml
		Twilight.xml
		Vibrant Ink.xml
		vim Dark Blue.xml
		Zenburn.xml
    </set>

    <define-tag name="mac-app-bundle" rules="exe">
        <!-- bundle directory: -->
        <set var="BUNDLE">FlameRobin.app/Contents</set>
        <set var="BUNDLE_TGT">$(BUNDLE)/PkgInfo</set>
        <set var="BUNDLE_TGT_REF">
            <if cond="PLATFORM_MACOSX=='1'">$(BUNDLE)/PkgInfo</if>
        </set>

        <set var="BUNDLE_PLIST_IN">$(DOLLAR)(srcdir)/res/flamerobin.Info.plist.in</set>
        <set var="BUNDLE_ICONS">$(DOLLAR)(srcdir)/res/flamerobin.icns</set>

        <add-target target="$(BUNDLE_TGT)" type="action"/>
        <modify-target target="$(BUNDLE_TGT)">
            <!-- required data: -->
            <depends>$(id)</depends>
            <depends-on-file>$(BUNDLE_PLIST_IN)</depends-on-file>
            <depends-on-file>$(BUNDLE_ICONS)</depends-on-file>

            <command>
                <!-- create the directories: -->
                mkdir -p $(BUNDLE)
                mkdir -p $(BUNDLE)/MacOS
                mkdir -p $(BUNDLE)/Resources
                mkdir -p $(BUNDLE)/SharedSupport
                mkdir -p $(BUNDLE)/SharedSupport/code-templates
                mkdir -p $(BUNDLE)/SharedSupport/conf-defs
                mkdir -p $(BUNDLE)/SharedSupport/docs
                mkdir -p $(BUNDLE)/SharedSupport/html-templates
				mkdir -p $(BUNDLE)/SharedSupport/sys-templates
				mkdir -p $(BUNDLE)/SharedSupport/xml-styles

                <!-- PkgInfo: -->
                echo -n "APPL????" >$(BUNDLE)/PkgInfo

                <!-- make a hardlink to the binary: -->
                ln -f $(ref("__targetdir",id))$(ref("__targetname",id)) $(BUNDLE)/MacOS/$(id)

                <!-- replace version number and year in Info.plist file -->
                sed -e "s/VERSION/`cat $(srcdir)/src/frversion.h | \
                                   awk '/FR_VERSION_MAJOR/ {ma = $$3} \
                                        /FR_VERSION_MINOR/ {mi = $$3} \
                                        /FR_VERSION_RLS/ {rls = $$3} \
                                        END {printf "%d.%d.%d", ma, mi, rls}'`/" \
                    -e "s/YEAR/`date '+%Y'`/" $(BUNDLE_PLIST_IN) > $(BUNDLE)/Info.plist

                <!-- and copy resources and icons -->
                cp -f $(BUNDLE_ICONS) $(BUNDLE)/Resources
                cp -R $(DOLLAR)(srcdir)/code-templates/* $(BUNDLE)/SharedSupport/code-templates
                cp -R $(DOLLAR)(srcdir)/conf-defs/* $(BUNDLE)/SharedSupport/conf-defs
                cp -R $(DOLLAR)(srcdir)/docs/* $(BUNDLE)/SharedSupport/docs
                cp -R $(DOLLAR)(srcdir)/html-templates/* $(BUNDLE)/SharedSupport/html-templates
				cp -R $(DOLLAR)(srcdir)/sys-templates/* $(BUNDLE)/SharedSupport/sys-templates
				cp -R $(DOLLAR)(srcdir)/xml-styles/* $(BUNDLE)/SharedSupport/xml-styles
            </command>
        </modify-target>

        <!-- add pseudo target id_bundle: -->
        <add-target target="$(id)_bundle" type="phony"
                    cond="PLATFORM_MACOSX=='1'"/>
        <modify-target target="$(id)_bundle">
            <dependency-of>all</dependency-of>
            <depends>$(BUNDLE_TGT_REF)</depends>
        </modify-target>

        <!-- "make clean" should delete the bundle: -->
        <modify-target target="clean">
            <command>rm -rf FlameRobin.app</command>
        </modify-target>
    </define-tag>

    <if cond="not (FORMAT in ['msvc6prj','msvs2008prj'])">
        <set var="REVISION_INFO_SCRIPT">
            <if cond="FORMAT=='autoconf'">cd $(DOLLAR)(srcdir) &amp;&amp; ./update-revision-info.sh</if>
            <if cond="FORMAT!='autoconf'">update-revision-info.cmd</if>
        </set>
        <action id="revision-info">
            <command>$(REVISION_INFO_SCRIPT)</command>
            <dependency-of>all</dependency-of>
        </action>
    </if>

    <exe id="flamerobin" template="fr_common,wx">
        <app-type>gui</app-type>

        <depends>ibpp</depends>

        <headers>$(FR_HEADERFILES)</headers>
        <sources>$(FR_SOURCEFILES)</sources>

        <!-- the precompiled header file is created in $(BUILDDIR), when
             the first source file is compiled - all other source files
             only *use* the PCH file -->
        <precomp-headers-header>wx/wxprec.h</precomp-headers-header>
        <precomp-headers>on</precomp-headers>
        <precomp-headers-file>$(id)</precomp-headers-file>
        <precomp-headers-gen>$(SOURCEDIR)/frprec.cpp</precomp-headers-gen>

        <define>$(IBPPPLATFORMDEFINE)</define>
        <include>.</include>
        <if cond="FORMAT=='autoconf'">
            <include>$(DOLLAR)(srcdir)/src</include>
            <include>$(DOLLAR)(srcdir)/src/ibpp</include>
            <include>$(DOLLAR)(srcdir)/res</include>
            <set var="__win32rc_flags" append="1">@WX_INCLUDES@</set>
        </if>
        <if cond="FORMAT!='autoconf'">
            <include>./src</include>
            <include>./src/ibpp</include>
            <include>./res</include>
        </if>

        <win32-res>$(RESDIR)/flamerobin.rc</win32-res>
        <library>ibpp</library>

        <if cond="FORMAT=='autoconf'">
            <mac-app-bundle>$(id)</mac-app-bundle>
        </if>
    </exe>

<!-- install FlameRobin executable -->

    <if cond="FORMAT=='autoconf'">
        <script-files>
            <srcdir>$(BUILDDIR)</srcdir>
            <files>flamerobin$(EXEEXT)</files>
            <install-to>$(BINDIR)</install-to>
        </script-files>

        <data-files>
            <srcdir>$(CODETEMPLATEDIR)</srcdir>
            <files>$(CODETEMPLATEFILES)</files>
            <install-to>$(DATADIR)/flamerobin/code-templates</install-to>
        </data-files>
        <data-files>
            <srcdir>$(CONFIGOPTIONSDIR)</srcdir>
            <files>$(CONFIGOPTIONSFILES)</files>
            <install-to>$(DATADIR)/flamerobin/conf-defs</install-to>
        </data-files>
        <data-files>
            <srcdir>$(HTMLDOCSDIR)</srcdir>
            <files>$(HTMLDOCFILES)</files>
            <install-to>$(DATADIR)/flamerobin/docs</install-to>
        </data-files>
        <data-files>
            <srcdir>$(HTMLDOCSDIR)</srcdir>
            <files>flamerobin.1</files>
            <install-to>@mandir@/man1</install-to>
        </data-files>
        <data-files>
            <srcdir>$(HTMLTEMPLATEDIR)</srcdir>
            <files>$(HTMLTEMPLATEFILES)</files>
            <install-to>$(DATADIR)/flamerobin/html-templates</install-to>
        </data-files>
        <data-files>
            <srcdir>$(RESOURCEDIR)</srcdir>
            <files>flamerobin.desktop</files>
            <install-to>$(DATADIR)/applications</install-to>
        </data-files>
        <data-files>
            <srcdir>$(RESOURCEDIR)</srcdir>
            <files>flamerobin.png</files>
            <install-to>$(DATADIR)/pixmaps</install-to>
        </data-files>
        <data-files>
            <srcdir>$(SYSTEMPLATEDIR)</srcdir>
            <files>$(SYSTEMPLATEFILES)</files>
            <install-to>$(DATADIR)/flamerobin/sys-templates</install-to>
        </data-files>
        <data-files>
            <srcdir>$(XMLSTYLEDIR)</srcdir>
            <files>$(XMLSTYLEFILES)</files>
            <install-to>$(DATADIR)/flamerobin/xml-styles</install-to>
        </data-files>
    </if>


<!-- build IBPP library -->

    <set var="IBPP_HEADERFILES">
        $(SOURCEDIR)/firebird/constants.h
        $(SOURCEDIR)/firebird/include/ibase.h
        $(SOURCEDIR)/firebird/include/iberror.h
        $(SOURCEDIR)/firebird/include/firebird/impl/blr.h
        $(SOURCEDIR)/firebird/include/firebird/impl/consts_pub.h
        $(SOURCEDIR)/firebird/include/firebird/impl/dsc_pub.h
        $(SOURCEDIR)/firebird/include/firebird/impl/inf_pub.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg_helper.h
        $(SOURCEDIR)/firebird/include/firebird/impl/sqlda_pub.h
        $(SOURCEDIR)/firebird/include/firebird/impl/types_pub.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/all.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/dsql.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/dyn.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/fbsvcmgr.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/fbtracemgr.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/gbak.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/gfix.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/gsec.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/gstat.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/isql.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/jrd.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/jrd_bugchk.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/nbackup.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/sqlerr.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/sqlwarn.h
        $(SOURCEDIR)/firebird/include/firebird/impl/msg/utl.h
        $(SOURCEDIR)/ibpp/_ibpp.h
        $(SOURCEDIR)/ibpp/ibpp.h
    </set>

    <set var="IBPP_SOURCEFILES">
        $(SOURCEDIR)/ibpp/_dpb.cpp
        $(SOURCEDIR)/ibpp/_ibpp.cpp
        $(SOURCEDIR)/ibpp/_ibs.cpp
        $(SOURCEDIR)/ibpp/_rb.cpp
        $(SOURCEDIR)/ibpp/_spb.cpp
        $(SOURCEDIR)/ibpp/_tpb.cpp
        $(SOURCEDIR)/ibpp/array.cpp
        $(SOURCEDIR)/ibpp/blob.cpp
        $(SOURCEDIR)/ibpp/database.cpp
        $(SOURCEDIR)/ibpp/date.cpp
        $(SOURCEDIR)/ibpp/dbkey.cpp
        $(SOURCEDIR)/ibpp/events.cpp
        $(SOURCEDIR)/ibpp/exception.cpp
        $(SOURCEDIR)/ibpp/ibint128.cpp
        $(SOURCEDIR)/ibpp/row.cpp
        $(SOURCEDIR)/ibpp/service.cpp
        $(SOURCEDIR)/ibpp/statement.cpp
        $(SOURCEDIR)/ibpp/time.cpp
        $(SOURCEDIR)/ibpp/transaction.cpp
        $(SOURCEDIR)/ibpp/user.cpp
    </set>

    <lib id="ibpp" template="fr_common">
        <headers>$(IBPP_HEADERFILES)</headers>
        <sources>$(IBPP_SOURCEFILES)</sources>

        <!-- the precompiled header file is created in $(BUILDDIR), when
             the first source file is compiled - all other source files
             only *use* the PCH file -->
        <precomp-headers-header>_ibpp.h</precomp-headers-header>
        <precomp-headers>on</precomp-headers>
        <precomp-headers-file>$(id)</precomp-headers-file>
        <precomp-headers-gen>$(SOURCEDIR)/ibpp/_ibpp.cpp</precomp-headers-gen>

        <define>$(IBPPPLATFORMDEFINE)</define>
        <if cond="FORMAT=='autoconf'">
            <include>$(DOLLAR)(srcdir)/src/ibpp</include>
        </if>
        <if cond="FORMAT!='autoconf'">
            <include>./src/ibpp</include>
        </if>
    </lib>

</makefile>
