root/gs3-extensions/audioDB/trunk/src/src/audioDB-Makefile.in @ 24323

Revision 24319, 3.6 KB (checked in by davidb, 9 years ago)

Extra files to make aduioDB source play nicely with cascase-make

Line 
1HELP2MAN=help2man
2GENGETOPT=gengetopt
3SOAPCPP2=soapcpp2
4GSOAP_INCLUDE=$(shell pkg-config --cflags gsoap++)
5GSOAP_CPP=$(shell pkg-config --libs gsoap++)
6GSL_INCLUDE=$(shell pkg-config --cflags gsl)
7LIBGSL=$(shell pkg-config --libs gsl)
8
9TESTDIRS=tests libtests
10BINDINGDIRS=bindings/sb-alien bindings/pd bindings/python
11
12PREFIX=@prefix@
13EXEC_PREFIX=$(PREFIX)
14LIBDIR=$(EXEC_PREFIX)/lib
15BINDIR=$(EXEC_PREFIX)/bin
16INCLUDEDIR=$(PREFIX)/include
17MANDIR=$(PREFIX)/share/man
18
19LIBOBJS=lock.o pointpair.o create.o open.o power.o l2norm.o insert.o status.o query.o dump.o close.o index-utils.o query-indexed.o liszt.o retrieve.o lshlib.o multiprobe.o sample.o
20OBJS=$(LIBOBJS) index.o soap.o cmdline.o audioDB.o common.o
21
22EXECUTABLE=audioDB
23
24SOVERSION=0
25MINORVERSION=0
26LIBRARY=lib$(EXECUTABLE).so.$(SOVERSION).$(MINORVERSION)
27SHARED_LIB_FLAGS=-shared -Wl,-soname,lib$(EXECUTABLE).so.$(SOVERSION)
28
29override CFLAGS+=-g -O3 -fPIC
30
31# set to generate profile (gprof) and coverage (gcov) info
32#override CFLAGS+=-fprofile-arcs -ftest-coverage -pg
33
34# set to DUMP hashtables on QUERY load
35#override CFLAGS+=-DLSH_DUMP_CORE_TABLES
36
37ifeq ($(shell uname),Linux)
38override CFLAGS+=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
39endif
40
41ifeq ($(shell uname),Darwin)
42ifeq ($(shell sysctl -n hw.optional.x86_64),1)
43override CFLAGS+=-arch x86_64
44endif
45override LIBRARY=lib$(EXECUTABLE).$(SOVERSION).$(MINORVERSION).dylib
46override SHARED_LIB_FLAGS=-dynamiclib -current_version $(SOVERSION) -Wl -install_name $(LIBRARY)
47endif
48
49.PHONY: all clean test install $(EXECUTABLE).pc
50
51all: $(LIBRARY) $(EXECUTABLE) $(EXECUTABLE).1
52
53$(EXECUTABLE).1: $(EXECUTABLE)
54    $(HELP2MAN) ./$(EXECUTABLE) > $(EXECUTABLE).1
55
56HELP.txt: $(EXECUTABLE)
57    ./$(EXECUTABLE) --help > HELP.txt
58
59cmdline.c cmdline.h: gengetopt.in
60    $(GENGETOPT) -e <gengetopt.in
61
62soapServer.cpp soapClient.cpp soapC.cpp soapH.h adb.nsmap: audioDBws.h
63    $(SOAPCPP2) audioDBws.h
64
65$(LIBOBJS): %.o: %.cpp audioDB_API.h audioDB-internals.h accumulator.h accumulators.h
66    $(CXX) -c $(CFLAGS) $(GSL_INCLUDE) -Wall $<
67
68%.o: %.cpp audioDB.h audioDB_API.h adb.nsmap cmdline.h reporter.h ReporterBase.h lshlib.h
69    $(CXX) -c $(CFLAGS) $(GSOAP_INCLUDE) $(GSL_INCLUDE) -Wall  $<
70
71cmdline.o: cmdline.c cmdline.h
72    $(CC) -c $(CFLAGS) $<
73
74$(EXECUTABLE): $(OBJS) soapServer.cpp soapClient.cpp soapC.cpp
75    $(CXX) -o $(EXECUTABLE) $(CFLAGS) $^ $(LIBGSL) $(GSOAP_INCLUDE) $(GSOAP_CPP)
76
77$(LIBRARY): $(LIBOBJS)
78    $(CXX) $(SHARED_LIB_FLAGS) -o $(LIBRARY) $(LIBGSL) $(CFLAGS) $^
79
80tags:
81    ctags *.cpp *.h
82
83
84clean:
85    -rm cmdline.c cmdline.h cmdline.o
86    -rm soapServer.cpp soapClient.cpp soapC.cpp soapObject.h soapStub.h soapProxy.h soapH.h soapServerLib.cpp soapClientLib.cpp
87    -rm adb.*
88    -rm HELP.txt
89    -rm $(EXECUTABLE) $(EXECUTABLE).1 $(OBJS)
90    -rm xthresh
91    -for d in $(TESTDIRS); do (cd $$d && sh ./clean.sh); done
92    -for d in $(BINDINGDIRS); do (cd $$d && $(MAKE) clean); done
93    -rm $(LIBRARY)
94    -rm tags
95
96distclean: clean
97    -rm *.o
98    -rm -rf audioDB.dump
99
100test: $(EXECUTABLE) $(LIBRARY)
101    for d in $(TESTDIRS); do (cd $$d && sh ./run-tests.sh); done
102    for d in $(BINDINGDIRS); do (cd $$d && $(MAKE) test); done
103
104xthresh: xthresh.c
105    $(CC) -o $@ $(CFLAGS) $(GSL_INCLUDE) $(LIBGSL) $<
106
107$(EXECUTABLE).pc:
108    ./make-pc.sh "$(EXECUTABLE)" "$(LIBDIR)" "$(INCLUDEDIR)" $(SOVERSION) $(MINORVERSION) > $(EXECUTABLE).pc
109
110install: $(EXECUTABLE).pc
111    mkdir -m755 -p $(LIBDIR)/pkgconfig $(BINDIR) $(INCLUDEDIR) $(MANDIR)/man1
112    install -m644 $(LIBRARY) $(LIBDIR)
113#ifneq ($(shell uname),Darwin)
114#   ldconfig -n $(LIBDIR)
115#endif
116    ln -sf $(LIBRARY) $(LIBDIR)/lib$(EXECUTABLE).so
117    install -m755 $(EXECUTABLE) $(BINDIR)
118    install -m644 audioDB_API.h $(INCLUDEDIR)
119    install -m644 $(EXECUTABLE).1 $(MANDIR)/man1
120    install $(EXECUTABLE).pc $(LIBDIR)/pkgconfig
Note: See TracBrowser for help on using the browser.