]> git.tdb.fi Git - ext/subsurface.git/blob - Makefile
Install manpage
[ext/subsurface.git] / Makefile
1 VERSION=1.0
2
3 CC=gcc
4 CFLAGS=-Wall -Wno-pointer-sign -g
5 INSTALL=install
6
7 # these locations seem to work for SuSE and Fedora
8 # prefix = $(HOME)
9 prefix = /usr
10 DESTDIR = $(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)
17
18 NAME = subsurface
19 ICONFILE = $(NAME).svg
20 DESKTOPFILE = $(NAME).desktop
21 MANFILES = $(NAME).1
22
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
26 #
27 libdc-local := $(wildcard /usr/local/include/libdivecomputer/*)
28 libdc-usr := $(wildcard /usr/include/libdivecomputer/*)
29
30 ifneq ($(strip $(libdc-local)),)
31         LIBDIVECOMPUTERDIR = /usr/local
32         LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
33         LIBDIVECOMPUTERARCHIVE = -L$(LIBDIVECOMPUTERDIR)/lib -ldivecomputer
34 else ifneq ($(strip $(libdc-usr)),)
35         LIBDIVECOMPUTERDIR = /usr
36         LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
37         LIBDIVECOMPUTERARCHIVE = -ldivecomputer
38 else
39 $(error Cannot find libdivecomputer - please edit Makefile)
40 endif
41
42 # Libusb-1.0 is only required if libdivecomputer was built with it.
43 # And libdivecomputer is only built with it if libusb-1.0 is
44 # installed. So get libusb if it exists, but don't complain
45 # about it if it doesn't.
46 LIBUSB = $(shell pkg-config --libs libusb-1.0 2> /dev/null)
47
48 LIBXML2 = $(shell xml2-config --libs)
49 LIBGTK = $(shell pkg-config --libs gtk+-2.0 glib-2.0 gconf-2.0)
50 LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
51
52 LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
53
54 OBJS =  main.o dive.o profile.o info.o equipment.o divelist.o \
55         parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
56         gtk-gui.o
57
58 $(NAME): $(OBJS)
59         $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
60
61 install: $(NAME)
62         $(INSTALL) -d -m 755 $(DESTDIR)
63         $(INSTALL) $(NAME) $(DESTDIR)
64         $(INSTALL) -d -m 755 $(DESKTOPDIR)
65         $(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR)
66         $(INSTALL) -d -m 755 $(ICONDIR)
67         $(INSTALL) $(ICONFILE) $(ICONDIR)
68         $(gtk_update_icon_cache)
69         $(INSTALL) -m 644 $(MANFILES) $(MANDIR)
70
71 parse-xml.o: parse-xml.c dive.h
72         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags`  parse-xml.c
73
74 save-xml.o: save-xml.c dive.h
75         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c save-xml.c
76
77 dive.o: dive.c dive.h
78         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c dive.c
79
80 main.o: main.c dive.h display.h divelist.h
81         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0 gconf-2.0` \
82                 -c main.c
83
84 profile.o: profile.c dive.h display.h divelist.h
85         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c profile.c
86
87 info.o: info.c dive.h display.h display-gtk.h divelist.h
88         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c info.c
89
90 equipment.o: equipment.c dive.h display.h divelist.h
91         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c equipment.c
92
93 divelist.o: divelist.c dive.h display.h divelist.h
94         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c divelist.c
95
96 print.o: print.c dive.h display.h display-gtk.h
97         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c print.c
98
99 libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecomputer.h
100         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` \
101                         -I$(LIBDIVECOMPUTERINCLUDES) \
102                         -c libdivecomputer.c
103
104 gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h
105         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0 gconf-2.0` \
106                         -I$(LIBDIVECOMPUTERINCLUDES) \
107                         -DVERSION_STRING='"v$(VERSION)"' \
108                         -c gtk-gui.c
109
110 uemis.o: uemis.c uemis.h
111         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c uemis.c
112
113 clean:
114         rm -f $(OBJS) *~ $(NAME)