Where are variables such as $(MKDIR) and $(COPY_DI

2019-01-23 16:15发布

I am trying to get hold of the values these variables contain but I couldn't find any informations about them on the web and searching for such strings in C:\Qt folder brought up nothing.

Where are these variables defined ?

3条回答
甜甜的少女心
2楼-- · 2019-01-23 16:43

Using the Terminal on my Mac,

mkdir creates a directory in the current directory you are in. Let's assume my current directory is username:~/parent_directory $, if you type mkdir code and press enter, it will create a directory with the name code

查看更多
Melony?
3楼-- · 2019-01-23 16:44

Before a .pro file is processed and your Makefiles are generated by qmake several other files are pre-processed based on your compiler and platform. These files have the extension .prf and .conf and are loaded from a directory called mkspecs.

The values of MKDIR and COPY_DIR variables in your Makefiles are generated by the values of QMAKE_MKDIR and QMAKE_COPY_DIR variables defined in the following files:

C:\Qt\Qt5.0.2\5.0.2\msvc2010\mkspecs\common\shell-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\common\shell-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

(As you can see I am using Qt 5.0.2 so the path might be different on your machine.)

查看更多
我命由我不由天
4楼-- · 2019-01-23 17:06

Update for Qt 5.8

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

Windows-like:

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-Like:

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
}
查看更多
登录 后发表回答