⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmake_documentation.html

📁 利用XML来作为Makefile的make工具源代码.
💻 HTML
📖 第 1 页 / 共 2 页
字号:

        <p>Besides the above attributes, the configuration also has the

        following sub tags:</p>

        <ul>

          <li><code>includes</code> - The includes section informs <code> xmake</code> of

            where to look for include files not in the current directory. This

            is used during the dependency scan for source files.&nbsp;

          <li><code>tools</code> - The tools sections allows you to specify

            special build tools for build source files that are not able to be

            compiled using the <code><samp>compiler</samp></code> and <code>linker</code>

            in the configuration.

          <li><code>compiler</code> - This specifies the compiler used to

            compile source files (unless the source file specifies another <code>tool</code>).

          <li><code>linker</code> -&nbsp;This specifies the linker used to

            create the final project binary.&nbsp;

          <li><code>preBuild</code> - not implemented yet.

          <li><code>postBuild</code> - not implemented yet.</li>

        </ul>

        <p>&nbsp;</p>

        <h4><code>&lt;includes&gt;</code></h4>

        <p>This allows you to specify a set of directories to look in when

        resolving dependencies for what to build. Each include directory

        requires an include tag. Each include tag has a single attribute:</p>

        <ul>

          <li><code>path</code> - Where path is a directory path that will get

            added to the list of directory paths to search for when determining

            dependencies.</li>

        </ul>

        <p>An example looks something like this:</p>

        <pre>&lt;includes&gt;
	&lt;include path=&quot;../../MyDir/includes&quot;/&gt;
&lt;/includes&gt;

.... more stuff follows</pre>

        <p>By default the directory where the source file lives is search in the

        dependency check.</p>

        <p>&nbsp;</p>

        <h4><code>&lt;tools&gt;</code></h4>

        <p>&nbsp;The tools tag allows you to specify 0 or more tools that can be

        used to build a specific type of file. The association of tool to a

        source file is done with a source's &quot;tool&quot; attribute&nbsp;

        having the same value as the tool's &quot;id&quot; attribute. Each tool

        is described in a &lt;tool&gt; tag with the following attributes:</p>

        <ul>

          <li><code>name</code> - the name of the tool executable, such as

            &quot;rc.exe&quot;. You can specify a full or relative path.</li>

          <li><code>id</code> - the text name of the tool. This is the name that

            the various source entries will refer to the tool as. It can be

            anything you want, so long as you consistently refer to it.</li>

        </ul>

        <p>Each tool tag can have flags associated with it. This is done by

        using the &lt;flags&gt; tag to indicate the collection, and then a

        &lt;flag&gt; sub tag. Each flag has the following attributes:</p>

        <ul>

          <li>value - the text parameters you want to pass to the tool</li>

        </ul>

        <p>The flags are then appended to on another to create a command line

        that is then sent to the tool when needed. </p>

        <p>An example looks something like this:</p>

        <pre>&lt;tools&gt;
	&lt;tool name=&quot;rc.exe&quot; id=&quot;rc&quot; &gt; &lt;!-- here we are using just the resource compilers file name, 
                                            assuming it can be found on the system path --&gt;
        	&lt;flags&gt;
			&lt;flag value=&quot;/i'..\..\MyResIncludes' \d '_DEBUG'&quot;/&gt;
		&lt;/flags&gt;
	&lt;/tool&gt;        
&lt;/tools&gt;
.... more stuff follows</pre>

        <p>&nbsp;</p>

        <h4><code>&lt;compiler&gt;</code></h4>

        <p>The compiler tag allows you to specify the executable to use as your
        compiler (for a given configuration) and a set of flags to send to the
        compiler when processing source files.&nbsp; The compiler tag has only a
        single attribute:</p>

        <ul>
          <li>name - the relative or full path name to the executable to use for
            compiling source files. If the name is just the short name (i.e.
            &quot;cl.exe&quot;), then it is assumed that it can be found on the
            system path.</li>
        </ul>
        <p>The compiler can have flags associated with it. This is done by

        using the &lt;flags&gt; tag to indicate the collection, and then a

        &lt;flag&gt; sub tag. Each flag has the following attributes:</p>

        <ul>

          <li>value - the text parameters you want to pass to the compiler</li>

        </ul>

        <p>The flags are then appended to on another to create a command line

        that is sent to the compiler when it is invoked for each source file.</p>

        <p>An example looks something like this:</p>

        <pre>&lt;compiler name=&quot;cl&quot;&gt;
	&lt;flags&gt;
		&lt;flag value=&quot;/I $(INC)&quot;/&gt;
		&lt;flag value=&quot;/nologo /MDd /W3 /Gm /GR /GX /ZI /Od&quot;/&gt;
		&lt;flag value=&quot;/D WIN32 /D _DEBUG /D _CONSOLE /D _MBCS /D FRAMEWORK_DLL /D FRAMEWORK_EXPORTS&quot;/&gt;
		&lt;flag value=&quot;/c&quot;/&gt;
	&lt;/flags&gt;
&lt;/compiler &gt;

.... more stuff follows</pre>

        <p>Note the use of the variable <code>INC</code> in the first flag. Also
        note that you could have just as easily put everything in one flag, but
        breaking it up makes it easier to read for others.</p>

        <p>Please note: Use single quote's where you would use						double quotes.
        Single quote characters will be expanded to double quote when the string is parsed and prepared to send to the						compiler.&nbsp;</p>

        <p>&nbsp;</p>

        <h4><code>&lt;linker&gt;</code></h4>

        <p>The linker tag allows you to specify the executable to use as your
        linker (for a given configuration) and a set of flags to send to the
        linker when linking all the compiler object code.&nbsp; The linker tag
        has only a single attribute:</p>

        <ul>
          <li>name - the relative or full path name to the executable to use for
            linking object files. If the name is just the short name (i.e.
            &quot;link.exe&quot;), then it is assumed that it can be found on
            the system path.</li>
        </ul>
        <p>The linker can have flags associated with it. This is done by

        using the &lt;flags&gt; tag to indicate the collection, and then a

        &lt;flag&gt; sub tag. Each flag has the following attributes:</p>

        <ul>

          <li>value - the text parameters you want to pass to the linker&nbsp;</li>

        </ul>

        <p>The flags are then appended to on another to create a command line

        that is sent to the linker when it is invoked to build the final binary
        image for the project.</p>

        <p>An example looks something like this:</p>

        <pre>&lt;linker name=&quot;link.exe&quot;&gt;
	&lt;flags&gt;
		&lt;flag value=&quot;/nologo&quot;/&gt;
		&lt;flag value=&quot;/subsystem:console&quot;/&gt;					
		&lt;flag value=&quot;/incremental:yes&quot;/&gt;
		&lt;flag value=&quot;/pdb:'Debug/xmake.pdb'&quot;/&gt;
		&lt;flag value=&quot;/debug&quot;/&gt;
		&lt;flag value=&quot;/machine:I386&quot;/&gt;
		&lt;flag value=&quot;/out:'Debug/xmake.exe'&quot;/&gt;
		&lt;flag value=&quot;/pdbtype:sept&quot;/&gt;		
	&lt;/flags&gt;
&lt;/linker&gt;

.... more stuff follows</pre>

        <p>Please note: Use single quote's where you would use						double quotes.
        Single quote characters will be expanded to double quote						when the string is parsed and prepared to send to the
        linker .&nbsp;</p>

        <p>&nbsp;</p>

        <h4><code>&lt;preBuild&gt;</code></h4>

        <p>Currently this is not implemented yet. When it is, it will allow you
        to specify a series of command line actions to execute <b><i>prior</i></b>
        to the compile phase of the build process. preBuild is part of the
        configuration tag and is thus associated with a specific
        configuration.&nbsp;</p>

        <p>The proposed syntax will probably look something like this:</p>

        <pre>&lt;prebuild&gt;
	&lt;exec commandLine=&quot;copy Foo.cpp ../../outputSrc&quot;/&gt;
	&lt;!-- ...other commands --&gt;
&lt;/prebuild&gt;

.... more stuff follows</pre>

        <p>&nbsp;</p>

        <h4><code>&lt;postBuild&gt;</code></h4>

        <p>Currently this is not implemented yet. When it is, it will allow you
        to specify a series of command line actions to execute <b><i>after</i></b>
        the link phase of the build process. postBuild is part of the
        configuration tag and is thus associated with a specific
        configuration.&nbsp;</p>

        <p>The proposed syntax will probably look something like this:</p>

        <pre>&lt;postbuild&gt;
	&lt;!-- in this example we use doxygen to autogenerate
		source documentation--&gt;
	&lt;exec commandLine=&quot;doxygen ../../help/Doxyfile&quot;/&gt; 
	&lt;!-- ...other commands --&gt;
&lt;/postbuild&gt;

