aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile13
-rw-r--r--Rules.mk27
2 files changed, 27 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 1e193eb22..29466925a 100644
--- a/Makefile
+++ b/Makefile
@@ -107,6 +107,18 @@ SOURCES = \
main.cpp \
$(RESFILE)
+FORMS = \
+ qt-ui/about.ui \
+ qt-ui/divecomputermanagementdialog.ui \
+ qt-ui/diveplanner.ui \
+ qt-ui/downloadfromdivecomputer.ui \
+ qt-ui/maintab.ui \
+ qt-ui/mainwindow.ui \
+ qt-ui/preferences.ui \
+ qt-ui/printoptions.ui \
+ qt-ui/renumber.ui \
+ qt-ui/subsurfacewebservices.ui \
+ qt-ui/tableview.ui
RESOURCES = $(NAME).qrc
@@ -155,7 +167,6 @@ MSGLANGS=$(notdir $(wildcard po/*.po))
# Add files to the following variables if the auto-detection based on the
# filename fails
OBJS_NEEDING_MOC =
-OBJS_NEEDING_UIC =
HEADERS_NEEDING_MOC =
include Rules.mk
diff --git a/Rules.mk b/Rules.mk
index 4329bae10..4cb5e19a9 100644
--- a/Rules.mk
+++ b/Rules.mk
@@ -38,6 +38,11 @@ MOC_OBJS = $(HEADERS_NEEDING_MOC:.h=.moc.o)
ALL_OBJS = $(OBJS) $(MOC_OBJS)
+# handling of uic
+UIC_HEADERS = $(patsubst %.ui, ui_%.h, $(subst qt-ui/,,$(FORMS)))
+vpath %.ui qt-ui
+vpath ui_%.h .uic
+
# Files for using Qt Creator
CREATOR_FILES = $(NAME).config $(NAME).creator $(NAME).files $(NAME).includes
@@ -47,6 +52,8 @@ $(TARGET): gen_version_file $(ALL_OBJS) $(MSGOBJS) $(INFOPLIST)
@$(PRETTYECHO) ' LINK' $(TARGET)
$(COMPILE_PREFIX)$(CXX) $(LDFLAGS) -o $(TARGET) $(ALL_OBJS) $(LIBS)
+uicables: $(UIC_HEADERS)
+
gen_version_file $(VERSION_FILE):
ifneq ($(STORED_VERSION_STRING),$(VERSION_STRING))
$(info updating $(VERSION_FILE) to $(VERSION_STRING))
@@ -178,10 +185,10 @@ MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $
@mkdir -p .dep/$(@D)
$(COMPILE_PREFIX)$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<
-%.o: %.cpp
+%.o: %.cpp uicables
@$(PRETTYECHO) ' CXX' $<
@mkdir -p .dep/$(@D)
- $(COMPILE_PREFIX)$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<
+ $(COMPILE_PREFIX)$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -I.uic -Iqt-ui -MD -MF .dep/$@.dep -c -o $@ $<
# This rule is for running the moc on QObject subclasses defined in the .h
# files.
@@ -203,16 +210,12 @@ MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $
%.qrc:
# This creates the ui headers.
-ui_%.h: %.ui
+ui_%.h: %.ui .uic
@$(PRETTYECHO) ' UIC' $<
- $(COMPILE_PREFIX)$(UIC) $< -o $@
+ $(COMPILE_PREFIX)$(UIC) $< -o .uic/$@
-# This forces the creation of ui headers with the wrong path
-# This is required because the -MG option to the compiler outputs
-# unknown files with no path prefix
-ui_%.h: qt-ui/%.ui
- @$(PRETTYECHO) ' UIC' $<
- $(COMPILE_PREFIX)$(UIC) $< -o qt-ui/$@
+.uic:
+ $(COMPILE_PREFIX)mkdir $@
share/locale/%.UTF-8/LC_MESSAGES/$(NAME).mo: po/%.po po/%.aliases
@$(PRETTYECHO) ' MSGFMT' $*.po
@@ -242,13 +245,13 @@ doc:
clean:
rm -f $(ALL_OBJS) *~ $(NAME) $(NAME).exe po/*~ po/$(NAME)-new.pot \
- $(VERSION_FILE) $(HEADERS_NEEDING_MOC:.h=.moc) *.moc qt-ui/*.moc qt-ui/ui_*.h
+ $(VERSION_FILE) $(HEADERS_NEEDING_MOC:.h=.moc) *.moc qt-ui/*.moc .uic/*.h
rm -f $(RESOURCES:.qrc=.qrc.cpp)
rm -rf share
confclean: clean
rm -f $(CONFIGFILE)
- rm -rf .dep
+ rm -rf .dep .uic
distclean: confclean
rm -f $(CREATOR_FILES)