<?xml version="1.0" ?>

<!--

Bakefile XRC support; included by wx.bkl, do not include directly.

Usage:

<exe id="myapp" template="wxgui,simple">
    ...
    <sources>...</sources>
    ...
    <xrc-file>myapp.xrc</xrc-file>
    <xrc-file>file2.xrc</xrc-file>
</exe>

Then in application code, you have to call initialization for every XRC
file:

    InitXMLResource_myapp();
    InitXMLResource_file2();

-->

<makefile>

    <!-- XRC section -->
    <option name="WXRC" category="path">
        <description>Path to find the wxrc executable.</description>
        <default-value>wxrc</default-value>
    </option>


    <define-tag name="xrc-file" rules="exe,dll,lib">
        <set var="_xrc_file">$(value)</set>
        <set var="_xrc_cpp">$(value.replace('.xrc', '_xrc.cpp'))</set>
        <set var="_xrc_base">$(value[value.rfind('/')+1:value.rfind('.')])</set>
        <set var="_wxrc_options">-c -n InitXMLResource_$(_xrc_base)</set>

        <sources>$(_xrc_cpp)</sources>
        <if cond="FORMAT not in ['msvs2003prj','msvs2005prj']">
            <clean-files>$(_xrc_cpp)</clean-files>
            <add-target target="$(_xrc_cpp)" type="action"/>
            <modify-target target="$(_xrc_cpp)">
                <set var="_xrc">$(_xrc_file)</set>
                <depends-on-file>$(SRCDIR)/$(_xrc)</depends-on-file>
                <command>
                    $(WXRC) $(_wxrc_options) -o $(_xrc_cpp) $(_xrc)
                </command>
            </modify-target>
        </if>
        <if cond="FORMAT in ['msvs2003prj','msvs2005prj']">
            <sources>$(_xrc_file)</sources>
            <!--
                A hack to add XRC compilation step to MSVC projects.

                NB: it's important to use backslashes and not slashes here.
             -->
             <set var="_custom_build_files" append="1">$(_xrc_file.replace('/','\\'))</set>
            <set var="_custom_build_$(_xrc_file.replace('/','_').replace('.','_'))">
Compiling XRC resources: $(_xrc_file)...
InputPath=$(_xrc_file)

"$(_xrc_cpp.replace('/','\\'))" : "$(DOLLAR)(INTDIR)"
$(TAB)$(WXRC) $(_wxrc_options) -o $(_xrc_cpp) $(_xrc_file)
            </set>
        </if>

    </define-tag>

</makefile>
