aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Alberto Mardegan <mardy@users.sourceforge.net>2013-04-01 23:08:13 +0300
committerGravatar Alberto Mardegan <mardy@users.sourceforge.net>2013-04-01 23:11:25 +0300
commit40e3671bd2656be9657abe8c6d955cef612805c5 (patch)
treeee5852f484f365726de6217f5f3209aa993f17c9 /Makefile
parentb5b14f1d95b0362a13fa3f11ac3f334012750099 (diff)
downloadsubsurface-40e3671bd2656be9657abe8c6d955cef612805c5.tar.gz
Improve Makefile rules for running moc
The previous rules were conflicting, and the naming of the moc-generated file to be included in .cpp files was deviating from what's most used in Qt: the usual way is to #include "file.moc" and not #include "file.moc.cpp" Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 10 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index aeb3cca0f..c0114386c 100644
--- a/Makefile
+++ b/Makefile
@@ -306,18 +306,23 @@ MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $
@mkdir -p .dep
@$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<
+# This rule is for running the moc on QObject subclasses defined in the .h
+# files.
+# To activate this rule, add <file>.moc.o to the OBJS variable.
%.moc.cpp: %.h
@echo ' MOC' $<
@$(MOC) $(MOCFLAGS) $< -o $@
-# This rule is for running the moc on QObject subclasses defined in the .cpp files;
-# remember to #include "<file>.moc.cpp" at the end of the .cpp file, or you'll
-# get linker errors ("undefined vtable for...")
-%.moc.cpp: %.cpp
+# This rule is for running the moc on QObject subclasses defined in the .cpp
+# files; remember to #include "<file>.moc" at the end of the .cpp file, or
+# you'll get linker errors ("undefined vtable for...")
+# To activate this rule, you need another rule on the .o file, like:
+# file.o: file.moc
+%.moc: %.cpp
@echo ' MOC' $<
@$(MOC) -i $(MOCFLAGS) $< -o $@
-qt-gui.o: qt-gui.moc.cpp
+qt-gui.o: qt-gui.moc
%.ui.h: ui/%.ui
@echo ' UIC' $<