哪些变量如$(MKDIR)和$(COPY_DIR)定义了?

时间:2013-12-02 08:44:33

标签: qt-creator qmake

我试图抓住这些变量所包含的值,但是我在网上找不到关于它们的任何信息,并且在C:\ Qt文件夹中搜索这些字符串没有任何结果。

这些变量在哪里定义?

3 个答案:

答案 0 :(得分:14)

在处理.pro文件并且您的Makefile由qmake生成之前,其他几个文件都是根据您的编译器和平台进行预处理的。这些文件的扩展名为.prf和.conf,并从名为mkspecs的目录中加载。

Makefile中MKDIR和COPY_DIR变量的值由以下文件中定义的QMAKE_MKDIR和QMAKE_COPY_DIR变量的值生成:

C:\ Qt的\ Qt5.0.2 \ 5.0.2 \ msvc2010 \ mkspecs \共同\壳unix.conf:

QMAKE_TAR              = tar -cf
QMAKE_GZIP             = gzip -9f

QMAKE_COPY             = cp -f
QMAKE_COPY_FILE        = $$QMAKE_COPY
QMAKE_COPY_DIR         = $$QMAKE_COPY -R
QMAKE_MOVE             = mv -f
QMAKE_DEL_FILE         = rm -f
QMAKE_DEL_DIR          = rmdir
QMAKE_CHK_EXISTS       = test -e %1 ||
QMAKE_CHK_DIR_EXISTS   = test -d    # legacy
QMAKE_MKDIR            = mkdir -p   # legacy
QMAKE_MKDIR_CMD        = test -d %1 || mkdir -p %1
QMAKE_STREAM_EDITOR    = sed

C:\ Qt的\ Qt5.0.2 \ 5.0.2 \ msvc2010 \ mkspecs \共同\壳win32.conf:

QMAKE_ZIP              = zip -r -9

QMAKE_COPY             = copy /y
QMAKE_COPY_DIR         = xcopy /s /q /y /i
QMAKE_MOVE             = move
QMAKE_DEL_FILE         = del
QMAKE_DEL_DIR          = rmdir
QMAKE_CHK_EXISTS       = if not exist %1
QMAKE_CHK_DIR_EXISTS   = if not exist   # legacy
QMAKE_MKDIR            = mkdir          # legacy
QMAKE_MKDIR_CMD        = if not exist %1 mkdir %1 & if not exist %1 exit 1

# xcopy copies the contained files if source is a directory. Deal with it.
CONFIG += copy_dir_files

(如您所见,我使用的是Qt 5.0.2,因此您的计算机上的路径可能会有所不同。)

答案 1 :(得分:7)

Qt 5.8的更新

c:\Qt\5.8\mingw53_32\mkspecs\features\spec_post.prf

类似于Windows:

QMAKE_ZIP               = zip -r -9

QMAKE_CD                = cd /d
QMAKE_COPY              = copy /y
QMAKE_COPY_FILE         = $$QMAKE_COPY
QMAKE_COPY_DIR          = xcopy /s /q /y /i
# xcopy copies the contained files if source is a directory. Deal with it.
CONFIG                 += copy_dir_files
QMAKE_MOVE              = move
QMAKE_DEL_FILE          = del
QMAKE_DEL_DIR           = rmdir
QMAKE_DEL_TREE          = rmdir /s /q
QMAKE_CHK_EXISTS        = if not exist %1
QMAKE_CHK_DIR_EXISTS    = if not exist   # legacy
QMAKE_MKDIR             = mkdir          # legacy
QMAKE_MKDIR_CMD         = if not exist %1 mkdir %1 & if not exist %1 exit 1
QMAKE_STREAM_EDITOR     = $(QMAKE) -install sed
QMAKE_INSTALL_FILE      = copy /y
QMAKE_INSTALL_PROGRAM   = copy /y

类似Linux:

QMAKE_TAR               = tar -cf
QMAKE_GZIP              = gzip -9f

QMAKE_CD                = cd
QMAKE_COPY              = cp -f
QMAKE_COPY_FILE         = $$QMAKE_COPY
QMAKE_COPY_DIR          = $$QMAKE_COPY -R
QMAKE_MOVE              = mv -f
QMAKE_DEL_FILE          = rm -f
QMAKE_DEL_DIR           = rmdir
QMAKE_DEL_TREE          = rm -rf
QMAKE_CHK_EXISTS        = test -e %1 ||
QMAKE_CHK_DIR_EXISTS    = test -d    # legacy
QMAKE_MKDIR             = mkdir -p   # legacy
QMAKE_MKDIR_CMD         = test -d %1 || mkdir -p %1
QMAKE_STREAM_EDITOR     = sed

equals(QMAKE_HOST.os, Windows) {
    MINGW_IN_SHELL = 1   # legacy
    # Override built-ins.
    QMAKE_DIR_SEP = /
    QMAKE_DIRLIST_SEP = :
    # Because install's ability to set permissions is not relevant on Windows,
    # and git's msys does not provide it to start with.
    QMAKE_INSTALL_FILE      = cp -f
    QMAKE_INSTALL_PROGRAM   = cp -f
} else {
    QMAKE_INSTALL_FILE      = install -m 644 -p
    QMAKE_INSTALL_PROGRAM   = install -m 755 -p
}

答案 2 :(得分:-3)

使用我的Mac上的Terminal

mkdir在您当前的目录中创建一个目录。如果您输入mkdir code并按Enter键,我们假设当前目录为用户名:〜/ parent_directory $ ,它将创建一个名为代码

的目录