4 CFLAGS=-Wall -Wno-pointer-sign -g
7 # these locations seem to work for SuSE and Fedora
10 DESTDIR = $(prefix)/bin
11 DESKTOPDIR = $(prefix)/share/applications
12 ICONPATH = $(prefix)/share/icons/hicolor
13 ICONDIR = $(ICONPATH)/scalable/apps
14 gtk_update_icon_cache = gtk-update-icon-cache -f -t $(ICONPATH)
17 ICONFILE = $(NAME).svg
18 DESKTOPFILE = $(NAME).desktop
20 # find libdivecomputer; we don't trust pkg-config here given how young
21 # libdivecomputer still is - so we check /usr/local and /usr and then we
22 # give up. You can override by simply setting it here
24 libdc-local := $(wildcard /usr/local/include/libdivecomputer/*)
25 libdc-usr := $(wildcard /usr/include/libdivecomputer/*)
27 ifneq ($(strip $(libdc-local)),)
28 LIBDIVECOMPUTERDIR = /usr/local
29 LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
30 LIBDIVECOMPUTERARCHIVE = -L$(LIBDIVECOMPUTERDIR)/lib -ldivecomputer
31 else ifneq ($(strip $(libdc-usr)),)
32 LIBDIVECOMPUTERDIR = /usr
33 LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
34 LIBDIVECOMPUTERARCHIVE = -ldivecomputer
36 $(error Cannot find libdivecomputer - please edit Makefile)
39 # Libusb-1.0 is only required if libdivecomputer was built with it.
40 # And libdivecomputer is only built with it if libusb-1.0 is
41 # installed. So get libusb if it exists, but don't complain
42 # about it if it doesn't.
43 LIBUSB = $(shell pkg-config --libs libusb-1.0 2> /dev/null)
45 LIBXML2 = $(shell xml2-config --libs)
46 LIBGTK = $(shell pkg-config --libs gtk+-2.0 glib-2.0 gconf-2.0)
47 LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
49 LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
51 OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
52 parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
56 $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
59 $(INSTALL) -d -m 755 $(DESTDIR)
60 $(INSTALL) $(NAME) $(DESTDIR)
61 $(INSTALL) -d -m 755 $(DESKTOPDIR)
62 $(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR)
63 $(INSTALL) -d -m 755 $(ICONDIR)
64 $(INSTALL) $(ICONFILE) $(ICONDIR)
65 $(gtk_update_icon_cache)
67 parse-xml.o: parse-xml.c dive.h
68 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags` parse-xml.c
70 save-xml.o: save-xml.c dive.h
71 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c save-xml.c
74 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c dive.c
76 main.o: main.c dive.h display.h divelist.h
77 $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0 gconf-2.0` \
80 profile.o: profile.c dive.h display.h divelist.h
81 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c profile.c
83 info.o: info.c dive.h display.h display-gtk.h divelist.h
84 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c info.c
86 equipment.o: equipment.c dive.h display.h divelist.h
87 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c equipment.c
89 divelist.o: divelist.c dive.h display.h divelist.h
90 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c divelist.c
92 print.o: print.c dive.h display.h display-gtk.h
93 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c print.c
95 libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecomputer.h
96 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` \
97 -I$(LIBDIVECOMPUTERINCLUDES) \
100 gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h
101 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0 gconf-2.0` \
102 -I$(LIBDIVECOMPUTERINCLUDES) \
103 -DVERSION_STRING='"v$(VERSION)"' \
106 uemis.o: uemis.c uemis.h
107 $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c uemis.c
110 rm -f $(OBJS) *~ $(NAME)