# QT_SUBDIRS .. subdirectories where to build QT applications using qmake # QTDIR .. where QT resides ifneq ($(QT_SUBDIRS),) .PHONY: qt-subpass clean-qt distclean-qt # Usage: $(call qt_makefile_template,) define qt_makefile_template $(SOURCES_DIR)/$(1)/Makefile: $(wildcard $(SOURCES_DIR)/$(1)/*.pro) cd $(SOURCES_DIR)/$(1); $(QTDIR:%=%/bin/)qmake TOP_DIR=$(OUTPUT_DIR) \ RELATIVE_DIR=$(RELATIVE_PREFIX)$(1) $(QTDIR:%=QTDIR=%) CC=$(CC) \ CXX=$(CXX) LIBS+="-L$(USER_LIB_DIR)" INCLUDEPATH+="$(USER_INCLUDE_DIR)" endef $(foreach dir,$(QT_SUBDIRS), $(eval $(call qt_makefile_template,$(dir)))) qt-subpass: $(foreach dir,$(QT_SUBDIRS), $(SOURCES_DIR)/$(dir)/Makefile) $(foreach dir,$(QT_SUBDIRS),\ $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \ RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \ -f $(SOURCES_DIR)/$(dir)/Makefile || exit 1 ;) # Hook to binary pass binary-pass-submakes: qt-subpass # Hook to clean pass clean-local: clean-qt clean-qt: +@$(foreach dir, $(QT_SUBDIRS), \ $(if $(wildcard $(SOURCES_DIR)/$(dir)/Makefile), \ @$(QUIET_CMD_ECHO) " CLEAN $(dir)"; \ $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \ RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \ -f $(SOURCES_DIR)/$(dir)/Makefile clean|| exit 1 ;)) # Hook to distclean distclean: distclean-qt # TODO: Add distclean-qt-pass to handle QT_SUBDIRS in the whole # tree. This way we only distclean toplevel subdirs. distclean-qt: +@$(foreach dir, $(QT_SUBDIRS), \ $(if $(wildcard $(SOURCES_DIR)/$(dir)/Makefile), \ @$(QUIET_CMD_ECHO) " DISTCLEAN $(dir)"; \ $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \ RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \ -f $(SOURCES_DIR)/$(dir)/Makefile distclean|| exit 1 ;)) endif # Local Variables: # mode:makefile # End: