# objects on the target platform. Tihs behaviour wasn't observed so far, however
# one might use the QT_INSTALL_* variables for some weird reason during runtime.
-
+# for target builds (STAGING_DIR)
QT_EXTPREFIX:=$(STAGING_DIR)/$(CONFIGURE_PREFIX)
QT_SYSROOT:=
QT_INSTALL_CONFIGURATION:=/etc/qt5
QT_INSTALL_QML:=$(QT_INSTALL_ARCHDATA)/qml
QT_INSTALL_EXAMPLES:=$(QT_INSTALL_ARCHDATA)/examples
QT_INSTALL_DEMOS:=$(QT_INSTALL_EXAMPLES)
+# for host builds defined in target project files (STAGING_DIR)/host
QT_HOST_EXTPREFIX:=$(STAGING_DIR)/host
QT_HOST_PREFIX:=$(QT_HOST_EXTPREFIX)
QT_HOST_DATA:=$(QT_HOST_PREFIX)/share
PKG_INSTALL_DIR_ROOT:=$(PKG_INSTALL_DIR)
PKG_INSTALL_DIR:=$(PKG_INSTALL_DIR_ROOT)/$(STAGING_DIR)
+# for target independant host builds (STAGING_DIR_HOST)
+HOST_INSTALL_DIR_ROOT:=$(HOST_INSTALL_DIR)
+HOST_INSTALL_DIR:=$(HOST_INSTALL_DIR_ROOT)/$(STAGING_DIR_HOST)
+#HOST_INSTALL_DIR:=$(HOST_INSTALL_DIR_ROOT)/$(STAGING_DIR)
+
+QMAKE_TARGET=$(STAGING_DIR)/host/bin/qmake
+QMAKE_HOST=$(STAGING_DIR_HOST)/bin/qmake
+
define Build/Configure/Default
TARGET_CROSS="$(TARGET_CROSS)" \
TARGET_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
TARGET_CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS)" \
TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
- qmake \
+ $(QMAKE_TARGET) \
-o $(PKG_BUILD_DIR)/$(MAKE_PATH)/Makefile \
- $(PKG_BUILD_DIR)/$(MAKE_PATH)/$(if $(1),$(1),$(PKG_NAME)).pro
+ $(PKG_BUILD_DIR)/$(MAKE_PATH)/$(if $(1),$(1).pro,)
endef
-# We need to pass all qmake related variables to $(MAKE) as well, as (generated) Makefiles may invoke qmake once again for creating further Makefiles.
-# Actually we'd also like to pass $MAKE_VARS and $MAKE_FLAGS to also make ordinary non-qmake generated Makefiles calling toolchain executables
-# like $CC/$CXX/.. work, however this would interfere with qmake generated Makefiles, since they expect variables being set differently.
-# For example qmake generated Makefiles expect $AR to also contain ar's arguments, while ordinary Makefiles don't.
-# Until we find a way to disginguish both kinds of Makefiles, we will neglect ordinary Makefiles calling toolchain executables.
-# Mixing qmake generated and ordinary Makfiles - both calling toolchain executables - is probably a very rare case anyway.
+define Host/Configure/Default
+ $(QMAKE_HOST) \
+ -o $(HOST_BUILD_DIR)/$(MAKE_PATH)/Makefile \
+ $(HOST_BUILD_DIR)/$(MAKE_PATH)/$(if $(1),$(1).pro,)
+endef
+
+# We need to pass all qmake (TARGET_*) related variables to $(MAKE) as well, as
+# (generated) Makefiles may invoke qmake once again for creating further Makefiles.
+# Actually we'd also like to pass all other vars (defined in $MAKE_VARS and
+# $MAKE_FLAGS) to also make ordinary non-qmake generated Makefiles calling tool-
+# chain executables like $CC/$CXX/$AR.. work, however this would interfere with
+# qmake generated Makefiles, since they expect variables being set differently.
+# For example qmake generated Makefiles expect $AR to also contain ar's arguments,
+# while ordinary Makefiles don't.
+# Until we find a way to disginguish both kinds of Makefiles, we will neglect
+# ordinary Makefiles calling toolchain executables, however as they might take
+# $CFLAGS/CXXFLAGS into account (e.g. flags as -D*), we pass at least those
+# hoping to not interfere / break something.
+# Mixing qmake generated and ordinary Makfiles - both calling toolchain execut-
+# ables - is probably a very rare case anyway.
define Build/Compile/Default
+TARGET_CROSS="$(TARGET_CROSS)" \
TARGET_CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
TARGET_CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS)" \
TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
+ CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
+ CXXFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CXXFLAGS)" \
+ LDFLAGS="$(TARGET_LDFLAGS)" \
$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
$(1)
endef
+define Host/Compile/Default
+ $(MAKE) $(PKG_JOBS) -C $(HOST_BUILD_DIR)/$(MAKE_PATH) \
+ $(1)
+endef
+
define Build/Install/Default
INSTALL_ROOT="$(PKG_INSTALL_DIR_ROOT)" \
$(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
$(1) install
endef
+define Host/Install/Default
+ INSTALL_ROOT="$(HOST_INSTALL_DIR_ROOT)" \
+ $(MAKE) -C $(HOST_BUILD_DIR)/$(MAKE_PATH) \
+ $(1) install
+endef
+
define Build/Install/HostFiles
$(INSTALL_DIR) \
$(1)/host