X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=Makefile;h=47835d306ce7d93c446b7f753035bee28bfa8c6e;hb=bd8948386d555560477238dc09921b83f07b48b2;hp=e93d03030c0f68ac3a568a3bcc96182078136a61;hpb=1e42dc10e5df52822fff698573cae97b2efb3220;p=ext%2Fsubsurface.git diff --git a/Makefile b/Makefile index e93d030..47835d3 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,31 @@ +VERSION=1.0 + CC=gcc CFLAGS=-Wall -Wno-pointer-sign -g INSTALL=install prefix = $(HOME) DESTDIR = $(prefix)/bin - -LIBDIVECOMPUTERDIR = /usr/local -LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer -LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a +NAME = subsurface + +# find libdivecomputer; we don't trust pkg-config here given how young +# libdivecomputer still is - so we check /usr/local and /usr and then we +# give up. You can override by simply setting it here +# +libdc-local := $(wildcard /usr/local/include/libdivecomputer/*) +libdc-usr := $(wildcard /usr/include/libdivecomputer/*) + +ifneq ($(strip $(libdc-local)),) + LIBDIVECOMPUTERDIR = /usr/local + LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer + LIBDIVECOMPUTERARCHIVE = -L$(LIBDIVECOMPUTERDIR)/lib -ldivecomputer +else ifneq ($(strip $(libdc-usr)),) + LIBDIVECOMPUTERDIR = /usr + LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer + LIBDIVECOMPUTERARCHIVE = -ldivecomputer +else + $(error Cannot find libdivecomputer - please edit Makefile) +endif # Libusb-1.0 is only required if libdivecomputer was built with it. # And libdivecomputer is only built with it if libusb-1.0 is @@ -25,12 +43,12 @@ OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \ parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \ gtk-gui.o -subsurface: $(OBJS) - $(CC) $(LDFLAGS) -o subsurface $(OBJS) $(LIBS) +$(NAME): $(OBJS) + $(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS) -install: subsurface +install: $(NAME) $(INSTALL) -d -m 755 '$(DESTDIR)' - $(INSTALL) subsurface '$(DESTDIR)' + $(INSTALL) $(NAME) '$(DESTDIR)' parse-xml.o: parse-xml.c dive.h $(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags` parse-xml.c @@ -68,7 +86,11 @@ libdivecomputer.o: libdivecomputer.c dive.h display.h display-gtk.h libdivecompu gtk-gui.o: gtk-gui.c dive.h display.h divelist.h display-gtk.h libdivecomputer.h $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0 gconf-2.0` \ -I$(LIBDIVECOMPUTERINCLUDES) \ + -DVERSION_STRING='"v$(VERSION)"' \ -c gtk-gui.c uemis.o: uemis.c uemis.h $(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c uemis.c + +clean: + rm -f $(OBJS) *~ $(NAME)