Reprinted from http://blog.csdn.net/adriano119/article/details/5878169
In Qt, there is a tool qmake can generate a makefile file, it is generated by the. Pro file, the following is the wording of the. Pro File: Comments
Start with "#" and end up in this line.
2. The template variable tells Qmake what kind of makefile to generate for this application. Here are the options to use:
TEMPLATE = App
A> App-Build an app for makefile. This is the default value, so if the template is not specified, this will be used.
B> Lib-Build a library of makefile.
C> Vcapp-Build an application's VisualStudio project file.
D> vclib-Create a library of VisualStudio project files.
E> Subdirs-This is a special template that creates a makefile that can go into a specific directory and generate makefile for a project file and call make for it. Specifies the directory where the generated application is placed
DESTDIR + =. /bin specifying the generated application name
TARGET = Pksystem configuration information
Config is used to tell Qmake about application configuration information.
config+= QT warn_on Release
The use of "+ =" Here is because we add our configuration options to any one that already exists. This is more secure than replacing all the options that have been specified with "=".
The a> qt section tells Qmake that the app is connected using QT. This means that Qmake takes into account the QT library when connecting and adding the required include paths for compilation.
The b> warn_on section tells Qmake to set the compiler to output warning messages.
The C> release section tells the Qmake application to be connected to a published application. During the development process, the programmer can also use debug to replace the release designated UIC command to convert the. ui file into a stored directory of ui_*.h files
Ui_dir + = Forms Specifies the storage directory for the RCC command to convert. qrc files to qrc_*.h files
Rcc_dir + =. /tmp Specifies the MOC command to convert the header file containing q_object to the standard. h file storage directory
Moc_dir + =. /tmp Specifies the storage directory for the target file (obj)
Objects_dir + =. dependent path for the/TMP program compile-time dependency
Dependpath + =. Forms include QRC sources header file contains path
Includepath + =. Qmake, the information generated when the
A reads the string of variable a ","
(path) Read environment variable PATH " message ($$ (path)) Source file encoding method
CODECFORSRC = header file included in the GBK project
HEADERS + = Include/painter.h project included in the. UI design File
FORMS + = Forms/painter.ui source files included in the project
SOURCES + = sources/main.cpp sources/painter.cpp resource files included in the project
RESOURCES + = QRC/PAINTER.QRC
LIBS + = L FolderPath//The path of the introduced Lib file-L: Introduction Path
Release:libs + =-l FolderPath//release version introduced LIB file path
Debug:libs + =-L FolderPath//Debug version introduced LIB file path
Defines + = XX_XX_XXX//define compilation options that can be used in the. h file: #ifdefine xx_xx_xxx
Rc_file = Xxx.icns Platform Dependency processing
What we need to do here is to use the appropriate scopes for processing based on the platform that Qmake is running on. The simple scope of the platform-dependent files added for the Windows platform looks like this:
Win32 {
SOURCES + = Hello_win.cpp }
When you've created your project file, it's easy to build makefile, all you have to do is go to the project file you generated and type it in:
Makefile can be generated like this by a ". Pro" File:
Qmake-omakefile Hello.pro
For VisualStudio users, Qmake can also generate a ". DSP" file, for example:
Qmake-tvcapp-o HELLO.DSP Hello.pro
++++++++++++++++++++++++ A pro file instance ++++++++++++++++++++++++++++++++++++++++
TEMPLATE = App #模块配置
LANGUAGE = C + + #C + + language
CONFIG + = qt warn_on Debug Release introduced LIB file for the introduction of dynamic link Libraries
LIBS + = Qaxcontainer.lib header file contains path
Includepath + =. /.. /qtcompnent/qtchklisten/inc. /.. /qtcompnent/qtclearfile/inc. /.. /validator/inc/validerrcode. /.. /qtcompnent/qtdir/inc. /inc. /.. /utillib/inc/xmlapi. /.. /utillib/inc/util. /.. /xercesc. /.. /qtcompnent/qteditor/inc. /.. /qtcompnent/qtfunreview/inc. /.. /qtcompnent/qttable/inc. /.. /qtcompnent/qtversion/inc. /.. /qtcompnent/qtini/inc. /.. /icdtool/icdservices/inc. /.. /icdtool/dataset/inc. /.. /icdtool/doi/inc. /.. /icdtool/reportcontrol/inc. /.. /icdtool/gseconctrol/inc. /.. /icdtool/inputs/inc. /.. /icdtool/smvconctrol/inc. /.. /icdtool/logcontrol/inc. /.. /scdpreview/inc/scdpreviewtoollib. /.. /scdpreview/form. /.. /icdtool/sclcontrol/inc. /.. /icdtool/log/inc. /.. /icdtool/settingcontrol/inc. /.. /qtcompnent/qteditor/inc. /.. /qtcompnent/qttreeview/inc. /.. /qtcompnent/qttabwidget/inc. /.. /communication/inc. /.. /qtcompnent/qtabout/inc. /iedmanage/inc. /ldmanage/inc. /foriecrun/inc. /.. /qtcompnent/validset/inc header files included in the project
HEADERS + =. /inc/exportstable.h/
.. /inc/maintabwidget.h/
.. /inc/outputtab.h/
.. /inc/strutil.h/
.. /inc/treeeditview.h/
.. /inc/mainform.h/
.. /inc/recenfileini.h/
.. /inc/exportcidfunction.h The source files included in the project
SOURCES + =. /src/main.cpp/
.. /src/exportstable.cpp/
.. /src/maintabwidget.cpp/
.. /src/outputtab.cpp/
.. /src/treeeditview.cpp/
.. /src/mainform.cpp/
.. /src/recenfileini.cpp/
.. /src/exportcidfunction.cpp . UI design files included in the project
FORMS =.. /form/scdmainform.ui/
.. /form/exportiedform.ui/
.. /form/exportsedform.ui/
.. /form/importsedform.ui/
.. /form/formiminputs.ui image File
IMAGES = images/substation.png/
Images/communication.png/
Images/autocom.png/
Images/reportcfg.png/
Images/comcfg.png/
Images/filetrans.png/
Images/review.png/
Images/setting.png resource files included in the project
RESOURCES = SCINTILLA.QRC CONFIG-= Release
CONFIG-= Debug
Rc_file = scdtool.rc
Binlib =.. /.. /bin. /.. /xercesc/lib
Ui_headers_dir =.. /inc #. ui file Transfer to **.h storage directory
Ui_sources_dir =.. /SRC #. ui file Transfer to **.cpp storage directory
Qmake_libdir = $${binlib}
Release {
TARGET = Scdtool #指定生成的应用程序名
Objects_dir =.. /.. Storage directory for/obj/scdtool/release #指定目标文件 (obj)
}
Debug {
TARGET = Scdtool_d #指定生成的应用程序名
Objects_dir =.. /.. Storage directory for/obj/scdtool/debug #指定目标文件 (obj)
}
Moc_dir = $${objects_dir}
DESTDIR =.. /.. /bin #指定生成的应用程序放置的目录