annotate Makefile @ 548:e18843dc0aea

Implement a rudimentary API for audioDB::liszt The API is rudimentary because we've dropped support for the incremental retrieval of tracks and their number of vectors (at the API level; the SOAP and command-line support is still there -- no changes should be visible). This is potentially bad for the large-scale databases, of course; one million tracks will take of the order of 16MB of RAM, more if I'm unlucky about how std::string.c_str() is implemented. Both this liszt operation and querying (and sampling, forthcoming...) would benefit from a `cursor-like' interface to retrieval results: for an API like that, instead of getting a struct with the data there, you get a cookie with which you can ask the database for successive results. This would be neat for all sorts of reasons. In the meantime, at least this change fixes SOAP memory leaks related to liszt. Make liszt.o part of LIBOBJS rather than ordinary OBJS, so that the liszt functionality is actually compiled into the library. Add a test for this library functionality; also modify the command-line test file to run the SOAP server on its own port.
author mas01cr
date Wed, 11 Feb 2009 12:38:03 +0000
parents 57e459f62788
children 0694bb74c5e9
rev   line source
mas01cr@137 1 HELP2MAN=help2man
mas01cr@137 2 GENGETOPT=gengetopt
mas01cr@137 3 SOAPCPP2=soapcpp2
mas01cr@138 4 GSOAP_CPP=-lgsoap++
mas01cr@281 5 LIBGSL=-lgsl -lgslcblas
map01bf@282 6 GSL_INCLUDE=
mas01cr@138 7 GSOAP_INCLUDE=
mas01cr@137 8
map01bf@374 9 SHARED_LIB_FLAGS=-shared -Wl,-soname,
map01bf@374 10
mas01cr@548 11 LIBOBJS=lock.o pointpair.o create.o open.o power.o l2norm.o insert.o status.o query.o dump.o close.o lshlib.o index-utils.o query-indexed.o liszt.o
mas01cr@548 12 OBJS=$(LIBOBJS) index.o soap.o sample.o cmdline.o audioDB.o common.o
map01bf@374 13
map01bf@374 14 EXECUTABLE=audioDB
map01bf@374 15
map01bf@374 16 SOVERSION=0
map01bf@374 17 MINORVERSION=0
map01bf@374 18 LIBRARY=lib$(EXECUTABLE).so.$(SOVERSION).$(MINORVERSION)
map01bf@374 19
mas01mc@534 20 override CFLAGS+=-g -O3 -fPIC
mas01mc@534 21
mas01mc@534 22 # set to generate profile (gprof) and coverage (gcov) info
mas01mc@534 23 #override CFLAGS+=-fprofile-arcs -ftest-coverage -pg
mas01mc@513 24
mas01mc@513 25 # set to DUMP hashtables on QUERY load
mas01mc@513 26 #override CFLAGS+=-DLSH_DUMP_CORE_TABLES
mas01cr@244 27
mas01cr@239 28 ifeq ($(shell uname),Linux)
mas01cr@239 29 override CFLAGS+=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
mas01cr@239 30 endif
mas01cr@137 31
mas01cr@244 32 ifeq ($(shell uname),Darwin)
mas01cr@244 33 ifeq ($(shell sysctl -n hw.optional.x86_64),1)
mas01mc@315 34 override CFLAGS+=-arch x86_64
mas01cr@244 35 endif
map01bf@374 36 override SHARED_LIB_FLAGS=-dynamiclib -current_version $(SOVERSION).$(MINORVERSION) -Wl -install_name
map01bf@374 37 override LIBRARY=lib$(EXECUTABLE).$(SOVERSION).$(MINORVERSION).dylib
mas01cr@244 38 endif
mas01cr@244 39
mas01cr@72 40 .PHONY: all clean test
mas01cr@72 41
mas01cr@371 42 all: $(LIBRARY) $(EXECUTABLE)
mas01cr@2 43
mas01ik@355 44 $(EXECUTABLE).1: $(EXECUTABLE)
mas01ik@355 45 $(HELP2MAN) ./$(EXECUTABLE) > $(EXECUTABLE).1
mas01cr@0 46
mas01ik@355 47 HELP.txt: $(EXECUTABLE)
mas01ik@355 48 ./$(EXECUTABLE) --help > HELP.txt
mas01cr@3 49
mas01cr@1 50 cmdline.c cmdline.h: gengetopt.in
mas01ik@355 51 $(GENGETOPT) -e <gengetopt.in
mas01cr@1 52
mas01cr@506 53 soapServer.cpp soapClient.cpp soapC.cpp soapH.h adb.nsmap: audioDBws.h
mas01ik@355 54 $(SOAPCPP2) audioDBws.h
mas01cr@1 55
mas01cr@509 56 $(LIBOBJS): %.o: %.cpp audioDB_API.h audioDB-internals.h accumulator.h accumulators.h
mas01cr@503 57 g++ -c $(CFLAGS) $(GSL_INCLUDE) -Wall $<
mas01cr@503 58
mas01cr@498 59 %.o: %.cpp audioDB.h audioDB_API.h adb.nsmap cmdline.h reporter.h ReporterBase.h lshlib.h
mas01ik@355 60 g++ -c $(CFLAGS) $(GSOAP_INCLUDE) $(GSL_INCLUDE) -Wall $<
mas01cr@239 61
mas01cr@345 62 cmdline.o: cmdline.c cmdline.h
mas01ik@355 63 gcc -c $(CFLAGS) $<
mas01cr@345 64
mas01cr@371 65 $(EXECUTABLE): $(OBJS) soapServer.cpp soapClient.cpp soapC.cpp
mas01cr@371 66 g++ -o $(EXECUTABLE) $(CFLAGS) $^ $(LIBGSL) $(GSOAP_INCLUDE) $(GSOAP_CPP)
mas01ik@355 67
mas01cr@498 68 $(LIBRARY): $(LIBOBJS)
map01bf@374 69 g++ $(SHARED_LIB_FLAGS)$(LIBRARY) -o $(LIBRARY) $(CFLAGS) $(LIBGSL) $^
mas01ik@355 70
mas01ik@355 71 tags:
mas01ik@355 72 ctags *.cpp *.h
mas01ik@355 73
mas01cr@2 74
mas01cr@2 75 clean:
mas01mc@475 76 -rm cmdline.c cmdline.h cmdline.o
mas01cr@2 77 -rm soapServer.cpp soapClient.cpp soapC.cpp soapObject.h soapStub.h soapProxy.h soapH.h soapServerLib.cpp soapClientLib.cpp
mas01ik@355 78 -rm adb.*
mas01cr@135 79 -rm HELP.txt
mas01ik@355 80 -rm $(EXECUTABLE) $(EXECUTABLE).1 $(OBJS)
mas01cr@281 81 -rm xthresh
mas01cr@59 82 -sh -c "cd tests && sh ./clean.sh"
mas01ik@355 83 -sh -c "cd libtests && sh ./clean.sh"
mas01cr@498 84 -rm $(LIBRARY)
mas01ik@355 85 -rm tags
mas01cr@72 86
mas01cr@372 87 distclean: clean
mas01ik@355 88 -rm *.o
mas01ik@355 89 -rm -rf audioDB.dump
mas01ik@355 90
mas01ik@355 91
mas01ik@355 92 test: $(EXECUTABLE)
mas01cr@509 93 sh -c "cd libtests && sh ./run-tests.sh"
mas01cr@509 94 sh -c "cd tests && sh ./run-tests.sh"
mas01cr@280 95
mas01cr@280 96 xthresh: xthresh.c
mas01ik@355 97 gcc -o $@ $(CFLAGS) $(GSL_INCLUDE) $(LIBGSL) $<
mas01ik@355 98
mas01ik@355 99 install:
mas01ik@355 100 cp $(LIBRARY) /usr/local/lib/
mas01cr@373 101 ln -sf /usr/local/lib/$(LIBRARY) /usr/local/lib/lib$(EXECUTABLE).so.$(SOVERSION)
mas01cr@373 102 ln -sf /usr/local/lib/lib$(EXECUTABLE).so.$(SOVERSION) /usr/local/lib/lib$(EXECUTABLE).so
mas01ik@355 103 ldconfig
mas01ik@355 104 cp audioDB_API.h /usr/local/include/