2013-04-13 06:42:14 +00:00
|
|
|
# -*- Makefile -*-
|
|
|
|
# This file contains the detection rules
|
2013-04-13 16:00:15 +00:00
|
|
|
all:
|
2013-04-23 06:28:29 +00:00
|
|
|
|
|
|
|
PKGCONFIG=pkg-config
|
|
|
|
XML2CONFIG=xml2-config
|
|
|
|
XSLCONFIG=xslt-config
|
Merge branch 'Qt'
After the 3.1 release it is time to shift the focus on the Qt effort - and
the best way to do this is to merge the changes in the Qt branch into
master.
Linus was extremely nice and did a merge for me. I decided to do my own
merge instead (which by accident actually based on a different version of
the Qt branch) and then used his merge to double check what I was doing.
I resolved a few things differently but overall what we did was very much
the same (and I say this with pride since Linus is a professional git
merger)
Here's his merge commit message:
This is a rough and tumble merge of the Qt branch into 'master',
trying to sort out the conflicts as best as I could.
There were two major kinds of conflicts:
- the Makefile changes, in particular the split of the single
Makefile into Rules.mk and Configure.mk, along with the obvious Qt
build changes themselves.
Those changes conflicted with some of the updates done in mainline
wrt "release" targets and some helper macros ($(NAME) etc).
Resolved by largely taking the Qt branch versions, and then editing
in the most obvious parts of the Makefile updates from mainline.
NOTE! The script/get_version shell script was made to just fail
silently on not finding a git repository, which avoided having to
take some particularly ugly Makefile changes.
- Various random updates in mainline to support things like dive tags.
The conflicts were mainly to the gtk GUI parts, which obviously
looked different afterwards. I fixed things up to look like the
newer code, but since the gtk files themselves are actually dead in
the Qt branch, this is largely irrelevant.
NOTE! This does *NOT* introduce the equivalent Qt functionality.
The fields are there in the code now, but there's no Qt UI for the
whole dive tag stuff etc.
This seems to compile for me (although I have to force
"QMAKE=qmake-qt4" on f19), and results in a Linux binary that seems to
work, but it is otherwise largely untested.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-18 05:01:41 +00:00
|
|
|
QMAKE=qmake
|
|
|
|
MOC=moc
|
|
|
|
UIC=uic
|
2013-05-29 19:59:38 +00:00
|
|
|
TAR=tar
|
2013-04-23 06:28:29 +00:00
|
|
|
|
2013-04-13 16:00:15 +00:00
|
|
|
CONFIGFILE = config.cache
|
|
|
|
ifeq ($(CONFIGURING),1)
|
|
|
|
|
|
|
|
# Detect the target system
|
|
|
|
# Ask the compiler what OS it's producing files for
|
2013-04-23 06:28:29 +00:00
|
|
|
UNAME := $(shell $(CC) -dumpmachine 2>&1 | grep -E -o "linux|darwin|win|gnu|kfreebsd")
|
|
|
|
|
|
|
|
# find libdivecomputer
|
|
|
|
# First deal with the cross compile environment and with Mac.
|
|
|
|
# For the native case, Linus doesn't want to trust pkg-config given
|
|
|
|
# how young libdivecomputer still is - so we check the typical
|
|
|
|
# subdirectories of /usr/local and /usr and then we give up. You can
|
|
|
|
# override by simply setting it here
|
|
|
|
#
|
|
|
|
ifeq ($(CC), i686-w64-mingw32-gcc)
|
|
|
|
# ok, we are cross building for Windows
|
|
|
|
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
|
|
|
|
RESFILE = packaging/windows/subsurface.res
|
|
|
|
LDFLAGS += -Wl,-subsystem,windows
|
|
|
|
LIBWINSOCK = -lwsock32
|
|
|
|
else ifeq ($(UNAME), darwin)
|
|
|
|
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
|
2013-05-19 05:35:48 +00:00
|
|
|
else ifeq ($(shell $(PKGCONFIG) --exists libdivecomputer; echo $$?),0)
|
|
|
|
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
|
2013-04-23 06:28:29 +00:00
|
|
|
else
|
|
|
|
libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
|
|
|
|
libdc-local64 := $(wildcard /usr/local/lib64/libdivecomputer.a)
|
|
|
|
libdc-usr := $(wildcard /usr/lib/libdivecomputer.a)
|
|
|
|
libdc-usr64 := $(wildcard /usr/lib64/libdivecomputer.a)
|
|
|
|
|
|
|
|
ifneq ($(LIBDCDEVEL),)
|
|
|
|
LIBDIVECOMPUTERDIR = ../libdivecomputer
|
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/src/.libs/libdivecomputer.a
|
|
|
|
else ifneq ($(strip $(libdc-local)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr/local
|
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
|
|
|
|
else ifneq ($(strip $(libdc-local64)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr/local
|
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
|
|
|
|
else ifneq ($(strip $(libdc-usr)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr
|
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
|
|
|
|
else ifneq ($(strip $(libdc-usr64)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr
|
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
|
|
|
|
else
|
|
|
|
$(error Cannot find libdivecomputer - please edit Makefile)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Libusb-1.0 is only required if libdivecomputer was built with it.
|
|
|
|
# And libdivecomputer is only built with it if libusb-1.0 is
|
|
|
|
# installed. So get libusb if it exists, but don't complain
|
|
|
|
# about it if it doesn't.
|
|
|
|
LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
|
|
|
|
|
2013-05-14 21:23:39 +00:00
|
|
|
# Find qmake. Rules are:
|
|
|
|
# - use qmake if it is in $PATH
|
|
|
|
# [qmake -query QT_VERSION will fail if it's Qt 3's qmake]
|
|
|
|
# - if that fails, try qmake-qt4
|
|
|
|
# - if that fails, print an error
|
|
|
|
# We specifically do not search for qmake-qt5 since that is not supposed
|
|
|
|
# to exist.
|
|
|
|
QMAKE = $(shell { qmake -query QT_VERSION >/dev/null 2>&1 && echo qmake; } || \
|
|
|
|
{ qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; })
|
|
|
|
ifeq ($(strip $(QMAKE)),)
|
|
|
|
$(error Could not find qmake or qmake-qt4 in $$PATH or they failed)
|
|
|
|
endif
|
|
|
|
|
2013-04-23 06:28:29 +00:00
|
|
|
# Use qmake to find out which Qt version we are building for.
|
|
|
|
QT_VERSION_MAJOR = $(shell $(QMAKE) -query QT_VERSION | cut -d. -f1)
|
|
|
|
ifeq ($(QT_VERSION_MAJOR), 5)
|
2013-05-17 11:14:10 +00:00
|
|
|
# QT_MODULES = Qt5Widgets Qt5Svg
|
|
|
|
# QT_CORE = Qt5Core
|
|
|
|
# QTBINDIR = $(shell $(QMAKE) -query QT_HOST_BINS)
|
|
|
|
# # Tool paths are not stored in .pc files in Qt 5.0
|
|
|
|
# MOC = $(QTBINDIR)/moc
|
|
|
|
# UIC = $(QTBINDIR)/uic
|
|
|
|
# RCC = $(QTBINDIR)/rcc
|
|
|
|
# if qmake is qt5, try to get the qt4 one.
|
|
|
|
QMAKE = { qmake-qt4 -v >/dev/null 2>&1 && echo qmake-qt4; }
|
|
|
|
#else
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(QMAKE)),)
|
|
|
|
$(error Could not find qmake or qmake-qt4 in $$PATH for the Qt4 version they failed)
|
|
|
|
endif
|
|
|
|
|
2013-08-22 19:20:47 +00:00
|
|
|
QT_MODULES = QtGui QtSvg QtNetwork QtWebKit
|
2013-04-23 06:28:29 +00:00
|
|
|
QT_CORE = QtCore
|
2013-05-14 21:23:40 +00:00
|
|
|
MOC = $(shell $(PKGCONFIG) --variable=moc_location QtCore)
|
|
|
|
UIC = $(shell $(PKGCONFIG) --variable=uic_location QtGui)
|
|
|
|
RCC = $(shell $(PKGCONFIG) --variable=rcc_location QtGui)
|
2013-05-17 11:14:10 +00:00
|
|
|
#endif
|
2013-04-23 06:28:29 +00:00
|
|
|
|
|
|
|
# we need GLIB2CFLAGS for gettext
|
|
|
|
QTCXXFLAGS = $(shell $(PKGCONFIG) --cflags $(QT_MODULES)) $(GLIB2CFLAGS)
|
|
|
|
LIBQT = $(shell $(PKGCONFIG) --libs $(QT_MODULES))
|
|
|
|
ifneq ($(filter reduce_relocations, $(shell $(PKGCONFIG) --variable qt_config $(QT_CORE))), )
|
|
|
|
QTCXXFLAGS += -fPIE
|
|
|
|
endif
|
|
|
|
|
2013-10-05 07:29:09 +00:00
|
|
|
# LIBGTK = $(shell $(PKGCONFIG) --libs gtk+-2.0 glib-2.0)
|
2013-04-23 06:28:29 +00:00
|
|
|
ifneq (,$(filter $(UNAME),linux kfreebsd gnu))
|
|
|
|
LIBGCONF2 = $(shell $(PKGCONFIG) --libs gconf-2.0)
|
|
|
|
GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
|
|
|
|
else ifeq ($(UNAME), darwin)
|
2013-05-22 12:35:42 +00:00
|
|
|
LDFLAGS += -framework CoreFoundation -framework CoreServices
|
2013-04-23 06:28:29 +00:00
|
|
|
GTK_MAC_BUNDLER = ~/.local/bin/gtk-mac-bundler
|
|
|
|
endif
|
|
|
|
|
|
|
|
LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES)
|
|
|
|
LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
|
|
|
|
|
|
|
|
LIBXML2 = $(shell $(XML2CONFIG) --libs)
|
|
|
|
LIBXSLT = $(shell $(XSLCONFIG) --libs)
|
|
|
|
XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
|
2013-10-05 07:29:09 +00:00
|
|
|
#GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
|
|
|
|
#GTKCFLAGS += $(shell $(PKGCONFIG) --cflags gtk+-2.0)
|
2013-04-23 06:28:29 +00:00
|
|
|
XSLCFLAGS = $(shell $(XSLCONFIG) --cflags)
|
|
|
|
OSMGPSMAPFLAGS += $(shell $(PKGCONFIG) --cflags osmgpsmap 2> /dev/null)
|
|
|
|
LIBOSMGPSMAP += $(shell $(PKGCONFIG) --libs osmgpsmap 2> /dev/null)
|
2013-10-05 07:29:09 +00:00
|
|
|
#LIBSOUPCFLAGS = $(shell $(PKGCONFIG) --cflags libsoup-2.4)
|
|
|
|
#LIBSOUP = $(shell $(PKGCONFIG) --libs libsoup-2.4)
|
2013-04-23 06:28:29 +00:00
|
|
|
|
|
|
|
LIBZIP = $(shell $(PKGCONFIG) --libs libzip 2> /dev/null)
|
|
|
|
ZIPFLAGS = $(strip $(shell $(PKGCONFIG) --cflags libzip 2> /dev/null))
|
|
|
|
|
|
|
|
LIBSQLITE3 = $(shell $(PKGCONFIG) --libs sqlite3 2> /dev/null)
|
|
|
|
SQLITE3FLAGS = $(strip $(shell $(PKGCONFIG) --cflags sqlite3))
|
2013-04-13 16:00:15 +00:00
|
|
|
|
2013-05-18 18:40:52 +00:00
|
|
|
# Before Marble 4.9, the GeoDataTreeModel.h header wasn't installed
|
|
|
|
# Check if it's present by trying to compile
|
|
|
|
MARBLEFLAGS = $(shell $(CXX) $(QTCXXFLAGS) -E -include marble/GeoDataTreeModel.h -xc++ /dev/null > /dev/null 2>&1 || echo " -DINCOMPLETE_MARBLE")
|
2013-05-18 18:40:53 +00:00
|
|
|
MARBLELIBS = -lmarblewidget
|
2013-05-18 16:44:54 +00:00
|
|
|
|
2013-04-13 16:00:15 +00:00
|
|
|
# Write the configure file
|
|
|
|
all: configure
|
|
|
|
configure $(CONFIGURE): Configure.mk
|
|
|
|
@echo "\
|
2013-04-23 19:54:24 +00:00
|
|
|
CONFIGURED = 1\\\
|
|
|
|
UNAME = $(UNAME)\\\
|
|
|
|
LIBDIVECOMPUTERDIR = $(LIBDIVECOMPUTERDIR)\\\
|
|
|
|
LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERCFLAGS)\\\
|
|
|
|
LIBDIVECOMPUTER = $(LIBDIVECOMPUTER)\\\
|
2013-04-25 00:02:49 +00:00
|
|
|
LIBWINSOCK = $(LIBWINSOCK)\\\
|
|
|
|
LDFLAGS = $(LDFLAGS)\\\
|
|
|
|
RESFILE = $(RESFILE)\\\
|
2013-04-23 19:54:24 +00:00
|
|
|
LIBQT = $(LIBQT)\\\
|
|
|
|
QTCXXFLAGS = $(QTCXXFLAGS)\\\
|
|
|
|
MOC = $(MOC)\\\
|
|
|
|
UIC = $(UIC)\\\
|
|
|
|
RCC = $(RCC)\\\
|
|
|
|
LIBGTK = $(LIBGTK)\\\
|
|
|
|
GTKCFLAGS = $(GTKCFLAGS)\\\
|
|
|
|
LIBGCONF2 = $(LIBGCONF2)\\\
|
|
|
|
GCONF2CFLAGS = $(GCONF2CFLAGS)\\\
|
|
|
|
GTK_MAC_BUNDLER = $(GTK_MAC_BUNDLER)\\\
|
|
|
|
LIBXML2 = $(LIBXML2)\\\
|
|
|
|
LIBXSLT = $(LIBXSLT)\\\
|
|
|
|
XML2CFLAGS = $(XML2CFLAGS)\\\
|
|
|
|
GLIB2CFLAGS = $(GLIB2CFLAGS)\\\
|
|
|
|
XSLCFLAGS = $(XSLCFLAGS)\\\
|
|
|
|
OSMGPSMAPFLAGS = $(OSMGPSMAPFLAGS)\\\
|
|
|
|
LIBOSMGPSMAP = $(LIBOSMGPSMAP)\\\
|
|
|
|
LIBSOUPCFLAGS = $(LIBSOUPCFLAGS)\\\
|
|
|
|
LIBSOUP = $(LIBSOUP)\\\
|
|
|
|
LIBZIP = $(LIBZIP)\\\
|
|
|
|
ZIPFLAGS = $(ZIPFLAGS)\\\
|
|
|
|
LIBSQLITE3 = $(LIBSQLITE3)\\\
|
|
|
|
SQLITE3FLAGS = $(SQLITE3FLAGS)\\\
|
2013-05-18 16:44:54 +00:00
|
|
|
MARBLEFLAGS = $(MARBLEFLAGS)\\\
|
2013-05-18 18:40:53 +00:00
|
|
|
MARBLELIBS = $(MARBLELIBS)\\\
|
2013-04-23 19:24:01 +00:00
|
|
|
" | tr '\\' '\n' > $(CONFIGFILE)
|
2013-04-13 16:00:15 +00:00
|
|
|
|
|
|
|
else
|
|
|
|
configure $(CONFIGFILE): Configure.mk
|
|
|
|
@test -e $(CONFIGFILE) && echo Reconfiguring.. || echo Configuring...
|
|
|
|
@$(MAKE) CONFIGURING=1 configure
|
|
|
|
@echo Done
|
|
|
|
|
|
|
|
-include $(CONFIGFILE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: configure all
|