1 # QT_SUBDIRS .. subdirectories where to build QT applications using qmake
2 # QTDIR .. where QT resides
6 .PHONY: qt-subpass clean-qt distclean-qt
8 # Usage: $(call qt_makefile_template,<qt-subdir>)
9 define qt_makefile_template
10 $(SOURCES_DIR)/$(1)/Makefile: $(wildcard $(SOURCES_DIR)/$(1)/*.pro)
11 cd $(SOURCES_DIR)/$(1); $(QTDIR:%=%/bin/)qmake TOP_DIR=$(OUTPUT_DIR) \
12 RELATIVE_DIR=$(RELATIVE_PREFIX)$(1) $(QTDIR:%=QTDIR=%) CC=$(CC) \
13 CXX=$(CXX) LIBS+="-L$(USER_LIB_DIR)" INCLUDEPATH+="$(USER_INCLUDE_DIR)"
15 $(foreach dir,$(QT_SUBDIRS), $(eval $(call qt_makefile_template,$(dir))))
17 qt-subpass: $(foreach dir,$(QT_SUBDIRS), $(SOURCES_DIR)/$(dir)/Makefile)
18 $(foreach dir,$(QT_SUBDIRS),\
19 $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \
20 RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \
21 -f $(SOURCES_DIR)/$(dir)/Makefile || exit 1 ;)
24 binary-pass-submakes: qt-subpass
29 +@$(foreach dir, $(QT_SUBDIRS), \
30 $(if $(wildcard $(SOURCES_DIR)/$(dir)/Makefile), \
31 @$(QUIET_CMD_ECHO) " CLEAN $(dir)"; \
32 $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \
33 RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \
34 -f $(SOURCES_DIR)/$(dir)/Makefile clean|| exit 1 ;))
38 distclean: distclean-qt
40 # TODO: Add distclean-qt-pass to handle QT_SUBDIRS in the whole
41 # tree. This way we only distclean toplevel subdirs.
43 +@$(foreach dir, $(QT_SUBDIRS), \
44 $(if $(wildcard $(SOURCES_DIR)/$(dir)/Makefile), \
45 @$(QUIET_CMD_ECHO) " DISTCLEAN $(dir)"; \
46 $(MAKE) SOURCES_DIR=$(SOURCES_DIR)/$(dir) \
47 RELATIVE_DIR=$(RELATIVE_PREFIX)$(dir) -C $(SOURCES_DIR)/$(dir) \
48 -f $(SOURCES_DIR)/$(dir)/Makefile distclean|| exit 1 ;))