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

Revision 30413, 3.8 KB (checked in by davidb, 4 years ago)

Minor changes to help code compile on MacOS El Capitan

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