]> rtime.felk.cvut.cz Git - omk.git/blob - snippets/qt
Added EXTRA_RULES_SUBDIRS feature
[omk.git] / snippets / qt
1 # QT_SUBDIRS       .. subdirectories where to build QT applications using qmake
2 # QTDIR            .. where QT resides
3
4 ifneq ($(QT_SUBDIRS),)
5
6 .PHONY: qt-subpass clean-qt distclean-qt
7
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)"
14 endef
15 $(foreach dir,$(QT_SUBDIRS), $(eval $(call qt_makefile_template,$(dir))))
16
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 ;)
22
23 # Hook to binary pass
24 binary-pass-submakes: qt-subpass
25
26 # Hook to clean pass
27 clean-local: clean-qt
28 clean-qt:
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 ;))
35
36
37 # Hook to distclean
38 distclean: distclean-qt
39
40 # TODO: Add distclean-qt-pass to handle QT_SUBDIRS in the whole
41 # tree. This way we only distclean toplevel subdirs.
42 distclean-qt:
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 ;))
49 endif
50
51 # Local Variables:
52 # mode:makefile
53 # End: