4 CFLAGS=-Wall -Wno-pointer-sign -g
9 # these locations seem to work for SuSE and Fedora
11 prefix = $(DESTDIR)/usr
12 BINDIR = $(prefix)/bin
13 DATADIR = $(prefix)/share
14 DESKTOPDIR = $(DATADIR)/applications
15 ICONPATH = $(DATADIR)/icons/hicolor
16 ICONDIR = $(ICONPATH)/scalable/apps
17 MANDIR = $(DATADIR)/man/man1
18 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(ICONPATH)
21 ICONFILE = $(NAME).svg
22 DESKTOPFILE = $(NAME).desktop
25 # find libdivecomputer
26 # First deal with the cross compile environment.
27 # For the native case, Linus doesn't want to trust pkg-config given
28 # how young libdivecomputer still is - so we check the typical
29 # subdirectories of /usr/local and /usr and then we give up. You can
30 # override by simply setting it here
32 ifeq ($(CC), i686-w64-mingw32-gcc)
33 # ok, we are cross building for Windows
34 LIBDIVECOMPUTERDIR = /usr/i686-w64-mingw32/sys-root/mingw/include/libdivecomputer
35 LIBDIVECOMPUTERINCLUDES = `$(PKGCONFIG) --cflags libdivecomputer`
36 LIBDIVECOMPUTERARCHIVE = `$(PKGCONFIG) --libs libdivecomputer`
39 libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
40 libdc-local64 := $(wildcard /usr/local/lib64/libdivecomputer.a)
41 libdc-usr := $(wildcard /usr/lib/libdivecomputer.a)
42 libdc-usr64 := $(wildcard /usr/lib64/libdivecomputer.a)
44 ifneq ($(strip $(libdc-local)),)
45 LIBDIVECOMPUTERDIR = /usr/local
46 LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
47 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
48 else ifneq ($(strip $(libdc-local64)),)
49 LIBDIVECOMPUTERDIR = /usr/local
50 LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
51 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
52 else ifneq ($(strip $(libdc-usr)),)
53 LIBDIVECOMPUTERDIR = /usr
54 LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
55 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
56 else ifneq ($(strip $(libdc-usr64)),)
57 LIBDIVECOMPUTERDIR = /usr
58 LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
59 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
61 $(error Cannot find libdivecomputer - please edit Makefile)
65 # Libusb-1.0 is only required if libdivecomputer was built with it.
66 # And libdivecomputer is only built with it if libusb-1.0 is
67 # installed. So get libusb if it exists, but don't complain
68 # about it if it doesn't.
69 LIBUSB = $(shell $(PKGCONFIG) --libs libusb-1.0 2> /dev/null)
71 LIBGTK = $(shell $(PKGCONFIG) --libs gtk+-2.0 glib-2.0 gconf-2.0)
72 LIBDIVECOMPUTERCFLAGS = $(LIBDIVECOMPUTERINCLUDES)
73 LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
75 LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
77 OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
78 parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
82 $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
85 $(INSTALL) -d -m 755 $(BINDIR)
86 $(INSTALL) $(NAME) $(BINDIR)
87 $(INSTALL) -d -m 755 $(DESKTOPDIR)
88 $(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR)
89 $(INSTALL) -d -m 755 $(ICONDIR)
90 $(INSTALL) $(ICONFILE) $(ICONDIR)
91 $(gtk_update_icon_cache)
92 $(INSTALL) -d -m 755 $(MANDIR)
93 $(INSTALL) -m 644 $(MANFILES) $(MANDIR)
95 LIBXML2 = $(shell $(XML2CONFIG) --libs)
96 XML2CFLAGS = $(shell $(XML2CONFIG) --cflags)
97 GLIB2CFLAGS = $(shell $(PKGCONFIG) --cflags glib-2.0)
98 GCONF2CFLAGS = $(shell $(PKGCONFIG) --cflags gconf-2.0)
99 GTK2CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-2.0)
101 parse-xml.o: parse-xml.c dive.h
102 $(CC) $(CFLAGS) $(GLIB2CFLAGS) -c $(XML2CFLAGS) parse-xml.c
104 save-xml.o: save-xml.c dive.h
105 $(CC) $(CFLAGS) $(GLIB2CFLAGS) -c save-xml.c
107 dive.o: dive.c dive.h
108 $(CC) $(CFLAGS) $(GLIB2CFLAGS) -c dive.c
110 main.o: main.c dive.h display.h divelist.h
111 $(CC) $(CFLAGS) $(GLIB2CFLAGS) $(GCONF2CFLAGS) -c main.c
113 profile.o: profile.c dive.h display.h divelist.h
114 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c profile.c
116 info.o: info.c dive.h display.h display-gtk.h divelist.h
117 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c info.c
119 equipment.o: equipment.c dive.h display.h divelist.h
120 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c equipment.c
122 divelist.o: divelist.c dive.h display.h divelist.h
123 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c divelist.c
125 print.o: print.c dive.h display.h display-gtk.h
126 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c print.c
128 libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecomputer.h
129 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) \
130 $(LIBDIVECOMPUTERCFLAGS) \
133 gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h Makefile
134 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) $(GCONF2CFLAGS) \
135 $(LIBDIVECOMPUTERCFLAGS) \
136 -DVERSION_STRING='"v$(VERSION)"' \
139 uemis.o: uemis.c uemis.h
140 $(CC) $(CFLAGS) $(GTK2CFLAGS) $(GLIB2CFLAGS) -c uemis.c
143 rm -f $(OBJS) *~ $(NAME)