include Makefile.common # Qt MOC generation, required for QObject-derived classes ifneq ($(MOC_HEADERS),) # prefix moc_ to base filename of paths and change extension from h to cpp, so a/b/foo.h becomes a/b/moc_foo.cpp MOC_SRC := $(join $(addsuffix moc_,$(dir $(MOC_HEADERS))), $(notdir $(MOC_HEADERS:.h=.cpp))) endif Q ?= $(error missing moc) .PHONY: generate $(MOC_SRC): @$(if $(Q), $(shell echo echo MOC $<),) $(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@)) $(Q)$(MOC) -o $(MOC_TMP) $< $(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x)) generate: $(MOC_SRC) @echo $(MOC_SRC) print-%: @echo '$*=$($*)'