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

Revision 24331, 3.7 KB (checked in by davidb, 8 years ago)

Tidy up of loose ends in compiling up audioDb src

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
51##all: $(LIBRARY) $(EXECUTABLE) $(EXECUTABLE).1
52all: $(LIBRARY) $(EXECUTABLE)
53
54$(EXECUTABLE).1: $(EXECUTABLE)
55    $(HELP2MAN) ./$(EXECUTABLE) > $(EXECUTABLE).1
56
57HELP.txt: $(EXECUTABLE)
58    ./$(EXECUTABLE) --help > HELP.txt
59
60cmdline.c cmdline.h: gengetopt.in
61    $(GENGETOPT) -e <gengetopt.in
62
63soapServer.cpp soapClient.cpp soapC.cpp soapH.h adb.nsmap: audioDBws.h
64    $(SOAPCPP2) audioDBws.h
65
66$(LIBOBJS): %.o: %.cpp audioDB_API.h audioDB-internals.h accumulator.h accumulators.h
67    $(CXX) -c $(CFLAGS) $(GSL_INCLUDE) -Wall $<
68
69%.o: %.cpp audioDB.h audioDB_API.h adb.nsmap cmdline.h reporter.h ReporterBase.h lshlib.h
70    $(CXX) -c $(CFLAGS) $(GSOAP_INCLUDE) $(GSL_INCLUDE) -Wall  $<
71
72cmdline.o: cmdline.c cmdline.h
73    $(CC) -c $(CFLAGS) $<
74
75$(EXECUTABLE): $(OBJS) soapServer.cpp soapClient.cpp soapC.cpp
76    $(CXX) -o $(EXECUTABLE) $(CFLAGS) $^ $(LIBGSL) $(GSOAP_INCLUDE) $(GSOAP_CPP)
77
78$(LIBRARY): $(LIBOBJS)
79    $(CXX) $(SHARED_LIB_FLAGS) -o $(LIBRARY) $(LIBGSL) $(CFLAGS) $^
80
81tags:
82    ctags *.cpp *.h
83
84
85clean:
86    -rm cmdline.c cmdline.h cmdline.o
87    -rm soapServer.cpp soapClient.cpp soapC.cpp soapObject.h soapStub.h soapProxy.h soapH.h soapServerLib.cpp soapClientLib.cpp
88    -rm adb.*
89    -rm HELP.txt
90    -rm -f $(EXECUTABLE) $(EXECUTABLE).1 $(OBJS)
91    -rm xthresh
92    -for d in $(TESTDIRS); do (cd $$d && sh ./clean.sh); done
93    -for d in $(BINDINGDIRS); do (cd $$d && $(MAKE) clean); done
94    -rm $(LIBRARY)
95    -rm tags
96
97distclean: clean
98    -rm *.o
99    -rm -rf audioDB.dump
100
101test: $(EXECUTABLE) $(LIBRARY)
102    for d in $(TESTDIRS); do (cd $$d && sh ./run-tests.sh); done
103    for d in $(BINDINGDIRS); do (cd $$d && $(MAKE) test); done
104
105xthresh: xthresh.c
106    $(CC) -o $@ $(CFLAGS) $(GSL_INCLUDE) $(LIBGSL) $<
107
108$(EXECUTABLE).pc:
109    ./make-pc.sh "$(EXECUTABLE)" "$(LIBDIR)" "$(INCLUDEDIR)" $(SOVERSION) $(MINORVERSION) > $(EXECUTABLE).pc
110
111install: $(EXECUTABLE).pc
112    mkdir -m755 -p $(LIBDIR)/pkgconfig $(BINDIR) $(INCLUDEDIR) $(MANDIR)/man1
113    install -m644 $(LIBRARY) $(LIBDIR)
114#ifneq ($(shell uname),Darwin)
115#   ldconfig -n $(LIBDIR)
116#endif
117    ln -sf $(LIBRARY) $(LIBDIR)/lib$(EXECUTABLE).so
118    install -m755 $(EXECUTABLE) $(BINDIR)
119    install -m644 audioDB_API.h $(INCLUDEDIR)
120##  install -m644 $(EXECUTABLE).1 $(MANDIR)/man1
121    install $(EXECUTABLE).pc $(LIBDIR)/pkgconfig
Note: See TracBrowser for help on using the browser.