]> git.tdb.fi Git - ext/subsurface.git/blob - Makefile
Since we don't want configure, use gnumake to find libdivecomputer
[ext/subsurface.git] / Makefile
1 VERSION=1.0
2
3 CC=gcc
4 CFLAGS=-Wall -Wno-pointer-sign -g
5 INSTALL=install
6
7 prefix = $(HOME)
8 DESTDIR = $(prefix)/bin
9 NAME = subsurface
10
11 # find libdivecomputer; we don't trust pkg-config here given how young
12 # libdivecomputer still is - so we check /usr/local and /usr and then we
13 # give up. You can override by simply setting it here
14 #
15 libdc-local := $(wildcard /usr/local/include/libdivecomputer/*)
16 libdc-usr := $(wildcard /usr/include/libdivecomputer/*)
17
18 ifneq ($(strip $(libdc-local)),)
19         LIBDIVECOMPUTERDIR = /usr/local
20         LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
21         LIBDIVECOMPUTERARCHIVE = -L$(LIBDIVECOMPUTERDIR)/lib -ldivecomputer
22 else ifneq ($(strip $(libdc-usr)),)
23         LIBDIVECOMPUTERDIR = /usr
24         LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
25         LIBDIVECOMPUTERARCHIVE = -ldivecomputer
26 else
27         $(error Cannot find libdivecomputer - please edit Makefile)
28 endif
29
30 # Libusb-1.0 is only required if libdivecomputer was built with it.
31 # And libdivecomputer is only built with it if libusb-1.0 is
32 # installed. So get libusb if it exists, but don't complain
33 # about it if it doesn't.
34 LIBUSB = $(shell pkg-config --libs libusb-1.0 2> /dev/null)
35
36 LIBXML2 = $(shell xml2-config --libs)
37 LIBGTK = $(shell pkg-config --libs gtk+-2.0 glib-2.0 gconf-2.0)
38 LIBDIVECOMPUTER = $(LIBDIVECOMPUTERARCHIVE) $(LIBUSB)
39
40 LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
41
42 OBJS =  main.o dive.o profile.o info.o equipment.o divelist.o \
43         parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
44         gtk-gui.o
45
46 $(NAME): $(OBJS)
47         $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
48
49 install: $(NAME)
50         $(INSTALL) -d -m 755 '$(DESTDIR)'
51         $(INSTALL) $(NAME) '$(DESTDIR)'
52
53 parse-xml.o: parse-xml.c dive.h
54         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags`  parse-xml.c
55
56 save-xml.o: save-xml.c dive.h
57         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c save-xml.c
58
59 dive.o: dive.c dive.h
60         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c dive.c
61
62 main.o: main.c dive.h display.h divelist.h
63         $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0 gconf-2.0` \
64                 -c main.c
65
66 profile.o: profile.c dive.h display.h divelist.h
67         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c profile.c
68
69 info.o: info.c dive.h display.h display-gtk.h divelist.h
70         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c info.c
71
72 equipment.o: equipment.c dive.h display.h divelist.h
73         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c equipment.c
74
75 divelist.o: divelist.c dive.h display.h divelist.h
76         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c divelist.c
77
78 print.o: print.c dive.h display.h display-gtk.h
79         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c print.c
80
81 libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecomputer.h
82         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` \
83                         -I$(LIBDIVECOMPUTERINCLUDES) \
84                         -c libdivecomputer.c
85
86 gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h
87         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0 gconf-2.0` \
88                         -I$(LIBDIVECOMPUTERINCLUDES) \
89                         -DVERSION_STRING='"v$(VERSION)"' \
90                         -c gtk-gui.c
91
92 uemis.o: uemis.c uemis.h
93         $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c uemis.c
94
95 clean:
96         rm -f $(OBJS) *~ $(NAME)