.... more stuff follows</pre>

        <p>&nbsp;</p>

        <h4><code>&lt;sources&gt;</code></h4>

        <p>After the configurations are all specified you list you source files
        that are required to build your project. The sources tag is a collection
        of 1 or more source sub tags, with each source sub tag representing an
        individual source file to build. The source tag has the following
        attributes:</p>

        <ul>
          <li><code>name</code> - this is the name of the source file, relative
            to the directory where the project is being built. This attribute is
            required.</li>
          <li><code>partOfConfig</code> -&nbsp;this indicates which
            configuration the source file will compile under. The name of the
            configuration <b><i>must</i></b> exactly match the name of the
            configuration specified in one of the config sections that was
            defined earlier in the makefile. If the source file can be compiled
            under multiple configurations, then each configuration name must be
            separated by the &quot;|&quot; character. This attribute is
            required.&nbsp;</li>
          <li><code>build</code> -&nbsp;indicates whether the file should even
            be built for this configuration. The possible values for this
            attribute are &quot;yes&quot; or &quot;no&quot;. This attribute is
            optional. If you do not specify this then it defaults to
            &quot;yes&quot;, meaning the file will be compiled.</li>
          <li><code>outputAs</code> -&nbsp;this tells <code>xmake</code> where
            the compiled object file should go. This will override the settings
            in the compiler flags. Generally you want the two to match. By
            specifying this <code>xmake</code> knows where to go to clean up the
            object files during a &quot;clean&quot;. This attribute is optional.
            If you do not specify this then it defaults to the directory where
            the project's makefile is. When specifying the name of the output
            file you can leave off the extension (like foo.o or baz.obj) and
            xmake will determine the proper extension from the configuration's <code>srcBinaryExt</code> 
            attribute.&nbsp;</li>
          <li><code>tool</code> - tells <code>xmake</code> that the source file
            is not compiled using the default compiler, instead it is to be
            &quot;compiled&quot; using the tool whose <code>id</code> attribute
            matches this attribute's value. The two values must match exactly.
            If a tool does not exist in the makefile with a matching <code>id</code>
            attribute then the source file is not compiled. This attribute is
            required.&nbsp; </li>
        </ul>
        <p>An example looks something like this:</p>

        <pre>&lt;sources&gt;
	&lt;source name=&quot;Test1Make.rc&quot; partOfConfig=&quot;VC++ Debug&quot; outputAs=&quot;Debug/Test1Make.res&quot; tool=&quot;rc&quot;/&gt;
	&lt;source name=&quot;StdAfx.cpp&quot; partOfConfig=&quot;VC++ Debug&quot; /&gt;
	&lt;source name=&quot;MainFrm.cpp&quot; partOfConfig=&quot;VC++ Debug&quot; outputAs=&quot;Debug/MainFrm.obj&quot;/&gt;
	&lt;source name=&quot;ChildView.cpp&quot; partOfConfig=&quot;VC++ Debug&quot; outputAs=&quot;Debug/ChildView.obj&quot;/&gt;
	&lt;source name=&quot;Test1Make.cpp&quot; partOfConfig=&quot;VC++ Debug&quot; outputAs=&quot;Debug/Test1Make.obj&quot;/&gt;						
&lt;/sources&gt;</pre>

        <p>Note the use of the tool attribute in the first source tag.</p>
        <p>&nbsp;</p>
        <h3>Building and installing <code>xmake</code></h3>
        <p>You can get <code>xmake</code> from <a href="http://sourceforge.net/projects/vcf">here</a>
        at the Source Forge VCF project page. You can build for Win32 systems
        using the VC++ workspace that is included. Alternately it can be built
        using GCC on 'nix systems using the traditional <code>configure</code>, <code>make</code>,
        <code>make install</code> commands (a configure and Makefile are
        provided for this). </p>
        <p>It has been built and tested on Windows 2000, Windows NT sp4 (it is a
        fairly simple command line tool so it should work fine in Windows 98 and
        Windows XP), linux 2.4 (RH7.1 distro), SparcStation with Solaris 8
        (2.8), and I have heard it runs on MacOSX and VMS but I have not
        personally verified this. </p>
        <p>To install it under Win32 systems just put the executable where you
        want, preferably someplace that is on your system path. For 'nix systems
        the <code>make install</code> command will put it in <code>/usr/bin</code>,
        or you can place it somewhere else if you want.</p>
        <p>&nbsp;</p>


<!-------------------------------    That's it!   --------------------------->
<p>&nbsp;</p>

</body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -