summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-04-07 15:20:43 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-04-07 15:59:33 -0700
commitba712c3b5420ed461b8b7a1fdd14849e622ae974 (patch)
tree4a18b4d7c740e5b20c110279f29594ec1550a266 /Makefile
parent081000963a822c1a9814bf4eba3e9dd4485a2cf9 (diff)
downloadsubsurface-ba712c3b5420ed461b8b7a1fdd14849e622ae974.tar.gz
Start creating the Qt UI
This is based on several commits from Tomaz - mingled together and mildly extended by Dirk (mostly Makefile hacking). All Qt UI related stuff should eventually move into the qt-ui directory. So the Makefile rules for moc and uic have been adjusted accordingly. The MainWindow class has been moved into its own file in qt-ui (but just with a placeholder, the existing class has simply been ifdef'ed out in qt-gui.cpp for the moment). We still have a couple of Qt things in qt-gui.cpp in the main directory... all this needs to move into the qt-ui directory and be built with separate .h files. Right now we have the one-off Makefile rule to create the qt-gui.moc file from the qt-gui.cpp file. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile40
1 files changed, 26 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index aa42db2cf..c14d0b931 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ VERSION=3.0.2
CC=gcc
CFLAGS=-Wall -Wno-pointer-sign -g $(CLCFLAGS) -DGSEAL_ENABLE
CXX=g++
-CXXFLAGS=-Wall -g $(CLCFLAGS) -DQT_NO_KEYWORDS
+CXXFLAGS=-Wall -g $(CLCFLAGS) -fPIC -DQT_NO_KEYWORDS
INSTALL=install
PKGCONFIG=pkg-config
XML2CONFIG=xml2-config
@@ -182,10 +182,13 @@ LIBS = $(LIBQT) $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBGTK) $(LIBGCONF2) $(LIB
MSGLANGS=$(notdir $(wildcard po/*.po))
MSGOBJS=$(addprefix share/locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.mo))
+
+QTOBJS = qt-ui/maintab.o qt-ui/mainwindow.o qt-ui/plotareascene.o
+
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o divelist-gtk.o deco.o planner.o \
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
qt-gui.o statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
- webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE)
+ webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE) $(QTOBJS)
DEPS = $(wildcard .dep/*.dep)
@@ -298,36 +301,45 @@ MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $
%.o: %.c
@echo ' CC' $<
- @mkdir -p .dep
+ @mkdir -p .dep .dep/qt-ui
@$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<
%.o: %.cpp
@echo ' CXX' $<
- @mkdir -p .dep
+ @mkdir -p .dep .dep/qt-ui
@$(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" 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
+
+qt-ui/%.moc: qt-ui/%.h
+ @echo ' MOC' $<
+ @$(MOC) -i $(MOCFLAGS) $< -o $@
+
+# this is just here for qt-gui.cpp
+# should be removed once all the Qt UI code has been moved into qt-ui
+
%.moc: %.cpp
@echo ' MOC' $<
@$(MOC) -i $(MOCFLAGS) $< -o $@
-qt-gui.o: main-window.ui.h qt-gui.moc
+# This creates the ui headers.
+# To activate this rule, you need to add the ui_*.h file to the .o file:
+# file.o: ui_file.h
-%.ui.h: ui/%.ui
+qt-ui/ui_%.h: qt-ui/%.ui
@echo ' UIC' $<
@$(UIC) $< -o $@
+qt-gui.o: qt-gui.moc
+
+qt-ui/maintab.o: qt-ui/maintab.moc qt-ui/ui_maintab.h
+
+qt-ui/mainwindow.o: qt-ui/mainwindow.moc qt-ui/ui_mainwindow.h
+
share/locale/%.UTF-8/LC_MESSAGES/subsurface.mo: po/%.po po/%.aliases
mkdir -p $(dir $@)
msgfmt -c -o $@ po/$*.po
@@ -355,7 +367,7 @@ doc:
clean:
rm -f $(OBJS) *~ $(NAME) $(NAME).exe po/*~ po/subsurface-new.pot \
- $(VERSION_FILE)
+ $(VERSION_FILE) qt-ui/*.moc qt-ui/ui_*.h
rm -rf share .dep
-include $(DEPS)