2011-12-08 20:20:05 +00:00
|
|
|
VERSION=1.2
|
2011-09-26 18:04:50 +00:00
|
|
|
|
2011-08-30 21:36:34 +00:00
|
|
|
CC=gcc
|
|
|
|
CFLAGS=-Wall -Wno-pointer-sign -g
|
2011-09-23 03:59:10 +00:00
|
|
|
INSTALL=install
|
2011-10-27 16:04:29 +00:00
|
|
|
PKGCONFIG=pkg-config
|
|
|
|
XML2CONFIG=xml2-config
|
2011-11-05 10:39:17 +00:00
|
|
|
XSLCONFIG=xslt-config
|
2011-09-23 03:59:10 +00:00
|
|
|
|
2011-10-11 22:58:38 +00:00
|
|
|
# these locations seem to work for SuSE and Fedora
|
|
|
|
# prefix = $(HOME)
|
2011-10-17 13:53:59 +00:00
|
|
|
prefix = $(DESTDIR)/usr
|
|
|
|
BINDIR = $(prefix)/bin
|
2011-10-12 20:30:08 +00:00
|
|
|
DATADIR = $(prefix)/share
|
|
|
|
DESKTOPDIR = $(DATADIR)/applications
|
|
|
|
ICONPATH = $(DATADIR)/icons/hicolor
|
2011-10-11 22:58:38 +00:00
|
|
|
ICONDIR = $(ICONPATH)/scalable/apps
|
2011-10-12 20:30:08 +00:00
|
|
|
MANDIR = $(DATADIR)/man/man1
|
2011-11-05 10:39:17 +00:00
|
|
|
XSLTDIR = $(DATADIR)/subsurface/xslt
|
2011-10-11 22:58:38 +00:00
|
|
|
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(ICONPATH)
|
|
|
|
|
2011-09-27 16:43:53 +00:00
|
|
|
NAME = subsurface
|
2011-10-11 22:58:38 +00:00
|
|
|
ICONFILE = $(NAME).svg
|
|
|
|
DESKTOPFILE = $(NAME).desktop
|
2011-10-12 20:30:08 +00:00
|
|
|
MANFILES = $(NAME).1
|
2011-11-05 10:39:17 +00:00
|
|
|
XSLTFILES = xslt/*.xslt
|
2011-08-30 21:36:34 +00:00
|
|
|
|
2011-12-14 19:22:12 +00:00
|
|
|
UNAME := $(shell $(CC) -dumpmachine 2>&1 | grep -E -o "linux|darwin|win")
|
2011-10-16 21:16:36 +00:00
|
|
|
|
2011-10-27 16:04:29 +00:00
|
|
|
# find libdivecomputer
|
2011-12-14 19:22:12 +00:00
|
|
|
# First deal with the cross compile environment and with Mac.
|
2011-10-27 16:04:29 +00:00
|
|
|
# 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
|
2011-10-11 00:53:59 +00:00
|
|
|
#
|
2011-10-27 16:04:29 +00:00
|
|
|
ifeq ($(CC), i686-w64-mingw32-gcc)
|
|
|
|
# ok, we are cross building for Windows
|
2012-01-03 19:18:04 +00:00
|
|
|
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
|
2011-10-29 16:14:15 +00:00
|
|
|
RESFILE = packaging/windows/subsurface.res
|
2011-10-29 17:27:49 +00:00
|
|
|
LDFLAGS += -Wl,-subsystem,windows
|
2011-12-14 19:22:12 +00:00
|
|
|
else ifeq ($(UNAME), darwin)
|
2012-01-03 19:18:04 +00:00
|
|
|
LIBDIVECOMPUTERINCLUDES = $(shell $(PKGCONFIG) --cflags libdivecomputer)
|
|
|
|
LIBDIVECOMPUTERARCHIVE = $(shell $(PKGCONFIG) --libs libdivecomputer)
|
2011-10-27 16:04:29 +00:00
|
|
|
else
|
2011-10-24 11:12:44 +00:00
|
|
|
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)
|
2011-10-11 00:53:59 +00:00
|
|
|
|
|
|
|
ifneq ($(strip $(libdc-local)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr/local
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
|
2011-10-14 04:06:13 +00:00
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
|
2011-10-24 11:12:44 +00:00
|
|
|
else ifneq ($(strip $(libdc-local64)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr/local
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
|
2011-10-24 11:12:44 +00:00
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
|
2011-10-11 00:53:59 +00:00
|
|
|
else ifneq ($(strip $(libdc-usr)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
|
2011-10-14 04:06:13 +00:00
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
|
2011-10-24 11:12:44 +00:00
|
|
|
else ifneq ($(strip $(libdc-usr64)),)
|
|
|
|
LIBDIVECOMPUTERDIR = /usr
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
|
2011-10-24 11:12:44 +00:00
|
|
|
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
|
2011-10-11 00:53:59 +00:00
|
|
|
else
|
2011-10-12 04:09:46 +00:00
|
|
|
$(error Cannot find libdivecomputer - please edit Makefile)
|
2011-10-11 00:53:59 +00:00
|
|
|
endif
|
2011-10-27 16:04:29 +00:00
|
|
|
endif
|
2011-09-12 16:19:21 +00:00
|
|
|
|
2011-09-22 19:21:20 +00:00
|
|
|
# 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.
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
|
|
|
|
|
2011-11-25 06:32:10 +00:00
|
|
|
LIBGTK = $(shell $(PKGCONFIG) --libs gtk+-2.0 glib-2.0)
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES)
|
2011-09-22 19:21:20 +00:00
|
|
|
LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
|
|
|
|
|
2011-11-24 06:56:57 +00:00
|
|
|
LIBXML2 = $(shell $(XML2CONFIG) --libs)
|
|
|
|
LIBXSLT = $(shell $(XSLCONFIG) --libs)
|
|
|
|
XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
|
|
|
|
GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
|
|
|
|
GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
|
|
|
|
CFLAGS += $(shell $(XSLCONFIG) --cflags)
|
|
|
|
|
2011-11-25 06:32:10 +00:00
|
|
|
ifeq ($(UNAME), linux)
|
|
|
|
LIBGCONF2 = $(shell $(PKGCONFIG) --libs gconf-2.0)
|
|
|
|
GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
|
2011-11-24 06:56:57 +00:00
|
|
|
OSSUPPORT = linux
|
|
|
|
OSSUPPORT_CFLAGS = $(GTK2CFLAGS) $(GCONF2CFLAGS)
|
2011-11-25 06:32:10 +00:00
|
|
|
else ifeq ($(UNAME), darwin)
|
2011-11-24 06:56:57 +00:00
|
|
|
OSSUPPORT = macos
|
|
|
|
OSSUPPORT_CFLAGS = $(GTK2CFLAGS)
|
2011-12-14 19:22:12 +00:00
|
|
|
MACOSXINSTALL = /Applications/Subsurface.app
|
|
|
|
MACOSXFILES = packaging/macosx
|
2012-01-03 19:18:04 +00:00
|
|
|
EXTRALIBS = $(shell $(PKGCONFIG) --libs gtk-mac-integration) -framework CoreFoundation
|
|
|
|
CFLAGS += $(shell $(PKGCONFIG) --cflags gtk-mac-integration)
|
2011-11-24 06:56:57 +00:00
|
|
|
else
|
|
|
|
OSSUPPORT = windows
|
|
|
|
OSSUPPORT_CFLAGS = $(GTK2CFLAGS)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(LIBXSLT)),)
|
|
|
|
# We still need proper paths and install options for OSX and Windows
|
|
|
|
ifeq ($(shell sh -c 'uname -s 2>/dev/null || echo not'),Linux)
|
|
|
|
XSLT=-DXSLT='"$(XSLTDIR)"'
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-12-14 19:22:12 +00:00
|
|
|
LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) -lpthread
|
2011-09-20 10:22:45 +00:00
|
|
|
|
2011-09-12 16:19:21 +00:00
|
|
|
OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
|
2011-09-20 19:40:34 +00:00
|
|
|
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
|
2011-11-24 06:56:57 +00:00
|
|
|
gtk-gui.o statistics.o $(OSSUPPORT).o $(RESFILE)
|
2011-08-31 17:20:46 +00:00
|
|
|
|
2011-09-27 16:43:53 +00:00
|
|
|
$(NAME): $(OBJS)
|
|
|
|
$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
|
2011-08-31 01:40:25 +00:00
|
|
|
|
2011-09-27 16:43:53 +00:00
|
|
|
install: $(NAME)
|
2011-10-17 13:53:59 +00:00
|
|
|
$(INSTALL) -d -m 755 $(BINDIR)
|
|
|
|
$(INSTALL) $(NAME) $(BINDIR)
|
2011-10-11 22:58:38 +00:00
|
|
|
$(INSTALL) -d -m 755 $(DESKTOPDIR)
|
|
|
|
$(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR)
|
|
|
|
$(INSTALL) -d -m 755 $(ICONDIR)
|
|
|
|
$(INSTALL) $(ICONFILE) $(ICONDIR)
|
2011-10-31 20:05:55 +00:00
|
|
|
@-if test -z "$(DESTDIR)"; then \
|
|
|
|
$(gtk_update_icon_cache); \
|
|
|
|
fi
|
2011-10-24 11:12:44 +00:00
|
|
|
$(INSTALL) -d -m 755 $(MANDIR)
|
|
|
|
$(INSTALL) -m 644 $(MANFILES) $(MANDIR)
|
2011-11-05 10:39:17 +00:00
|
|
|
@-if test ! -z "$(XSLT)"; then \
|
|
|
|
$(INSTALL) -d -m 755 $(DATADIR)/subsurface; \
|
|
|
|
$(INSTALL) -d -m 755 $(XSLTDIR); \
|
|
|
|
$(INSTALL) -m 644 $(XSLTFILES) $(XSLTDIR); \
|
|
|
|
fi
|
2011-09-23 03:59:10 +00:00
|
|
|
|
2011-10-16 21:16:36 +00:00
|
|
|
install-macosx: $(NAME)
|
|
|
|
$(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/Resources
|
|
|
|
$(INSTALL) -d -m 755 $(MACOSXINSTALL)/Contents/MacOS
|
|
|
|
$(INSTALL) $(NAME) $(MACOSXINSTALL)/Contents/MacOS/
|
2011-10-30 21:27:33 +00:00
|
|
|
$(INSTALL) $(MACOSXFILES)/PkgInfo $(MACOSXINSTALL)/Contents/
|
|
|
|
$(INSTALL) $(MACOSXFILES)/Info.plist $(MACOSXINSTALL)/Contents/
|
|
|
|
$(INSTALL) $(ICONFILE) $(MACOSXINSTALL)/Contents/Resources/
|
|
|
|
$(INSTALL) $(MACOSXFILES)/Subsurface.icns $(MACOSXINSTALL)/Contents/Resources/
|
2011-10-16 21:16:36 +00:00
|
|
|
|
2011-09-01 17:09:53 +00:00
|
|
|
parse-xml.o: parse-xml.c dive.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) $(XSLT) -c parse-xml.c
|
2011-08-31 01:40:25 +00:00
|
|
|
|
2011-09-01 23:27:52 +00:00
|
|
|
save-xml.o: save-xml.c dive.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c save-xml.c
|
2011-09-01 23:27:52 +00:00
|
|
|
|
2011-09-03 20:19:26 +00:00
|
|
|
dive.o: dive.c dive.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c dive.c
|
2011-09-03 20:19:26 +00:00
|
|
|
|
2011-09-05 19:12:58 +00:00
|
|
|
main.o: main.c dive.h display.h divelist.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) $(GCONF2CFLAGS) $(XML2CFLAGS) -c main.c
|
2011-08-31 17:20:46 +00:00
|
|
|
|
2011-09-05 19:12:58 +00:00
|
|
|
profile.o: profile.c dive.h display.h divelist.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c profile.c
|
2011-08-31 17:27:58 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
info.o: info.c dive.h display.h display-gtk.h divelist.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c info.c
|
2011-08-31 19:09:19 +00:00
|
|
|
|
2011-09-10 00:10:17 +00:00
|
|
|
equipment.o: equipment.c dive.h display.h divelist.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c equipment.c
|
2011-09-09 15:38:48 +00:00
|
|
|
|
2011-11-02 16:10:57 +00:00
|
|
|
statistics.o: statistics.c dive.h display.h divelist.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c statistics.c
|
2011-11-02 16:10:57 +00:00
|
|
|
|
2011-09-05 19:12:58 +00:00
|
|
|
divelist.o: divelist.c dive.h display.h divelist.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c divelist.c
|
2011-09-12 16:19:21 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
print.o: print.c dive.h display.h display-gtk.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c print.c
|
2011-09-13 23:02:42 +00:00
|
|
|
|
2011-09-20 19:40:34 +00:00
|
|
|
libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecomputer.h
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) \
|
2011-10-17 13:54:01 +00:00
|
|
|
$(LIBDIVECOMPUTERCFLAGS) \
|
2011-09-12 16:19:21 +00:00
|
|
|
-c libdivecomputer.c
|
2011-09-15 04:00:49 +00:00
|
|
|
|
2011-10-24 08:23:09 +00:00
|
|
|
gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h Makefile
|
2011-11-19 17:28:31 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(GCONF2CFLAGS) $(XML2CFLAGS) \
|
2011-10-17 13:54:01 +00:00
|
|
|
$(LIBDIVECOMPUTERCFLAGS) \
|
2011-09-26 18:04:50 +00:00
|
|
|
-DVERSION_STRING='"v$(VERSION)"' \
|
2011-09-20 19:40:34 +00:00
|
|
|
-c gtk-gui.c
|
|
|
|
|
2011-11-19 17:28:31 +00:00
|
|
|
uemis.o: uemis.c dive.h uemis.h
|
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(XML2CFLAGS) -c uemis.c
|
2011-09-27 16:43:53 +00:00
|
|
|
|
2011-11-24 06:56:57 +00:00
|
|
|
$(OSSUPPORT).o: $(OSSUPPORT).c display-gtk.h
|
|
|
|
$(CC) $(CFLAGS) $(OSSUPPORT_CFLAGS) -c $(OSSUPPORT).c
|
|
|
|
|
First try at converting user-manual to AsciiDoc
You can do "make doc" in the main directory to create the html version,
and if you want to play around with it, do "make show" in the
Documentation subdirectory to start firefox on the end result.
It's by no means perfect, but it gives somewhat reasonable results, and
this is enough initial work for people to play around with, I think.
NOTE! You need "asciidoc" installed to do this: it's a python program,
so it should be pretty easy even on non-Linux platforms. And on Linux,
most distributions package it, so you just have to do something like
yum install asciidoc
to get it (replace with apt-get/zypper/whatever).
Asciidoc can generate other output too (man-pages, LaTeX, etc), maybe
people want to play with that part too.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-01 23:12:28 +00:00
|
|
|
doc:
|
|
|
|
$(MAKE) -C Documentation doc
|
|
|
|
|
2011-09-27 16:43:53 +00:00
|
|
|
clean:
|
|
|
|
rm -f $(OBJS) *~ $(NAME)
|