subsurface/Makefile
Linus Torvalds 8c18add46b Do libdivecomputer imports in a separate thread
This is the hackiest thing ever, unless you count the previous code that
was even hackier (and just called the gtk main routine at random
places).

The libdivecomputer library is not really set up to be part of the gtk
main loop, and cannot afford (for example) to have lots of mainloop
events while it's parsing.  Some dive computers are very timing
sensitive for the communication.

So just start a thread for doing the libdivecomputer stuff, and just
continually call the gtk main loop while that thread is running.  I'm
sure we could actually use some gtk signalling thing to make the thread
exit do the right thing, but instead we just poll the status every
100ms.

I did say it was hacky.  It does seem to work, though.  No more
temporary graying out of the windows when they don't react in a timely
manner because libdivecomputer does some blocking operation.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-09-15 22:58:02 -07:00

51 lines
1.7 KiB
Makefile

CC=gcc
CFLAGS=-Wall -Wno-pointer-sign -g
LIBDIVECOMPUTERDIR = /usr/local
LIBDIVECOMPUTERINCLUDES = $(LIBDIVECOMPUTERDIR)/include/libdivecomputer
LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
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
subsurface: $(OBJS)
$(CC) $(LDFLAGS) -o subsurface $(OBJS) \
`xml2-config --libs` \
`pkg-config --libs gtk+-2.0 glib-2.0 gconf-2.0` \
$(LIBDIVECOMPUTERARCHIVE) -lpthread
parse-xml.o: parse-xml.c dive.h
$(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags` parse-xml.c
save-xml.o: save-xml.c dive.h
$(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c save-xml.c
dive.o: dive.c dive.h
$(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c dive.c
main.o: main.c dive.h display.h divelist.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0 gconf-2.0` \
-c main.c
profile.o: profile.c dive.h display.h divelist.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c profile.c
info.o: info.c dive.h display.h divelist.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c info.c
equipment.o: equipment.c dive.h display.h divelist.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c equipment.c
divelist.o: divelist.c dive.h display.h divelist.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c divelist.c
print.o: print.c dive.h display.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c print.c
libdivecomputer.o: libdivecomputer.c dive.h display.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` \
-I$(LIBDIVECOMPUTERINCLUDES) \
-c libdivecomputer.c
uemis.o: uemis.c uemis.h
$(CC) $(CFLAGS) `pkg-config --cflags gtk+-2.0 glib-2.0` -c uemis.c