4 CFLAGS=-Wall -Wno-pointer-sign -g
7 # these locations seem to work for SuSE and Fedora
9 prefix = $(DESTDIR)/usr
10 BINDIR = $(prefix)/bin
11 DATADIR = $(prefix)/share
12 DESKTOPDIR = $(DATADIR)/applications
13 ICONPATH = $(DATADIR)/icons/hicolor
14 ICONDIR = $(ICONPATH)/scalable/apps
15 MANDIR = $(DATADIR)/man/man1
16 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(ICONPATH)
19 ICONFILE = $(NAME).svg
20 DESKTOPFILE = $(NAME).desktop
23 # find libdivecomputer; we don't trust pkg-config here given how young
24 # libdivecomputer still is - so we check /usr/local and /usr and then we
25 # give up. You can override by simply setting it here
27 libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
28 libdc-local64 := $(wildcard /usr/local/lib64/libdivecomputer.a)
29 libdc-usr := $(wildcard /usr/lib/libdivecomputer.a)
30 libdc-usr64 := $(wildcard /usr/lib64/libdivecomputer.a)
32 ifneq ($(strip $(libdc-local)),)
33 LIBDIVECOMPUTERDIR = /usr/local
34 LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
35 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
36 else ifneq ($(strip $(libdc-local64)),)
37 LIBDIVECOMPUTERDIR = /usr/local
38 LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
39 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
40 else ifneq ($(strip $(libdc-usr)),)
41 LIBDIVECOMPUTERDIR = /usr
42 LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
43 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
44 else ifneq ($(strip $(libdc-usr64)),)
45 LIBDIVECOMPUTERDIR = /usr
46 LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
47 LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
49 $(error Cannot find libdivecomputer - please edit Makefile)
52 # Libusb-1.0 is only required if libdivecomputer was built with it.
53 # And libdivecomputer is only built with it if libusb-1.0 is
54 # installed. So get libusb if it exists, but don't complain
55 # about it if it doesn't.
56 LIBUSB = $(shell pkg-config --libs libusb-1.0 2> /dev/null)
58 # it appears that xml2-config isn't included in the libxml2 package for
59 # MinGW - so under Windows you may want to replace this with a hardcoded
60 # path to the installdir - something like
61 # LIBXML2 = -L/c/opt/gtk/lib -lxml2
62 LIBXML2 = $(shell xml2-config --libs)
63 LIBGTK = $(shell pkg-config --libs gtk+-2.0 glib-2.0 gconf-2.0)
64 LIBDIVECOMPUTERCFLAGS = -I$(LIBDIVECOMPUTERINCLUDES)
65 LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
67 LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
69 OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
70 parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
74 $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
77 $(INSTALL) -d -m 755 $(BINDIR)
78 $(INSTALL) $(NAME) $(BINDIR)
79 $(INSTALL) -d -m 755 $(DESKTOPDIR)
80 $(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR)
81 $(INSTALL) -d -m 755 $(ICONDIR)
82 $(INSTALL) $(ICONFILE) $(ICONDIR)
83 $(gtk_update_icon_cache)
84 $(INSTALL) -d -m 755 $(MANDIR)
85 $(INSTALL) -m 644 $(MANFILES) $(MANDIR)
87 # it appears that xml2-config isn't included in the libxml2 package for
88 # MinGW - so under Windows you may want to replace this with a hardcoded
89 # path to the inclde dir - something like
91 # XML2INCLUDE = -I/c/opt/gtk/include/libxml2
93 # parse-xml.o: parse-xml.c dive.h
94 # $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c $(XML2INCLUDE) parse-xml.c
97 parse-xml.o: parse-xml.c dive.h
98 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags` parse-xml.c
100 save-xml.o: save-xml.c dive.h
101 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c save-xml.c
103 dive.o: dive.c dive.h
104 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c dive.c
106 main.o: main.c dive.h display.h divelist.h
107 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0 gconf-2.0` \
110 profile.o: profile.c dive.h display.h divelist.h
111 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c profile.c
113 info.o: info.c dive.h display.h display-gtk.h divelist.h
114 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c info.c
116 equipment.o: equipment.c dive.h display.h divelist.h
117 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c equipment.c
119 divelist.o: divelist.c dive.h display.h divelist.h
120 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c divelist.c
122 print.o: print.c dive.h display.h display-gtk.h
123 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c print.c
125 libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecomputer.h
126 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` \
127 $(LIBDIVECOMPUTERCFLAGS) \
130 gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h Makefile
131 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0 gconf-2.0` \
132 $(LIBDIVECOMPUTERCFLAGS) \
133 -DVERSION_STRING='"v$(VERSION)"' \
136 uemis.o: uemis.c uemis.h
137 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c uemis.c
140 rm -f $(OBJS) *~ $(NAME)