2011-10-24 08:23:09 +00:00
|
|
|
VERSION=1.1
|
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-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-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-08-30 21:36:34 +00:00
|
|
|
|
2011-10-16 21:16:36 +00:00
|
|
|
MACOSXINSTALL = /Applications/Subsurface.app
|
2011-10-30 21:27:33 +00:00
|
|
|
MACOSXFILES = packaging/macosx
|
2011-10-16 21:16:36 +00:00
|
|
|
|
2011-10-27 16:04:29 +00:00
|
|
|
# find libdivecomputer
|
|
|
|
# First deal with the cross compile environment.
|
|
|
|
# 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
|
|
|
|
LIBDIVECOMPUTERDIR = /usr/i686-w64-mingw32/sys-root/mingw/include/libdivecomputer
|
|
|
|
LIBDIVECOMPUTERINCLUDES = `$(PKGCONFIG) --cflags libdivecomputer`
|
|
|
|
LIBDIVECOMPUTERARCHIVE = `$(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-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)
|
|
|
|
|
|
|
|
LIBGTK = $(shell $(PKGCONFIG) --libs gtk+-2.0 glib-2.0 gconf-2.0)
|
|
|
|
LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES)
|
2011-09-22 19:21:20 +00:00
|
|
|
LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
|
|
|
|
|
|
|
|
LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -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-02 16:10:57 +00:00
|
|
|
gtk-gui.o statistics.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-09-23 03:59:10 +00:00
|
|
|
|
2011-10-27 16:04:29 +00:00
|
|
|
LIBXML2 = $(shell $(XML2CONFIG) --libs)
|
|
|
|
XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
|
|
|
|
GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
|
|
|
|
GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
|
|
|
|
GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
|
2011-10-24 19:24:51 +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)/subsurface.sh $(MACOSXINSTALL)/Contents/MacOS/
|
|
|
|
$(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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) -c $(XML2CFLAGS) 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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GLIB2CFLAGS) $(GCONF2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -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
|
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c statistics.c
|
|
|
|
|
2011-09-05 19:12:58 +00:00
|
|
|
divelist.o: divelist.c dive.h display.h divelist.h
|
2011-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) \
|
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-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(GCONF2CFLAGS) \
|
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-09-15 04:00:49 +00:00
|
|
|
uemis.o: uemis.c uemis.h
|
2011-10-27 16:04:29 +00:00
|
|
|
$(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c uemis.c
|
2011-09-27 16:43:53 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJS) *~ $(NAME)
|