3 # Provide support for qmake-based projects
6 # Usage: USES=qmake or USES=qmake:ARGS
7 # Must be used along with 'USE_QT*=#'
8 # Valid ARGS: norecursive outsource
10 # norecursive Don't pass -recursive argument to qmake binary
11 # outsource Perform an out-of-source build
14 # Variables for ports:
15 # QMAKE_ENV - Environment passed to qmake.
16 # Default: ${CONFIGURE_ENV}
17 # QMAKE_ARGS - Arguments passed to qmake.
19 # QMAKE_SOURCE_PATH - Path to qmake project files.
20 # Default: ${WRKSRC} if out-of-source build is
21 # requested, empty otherwise.
23 # User defined variables:
24 # QMAKE_VERBOSE - Enable verbose configure output.
26 # MAINTAINER: kde@FreeBSD.org
28 .if !defined(_INCLUDE_USES_QMAKE_MK)
29 _INCLUDE_USES_QMAKE_MK= yes
31 # _QT_VERSION is defined in bsd.qt.mk, only if a correct Qt version was selected
33 .if empty(_QT_VERSION)
34 IGNORE= 'USES+= qmake' must be accompanied with 'USE_QT[${_QT_SUPPORTED:S/ //g}]= #'
37 # _env is a private argument used only by bsd.qt.mk to get variables and custom
38 # targets (currently, only qmake-configure), without qmake being added to the
40 _VALID_ARGS= norecursive outsource _env
42 .for arg in ${qmake_ARGS}
43 . if empty(_VALID_ARGS:M${arg})
44 IGNORE= Incorrect 'USES+= qmake' usage: argument '${arg}' is not recognized
48 .if ! ${qmake_ARGS:M_env}
49 USE_QT${_QT_VERSION:R:R}+= qmake_build
52 # QMAKESPEC belongs to bsd.qt.mk.
53 QMAKE_ENV?= ${CONFIGURE_ENV}
54 QMAKE_ARGS+= -spec ${QMAKESPEC} \
55 QMAKE_CC="${CC}" QMAKE_CXX="${CXX}" \
56 QMAKE_LINK_C="${CC}" QMAKE_LINK_C_SHLIB="${CC}" \
57 QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}" \
58 QMAKE_CFLAGS="${CFLAGS}" \
59 QMAKE_CXXFLAGS="${CXXFLAGS}" \
60 QMAKE_LFLAGS="${LDFLAGS}" \
61 QMAKE_LIBS="${LIBS}" \
62 QMAKE_CFLAGS_DEBUG="" \
63 QMAKE_CFLAGS_RELEASE="" \
64 QMAKE_CXXFLAGS_DEBUG="" \
65 QMAKE_CXXFLAGS_RELEASE="" \
68 .if defined(WITH_DEBUG)
69 QMAKE_ARGS+= CONFIG+="debug" \
72 QMAKE_ARGS+= CONFIG+="release" \
73 CONFIG-="debug separate_debug_info"
74 .endif # defined(WITH_DEBUG)
76 # We set -recursive by default to keep qmake from running in the build stage.
77 .if ! ${qmake_ARGS:Mnorecursive}
78 QMAKE_ARGS+= -recursive
81 .if defined(QMAKE_VERBOSE)
85 # _QMAKE_WRKSRC (and _QMAKE, below) are needed to abstract the qmake target and
86 # use it for both qtbase and USES=qmake ports. They are private, not supposed to
87 # be used anywhere else.
88 _QMAKE_WRKSRC?= ${CONFIGURE_WRKSRC}
89 .if ${qmake_ARGS:Moutsource}
90 CONFIGURE_WRKSRC= ${WRKDIR}/.build
91 BUILD_WRKSRC= ${CONFIGURE_WRKSRC}
92 INSTALL_WRKSRC= ${BUILD_WRKSRC}
93 QMAKE_SOURCE_PATH?= ${WRKSRC}
95 QMAKE_SOURCE_PATH?= # empty
98 .if ! ${qmake_ARGS:M_env}
99 DESTDIRNAME= INSTALL_ROOT
102 # Define a custom target to make it usable by bsd.qt.mk for internal Qt
105 @${MKDIR} ${_QMAKE_WRKSRC}
106 @cd ${_QMAKE_WRKSRC} && \
107 ${SETENV} ${QMAKE_ENV} ${_QMAKE} ${QMAKE_ARGS} ${QMAKE_SOURCE_PATH}
109 .if !target(do-configure) && ! ${qmake_ARGS:M_env}
110 _USES_configure+= 450:qmake-configure
113 .endif # !defined(_INCLUDE_USES_QMAKE_MK)