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

📄 tmake.html

📁 很不错的QT资料,大家有空看看啊
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!doctype HTML public "-//W3C//DTD HTML 3.2//EN"><html><head><title>User's Guide - tmake</title></head><body bgcolor="#ffffff"><p><h1 align=center>User's Guide - tmake</h1><hr><h2>Introduction</h2>UPDATE: tmake is no longer actively maintained and updated by theoriginal author.  We recommended that you instead use qmake,which is compatible with tmake but runs faster and is more flexible.qmake ships with Qt 3.0 and later.  <p>tmake is an easy-to-use tool from Trolltech to create and maintainmakefiles for software projects.  It can be a painful task to managemakefiles manually, especially if you develop for more than one platformor use more than one compiler.  tmake automates and streamlines thisprocess and lets you spend your valuable time on writing code, notmakefiles.<p>Our main motivation for developing tmake was that we spent far too muchtime maintaining makefiles for <a href="http://www.trolltech.com/qt/">Qt</a>,our cross-platform GUI toolkit. Qt supports around 15 flavors of Unix,Microsoft Windows, and around 15 different C++ compilers.  We looked atGNU autoconf, but it was Unix-specific and not flexible enough in ouropinion. Our makefile system also had to deal with Qt <ahref="http://doc.trolltech.com/metaobjects.html">meta object compiler</a>(moc) issues. The moc program extracts meta information from C++ files andgenerates a C++ file with data tables etc.  It takes extra work to addmakefile rules for the moc and wanted to automate this task.<p>tmake is written in Perl and requires that you have installed perl version5 or newer. Basic use of tmake requires no perl knowledge, but if you knowperl you can extend tmake and write your own makefile templates.<p><b>Windows users:</b> The tmake distribution for Win32 includes tmake.exe(built by the perl2exe utility) and you do not need to download andinstall perl unless you want to modify the tmake source code or run otherperl scripts.  You can download perl for Win32 (Windows NT and 95) from <ahref="http://www.activestate.com">www.activestate.com</a><p>tmake is free software and you may use, copy, modify and distribute tmakeand its documentation for any purpose and without any fee.  See theLICENSE file for details.<hr><h2>Installation</h2><ol><li>Make sure you have perl version 5 or later installed (optionalfor Windows users).<li>Unpack the tmake tar.gz archive for Unix or the tmake .zip file for Windows.<li>Set the TMAKEPATH environment variable to the directoriescontaining the template files (see below).<li>Add the tmake/bin directory to your PATH.</ol>Here are some examples:<p><strong>Unix Bourne shell:</strong><pre>    TMAKEPATH=/local/tmake/lib/linux-g++    PATH=$PATH:/local/tmake/bin    export TMAKEPATH PATH</pre><strong>Unix C shell:</strong><pre>    setenv TMAKEPATH /local/tmake/lib/linux-g++    setenv PATH $PATH:/local/tmake/bin</pre><strong>Microsoft Windows:</strong><pre>    set TMAKEPATH=c:\tmake\lib\win32-msvc    set PATH=%PATH%;c:\tmake\bin</pre><p>The template directory name has the form <em>platform</em>-<em>compiler</em>and contains a platform configuration file (tmake.conf) and tmake templatefiles.<p>Supported platforms: AIX, Data General, FreeBSD, HPUX, SGI Irix, Linux,NetBSD, OpenBSD, OSF1/DEC, SCO, Solaris, SunOS, Ultrix, Unixware andWin32.<p>You can find your platform-compiler combination in the <tt>tmake/lib</tt>.<p><b>Unix users:</b> tmake requires that perl is in /usr/bin. If yourversion of perl is elsewehere, either change the first line of tmake ormake a small shell script which invokes tmake with the correct perl.<hr><h2>Getting Started</h2>Let's assume you have a small Qt application consisting of one C++ headerfile and two source files.First you need to create a tmake project file, e.g. hello.pro:<pre>  HEADERS   =  hello.h  SOURCES   =  hello.cpp main.cpp  TARGET    =  hello</pre>Then run tmake to create a Makefile:<pre>  tmake hello.pro -o Makefile</pre>And finally:<pre>  make</pre>This builds the hello program. Remember to set the <code>TMAKEPATH</code>environment variable before you run tmake.<p>See <a href="m-linux-gcc.html">Makefile for Linux/g++</a>.<br>See <a href="m-win32-msvc.html">Makefile for Win32/msvc</a>(Microsoft Visual C++).<br><hr><h2>Makefile Templates</h2>The tmake distribution includes three makefile templates and oneconfiguration file for each platform/compiler combination.  The<code>TMAKEPATH</code> environment variable tells tmake where to findthese files:<p><table border="0">    <tr>        <td>&nbsp;</td>        <td>app.t</td>        <td>&nbsp;</td>        <td>Creates a makefile for building applications.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>lib.t</td>        <td>&nbsp;</td>        <td>Creates a makefile for building libraries.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>subdirs.t</td>        <td>&nbsp;</td>        <td>Creates a makefile for building targets in subdirectories.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>tmake.conf</td>        <td>&nbsp;</td>        <td>This configuration file contains compiler options and lists	    tools and libraries.    </tr></table><p>The hello.pro project file above does not have a <code>TEMPLATE</code> ora <code>CONFIG</code> variable.  The default template is <tt>app</tt> (the .textension is optional) and the default configuration is <tt>qt warn_onrelease</tt>.This project file produces exactly the same result as the hello.proabove:<pre>  TEMPLATE =  app  CONFIG   =  qt warn_on release  HEADERS  =  hello.h  SOURCES  =  hello.cpp main.cpp  TARGET   =  hello</pre><h4>Makefile Configuration</h4><p>The <code>CONFIG</code> variable is recognized by both the app.t and lib.ttemplates and specifies what compiler options to use and which extralibraries to link in.These options control the compilation flags:<p><table border="0">  <tr>    <td>&nbsp;</td>    <td>release</td>    <td>&nbsp;</td>    <td>Compile with optimization enabled, ignored if    "debug" is specified.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>debug</td>    <td>&nbsp;</td>    <td>Compile with debug options enabled.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>warn_on</td>    <td>&nbsp;</td>    <td>The compiler should emit more warnings than normally, ignored if     "warn_off" is specified.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>warn_off</td>    <td>&nbsp;</td>    <td>The compiler should emit no warnings or as few as possible.</td>  </tr></table><p>These options defines the application/library type:<p><table border="0">  <tr>    <td>&nbsp;</td>    <td>qt</td>    <td>&nbsp;</td>    <td>The target is a Qt application/library and requires Qt header     files/library.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>opengl</td>    <td>&nbsp;</td>    <td>The target requires the OpenGL (or Mesa) headers/libraries.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>thread</td>    <td>&nbsp;</td>    <td>The target is a multi-threaded application or library.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>x11</td>    <td>&nbsp;</td>    <td>The target is a X11 application or library.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>windows</td>    <td>&nbsp;</td>    <td>The target is a Win32 window application (app.t only).</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>console</td>    <td>&nbsp;</td>    <td>The target is a Win32 console application (app.t only).</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>dll</td>    <td>&nbsp;</td>    <td>The target is a shared object/DLL.</td>  </tr>  <tr>    <td>&nbsp;</td>    <td>staticlib</td>    <td>&nbsp;</td>    <td>The target is a static library (lib.t only).</td>  </tr></table><p>As an example, if the hello application uses both Qt and OpenGL and youwant to compile it for debugging, your <code>CONFIG</code> line shouldread:<pre>  CONFIG = qt opengl debug</pre><p>The most common tmake options and project variables are described here.See the tmake <a href="tmake_ref.html">reference manual</a> fordetails.<p><h4>The Application Template</h4>The application template, app.t, lets you compile and link executableprograms or shared objects (DLLs).This template recognizes several variables.<p><table border="0">    <tr>        <td>&nbsp;</td>        <td>HEADERS</td>        <td>&nbsp;</td>        <td>Header files.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>SOURCES</td>        <td>&nbsp;</td>        <td>Source files.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>TARGET</td>        <td>&nbsp;</td>        <td>Name of executable (adds .exe if on Windows).</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>DESTDIR</td>        <td>&nbsp;</td>        <td>Where to put the target.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>DEFINES</td>        <td>&nbsp;</td>        <td>Tell compiler to define C preprocessor macros (-D option).</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>INCLUDEPATH</td>        <td>&nbsp;</td>        <td>Sets the include file search path for the compiler (-I        option).	</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>DEPENDPATH</td>        <td>&nbsp;</td>        <td>Sets the dependency search path for tmake.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>DEF_FILE</td>        <td>&nbsp;</td>        <td>Win32 only: Link with a .def file.</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>RC_FILE</td>        <td>&nbsp;</td>        <td>Win32 only: Use a .rc file (compile to temporary .res).	</td>    </tr>    <tr>        <td>&nbsp;</td>        <td>RES_FILE</td>        <td>&nbsp;</td>        <td>Win32 only: Link with a .res file.	</td>    </tr></table><p><h4>The Library Template</h4>The library template, lib.t, lets you compile and create static or sharedlibraries.<p>

⌨️ 快捷键说明

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