annotate Makefile @ 496:8fb85fbcaba6 api-inversion

Mostly disentangle API from command-line binary. Now audioDB.cpp doesn't need to be included in the library, because nothing the library does creates an audioDB instance. Hooray. We can't disentangle the other way, because there's still plenty in the command-line binary that isn't implemented in terms of the API, so the audioDB binary code needs to know naughty stuff about the library's internals (e.g. what the file header looks like). Remove liszt.o and sample.o from the library, even though they'll probably make a reapparance soon (for scare-quoted values of "soon") Remove cmdline.o and common.o from the library, not scheduled to make a reapparence ever (hooray!). Separate out the bits that are used in the library -- locks and PointPairs -- into their own files.
author mas01cr
date Sat, 10 Jan 2009 15:33:25 +0000
parents 53c487885b2c
children
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@496 11 LIBOBJS=query.o index.o insert.o create.o common.o open.o close.o status.o dump.o power.o l2norm.o lshlib.o lock.o pointpair.o
mas01cr@496 12 OBJS=$(LIBOBJS) soap.o liszt.o sample.o cmdline.o audioDB.o common.o
map01bf@374 13
map01bf@374 14
map01bf@374 15 EXECUTABLE=audioDB
map01bf@374 16
map01bf@374 17 SOVERSION=0
map01bf@374 18 MINORVERSION=0
map01bf@374 19 LIBRARY=lib$(EXECUTABLE).so.$(SOVERSION).$(MINORVERSION)
map01bf@374 20
mas01ik@355 21 override CFLAGS+=-O3 -g -fPIC
mas01cr@244 22
mas01cr@239 23 ifeq ($(shell uname),Linux)
mas01cr@239 24 override CFLAGS+=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
mas01cr@239 25 endif
mas01cr@137 26
mas01cr@244 27 ifeq ($(shell uname),Darwin)
mas01cr@244 28 ifeq ($(shell sysctl -n hw.optional.x86_64),1)
mas01mc@315 29 override CFLAGS+=-arch x86_64
mas01cr@244 30 endif
map01bf@374 31 override SHARED_LIB_FLAGS=-dynamiclib -current_version $(SOVERSION).$(MINORVERSION) -Wl -install_name
map01bf@374 32 override LIBRARY=lib$(EXECUTABLE).$(SOVERSION).$(MINORVERSION).dylib
mas01cr@244 33 endif
mas01cr@244 34
mas01cr@72 35 .PHONY: all clean test
mas01cr@72 36
mas01cr@371 37 all: $(LIBRARY) $(EXECUTABLE)
mas01cr@2 38
mas01ik@355 39 $(EXECUTABLE).1: $(EXECUTABLE)
mas01ik@355 40 $(HELP2MAN) ./$(EXECUTABLE) > $(EXECUTABLE).1
mas01cr@0 41
mas01ik@355 42 HELP.txt: $(EXECUTABLE)
mas01ik@355 43 ./$(EXECUTABLE) --help > HELP.txt
mas01cr@3 44
mas01cr@1 45 cmdline.c cmdline.h: gengetopt.in
mas01ik@355 46 $(GENGETOPT) -e <gengetopt.in
mas01cr@1 47
mas01cr@239 48 soapServer.cpp soapClient.cpp soapC.cpp adb.nsmap: audioDBws.h
mas01ik@355 49 $(SOAPCPP2) audioDBws.h
mas01cr@1 50
mas01cr@387 51 %.o: %.cpp audioDB.h audioDB_API.h adb.nsmap cmdline.h reporter.h ReporterBase.h lshlib.h
mas01ik@355 52 g++ -c $(CFLAGS) $(GSOAP_INCLUDE) $(GSL_INCLUDE) -Wall $<
mas01cr@239 53
mas01cr@345 54 cmdline.o: cmdline.c cmdline.h
mas01ik@355 55 gcc -c $(CFLAGS) $<
mas01cr@345 56
mas01cr@371 57 $(EXECUTABLE): $(OBJS) soapServer.cpp soapClient.cpp soapC.cpp
mas01cr@371 58 g++ -o $(EXECUTABLE) $(CFLAGS) $^ $(LIBGSL) $(GSOAP_INCLUDE) $(GSOAP_CPP)
mas01ik@355 59
mas01cr@496 60 $(LIBRARY): $(LIBOBJS)
map01bf@374 61 g++ $(SHARED_LIB_FLAGS)$(LIBRARY) -o $(LIBRARY) $(CFLAGS) $(LIBGSL) $^
mas01ik@355 62
mas01ik@355 63 tags:
mas01ik@355 64 ctags *.cpp *.h
mas01ik@355 65
mas01cr@2 66
mas01cr@2 67 clean:
mas01cr@2 68 -rm cmdline.c cmdline.h
mas01cr@2 69 -rm soapServer.cpp soapClient.cpp soapC.cpp soapObject.h soapStub.h soapProxy.h soapH.h soapServerLib.cpp soapClientLib.cpp
mas01ik@355 70 -rm adb.*
mas01cr@135 71 -rm HELP.txt
mas01ik@355 72 -rm $(EXECUTABLE) $(EXECUTABLE).1 $(OBJS)
mas01cr@281 73 -rm xthresh
mas01cr@59 74 -sh -c "cd tests && sh ./clean.sh"
mas01ik@355 75 -sh -c "cd libtests && sh ./clean.sh"
mas01cr@496 76 -rm $(LIBRARY)
mas01ik@355 77 -rm tags
mas01cr@72 78
mas01cr@372 79 distclean: clean
mas01ik@355 80 -rm *.o
mas01ik@355 81 -rm -rf audioDB.dump
mas01ik@355 82
mas01ik@355 83
mas01ik@355 84 test: $(EXECUTABLE)
mas01cr@72 85 -sh -c "cd tests && sh ./run-tests.sh"
mas01cr@280 86
mas01cr@280 87 xthresh: xthresh.c
mas01ik@355 88 gcc -o $@ $(CFLAGS) $(GSL_INCLUDE) $(LIBGSL) $<
mas01ik@355 89
mas01ik@355 90 install:
mas01ik@355 91 cp $(LIBRARY) /usr/local/lib/
mas01cr@373 92 ln -sf /usr/local/lib/$(LIBRARY) /usr/local/lib/lib$(EXECUTABLE).so.$(SOVERSION)
mas01cr@373 93 ln -sf /usr/local/lib/lib$(EXECUTABLE).so.$(SOVERSION) /usr/local/lib/lib$(EXECUTABLE).so
mas01ik@355 94 ldconfig
mas01ik@355 95 cp audioDB_API.h /usr/local/include/