cannam@0
|
1
|
cannam@10
|
2 # Makefile for the Vamp plugin SDK. This builds the SDK objects,
|
cannam@51
|
3 # libraries, example plugins, and the test host. Please adjust to
|
cannam@51
|
4 # suit your operating system requirements.
|
cannam@0
|
5
|
cannam@64
|
6 APIDIR = vamp
|
cannam@10
|
7 SDKDIR = vamp-sdk
|
cannam@64
|
8 HOSTEXTDIR = vamp-sdk/hostext
|
cannam@10
|
9 EXAMPLEDIR = examples
|
cannam@10
|
10 HOSTDIR = host
|
cannam@1
|
11
|
cannam@64
|
12 ###
|
cannam@64
|
13 ### Start of user-serviceable parts
|
cannam@64
|
14 ###
|
cannam@0
|
15
|
cannam@64
|
16 # Default build target (or use "make <target>" to select one).
|
cannam@64
|
17 # Targets are:
|
cannam@64
|
18 # all -- build everything
|
cannam@64
|
19 # sdk -- build all the Vamp SDK libraries for plugins and hosts
|
cannam@64
|
20 # plugins -- build the example plugins (and the SDK if required)
|
cannam@64
|
21 # host -- build the simple Vamp plugin host (and the SDK if required)
|
cannam@64
|
22 # test -- build the host and example plugins, and run a quick test
|
cannam@64
|
23 # clean -- remove binary targets
|
cannam@64
|
24 # distclean -- remove all targets
|
cannam@64
|
25 #
|
cannam@64
|
26 default: all
|
cannam@64
|
27
|
cannam@64
|
28 # Compile flags
|
cannam@64
|
29 #
|
cannam@81
|
30 CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I. -fpic
|
cannam@64
|
31
|
cannam@64
|
32 # Libraries required for the plugins.
|
cannam@64
|
33 # (Note that it is desirable to statically link libstdc++ if possible,
|
cannam@64
|
34 # because our plugin exposes only a C API so there are no boundary
|
cannam@64
|
35 # compatibility problems.)
|
cannam@64
|
36 #
|
cannam@64
|
37 PLUGIN_LIBS = $(SDKDIR)/libvamp-sdk.a
|
cannam@81
|
38 #PLUGIN_LIBS = $(SDKDIR)/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a)
|
cannam@64
|
39
|
cannam@64
|
40 # File extension for a dynamically loadable object
|
cannam@64
|
41 #
|
cannam@64
|
42 PLUGIN_EXT = .so
|
cannam@64
|
43 #PLUGIN_EXT = .dylib
|
cannam@64
|
44
|
cannam@64
|
45 # Libraries required for the host.
|
cannam@64
|
46 #
|
cannam@64
|
47 HOST_LIBS = $(SDKDIR)/libvamp-hostsdk.a -lsndfile -ldl
|
cannam@1
|
48
|
cannam@32
|
49 # Locations for "make install". This will need quite a bit of
|
cannam@32
|
50 # editing for non-Linux platforms. Of course you don't necessarily
|
cannam@32
|
51 # have to use "make install".
|
cannam@32
|
52 #
|
cannam@80
|
53 INSTALL_PREFIX := /usr
|
cannam@51
|
54 INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp
|
cannam@51
|
55 INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk
|
cannam@64
|
56 INSTALL_HOSTEXT_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk/hostext
|
cannam@51
|
57 INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib
|
cannam@51
|
58
|
cannam@81
|
59 INSTALL_SDK_LIBNAME := libvamp-sdk.so.1.1.0
|
cannam@51
|
60 INSTALL_SDK_LINK_ABI := libvamp-sdk.so.1
|
cannam@51
|
61 INSTALL_SDK_LINK_DEV := libvamp-sdk.so
|
cannam@51
|
62 INSTALL_SDK_STATIC := libvamp-sdk.a
|
cannam@51
|
63 INSTALL_SDK_LA := libvamp-sdk.la
|
cannam@51
|
64
|
cannam@81
|
65 INSTALL_HOSTSDK_LIBNAME := libvamp-hostsdk.so.2.0.0
|
cannam@81
|
66 INSTALL_HOSTSDK_LINK_ABI := libvamp-hostsdk.so.2
|
cannam@51
|
67 INSTALL_HOSTSDK_LINK_DEV := libvamp-hostsdk.so
|
cannam@51
|
68 INSTALL_HOSTSDK_STATIC := libvamp-hostsdk.a
|
cannam@51
|
69 INSTALL_HOSTSDK_LA := libvamp-hostsdk.la
|
cannam@51
|
70
|
cannam@51
|
71 INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig
|
cannam@32
|
72
|
cannam@81
|
73 # Flags required to tell the compiler to create a dynamically loadable object
|
cannam@81
|
74 #
|
cannam@81
|
75 DYNAMIC_LDFLAGS = -shared -Wl,-Bsymbolic
|
cannam@81
|
76 PLUGIN_LDFLAGS = $(DYNAMIC_LDFLAGS)
|
cannam@81
|
77 SDK_DYNAMIC_LDFLAGS = $(DYNAMIC_LDFLAGS) -Wl,-soname=$(INSTALL_SDK_LIBNAME)
|
cannam@81
|
78 HOSTSDK_DYNAMIC_LDFLAGS = $(DYNAMIC_LDFLAGS) -Wl,-soname=$(INSTALL_SDK_LIBNAME)
|
cannam@81
|
79
|
cannam@81
|
80 ## For OS/X with g++:
|
cannam@81
|
81 #PLUGIN_LDFLAGS = -dynamiclib
|
cannam@81
|
82
|
cannam@81
|
83
|
cannam@10
|
84 ### End of user-serviceable parts
|
cannam@10
|
85
|
cannam@32
|
86
|
cannam@20
|
87 API_HEADERS = \
|
cannam@20
|
88 $(APIDIR)/vamp.h
|
cannam@20
|
89
|
cannam@20
|
90 SDK_HEADERS = \
|
cannam@20
|
91 $(SDKDIR)/Plugin.h \
|
cannam@20
|
92 $(SDKDIR)/PluginAdapter.h \
|
cannam@20
|
93 $(SDKDIR)/PluginBase.h \
|
cannam@51
|
94 $(SDKDIR)/RealTime.h
|
cannam@51
|
95
|
cannam@51
|
96 HOSTSDK_HEADERS = \
|
cannam@51
|
97 $(SDKDIR)/Plugin.h \
|
cannam@51
|
98 $(SDKDIR)/PluginBase.h \
|
cannam@20
|
99 $(SDKDIR)/PluginHostAdapter.h \
|
cannam@20
|
100 $(SDKDIR)/RealTime.h
|
cannam@20
|
101
|
cannam@64
|
102 HOSTEXT_HEADERS = \
|
cannam@64
|
103 $(HOSTEXTDIR)/PluginChannelAdapter.h \
|
cannam@64
|
104 $(HOSTEXTDIR)/PluginInputDomainAdapter.h \
|
cannam@64
|
105 $(HOSTEXTDIR)/PluginLoader.h \
|
cannam@64
|
106 $(HOSTEXTDIR)/PluginWrapper.h
|
cannam@64
|
107
|
cannam@11
|
108 SDK_OBJECTS = \
|
cannam@11
|
109 $(SDKDIR)/PluginAdapter.o \
|
cannam@51
|
110 $(SDKDIR)/RealTime.o
|
cannam@51
|
111
|
cannam@51
|
112 HOSTSDK_OBJECTS = \
|
cannam@11
|
113 $(SDKDIR)/PluginHostAdapter.o \
|
cannam@64
|
114 $(HOSTEXTDIR)/PluginChannelAdapter.o \
|
cannam@64
|
115 $(HOSTEXTDIR)/PluginInputDomainAdapter.o \
|
cannam@64
|
116 $(HOSTEXTDIR)/PluginLoader.o \
|
cannam@64
|
117 $(HOSTEXTDIR)/PluginWrapper.o \
|
cannam@11
|
118 $(SDKDIR)/RealTime.o
|
cannam@11
|
119
|
cannam@32
|
120 SDK_STATIC = \
|
cannam@11
|
121 $(SDKDIR)/libvamp-sdk.a
|
cannam@10
|
122
|
cannam@51
|
123 HOSTSDK_STATIC = \
|
cannam@51
|
124 $(SDKDIR)/libvamp-hostsdk.a
|
cannam@51
|
125
|
cannam@32
|
126 SDK_DYNAMIC = \
|
cannam@32
|
127 $(SDKDIR)/libvamp-sdk.so
|
cannam@32
|
128
|
cannam@51
|
129 HOSTSDK_DYNAMIC = \
|
cannam@51
|
130 $(SDKDIR)/libvamp-hostsdk.so
|
cannam@51
|
131
|
cannam@33
|
132 SDK_LA = \
|
cannam@33
|
133 $(SDKDIR)/libvamp-sdk.la
|
cannam@33
|
134
|
cannam@20
|
135 PLUGIN_HEADERS = \
|
cannam@20
|
136 $(EXAMPLEDIR)/SpectralCentroid.h \
|
cannam@35
|
137 $(EXAMPLEDIR)/PercussionOnsetDetector.h \
|
cannam@41
|
138 $(EXAMPLEDIR)/AmplitudeFollower.h \
|
cannam@20
|
139 $(EXAMPLEDIR)/ZeroCrossing.h
|
cannam@20
|
140
|
cannam@10
|
141 PLUGIN_OBJECTS = \
|
cannam@20
|
142 $(EXAMPLEDIR)/SpectralCentroid.o \
|
cannam@35
|
143 $(EXAMPLEDIR)/PercussionOnsetDetector.o \
|
cannam@41
|
144 $(EXAMPLEDIR)/AmplitudeFollower.o \
|
cannam@10
|
145 $(EXAMPLEDIR)/ZeroCrossing.o \
|
cannam@10
|
146 $(EXAMPLEDIR)/plugins.o
|
cannam@10
|
147
|
cannam@10
|
148 PLUGIN_TARGET = \
|
cannam@21
|
149 $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT)
|
cannam@10
|
150
|
cannam@20
|
151 HOST_HEADERS = \
|
cannam@20
|
152 $(HOSTDIR)/system.h
|
cannam@20
|
153
|
cannam@10
|
154 HOST_OBJECTS = \
|
cannam@22
|
155 $(HOSTDIR)/vamp-simple-host.o
|
cannam@10
|
156
|
cannam@10
|
157 HOST_TARGET = \
|
cannam@22
|
158 $(HOSTDIR)/vamp-simple-host
|
cannam@10
|
159
|
cannam@64
|
160 sdk: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC)
|
cannam@64
|
161
|
cannam@64
|
162 plugins: $(PLUGIN_TARGET)
|
cannam@64
|
163
|
cannam@64
|
164 host: $(HOST_TARGET)
|
cannam@64
|
165
|
cannam@64
|
166 all: sdk plugins host test
|
cannam@11
|
167
|
cannam@32
|
168 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
|
cannam@20
|
169 $(AR) r $@ $(SDK_OBJECTS)
|
cannam@10
|
170
|
cannam@64
|
171 $(HOSTSDK_STATIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS)
|
cannam@51
|
172 $(AR) r $@ $(HOSTSDK_OBJECTS)
|
cannam@51
|
173
|
cannam@32
|
174 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
|
cannam@81
|
175 $(CXX) $(LDFLAGS) $(SDK_DYNAMIC_LDFLAGS) -o $@ $(SDK_OBJECTS)
|
cannam@32
|
176
|
cannam@64
|
177 $(HOSTSDK_DYNAMIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS)
|
cannam@81
|
178 $(CXX) $(LDFLAGS) $(HOSTSDK_DYNAMIC_LDFLAGS) -o $@ $(HOSTSDK_OBJECTS)
|
cannam@51
|
179
|
cannam@64
|
180 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_STATIC) $(PLUGIN_HEADERS)
|
cannam@20
|
181 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
|
cannam@10
|
182
|
cannam@64
|
183 $(HOST_TARGET): $(HOST_OBJECTS) $(HOSTSDK_STATIC) $(HOST_HEADERS)
|
cannam@20
|
184 $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS)
|
cannam@10
|
185
|
cannam@64
|
186 test: plugins host
|
cannam@64
|
187 VAMP_PATH=$(EXAMPLEDIR) $(HOST_TARGET) -l
|
cannam@10
|
188
|
cannam@10
|
189 clean:
|
cannam@51
|
190 rm -f $(SDK_OBJECTS) $(HOSTSDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
|
cannam@10
|
191
|
cannam@33
|
192 distclean: clean
|
cannam@51
|
193 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
|
cannam@33
|
194
|
cannam@51
|
195 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
|
cannam@32
|
196 mkdir -p $(INSTALL_API_HEADERS)
|
cannam@32
|
197 mkdir -p $(INSTALL_SDK_HEADERS)
|
cannam@64
|
198 mkdir -p $(INSTALL_HOSTEXT_HEADERS)
|
cannam@32
|
199 mkdir -p $(INSTALL_SDK_LIBS)
|
cannam@32
|
200 mkdir -p $(INSTALL_PKGCONFIG)
|
cannam@32
|
201 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
|
cannam@32
|
202 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
|
cannam@51
|
203 cp $(HOSTSDK_HEADERS) $(INSTALL_SDK_HEADERS)
|
cannam@64
|
204 cp $(HOSTEXT_HEADERS) $(INSTALL_HOSTEXT_HEADERS)
|
cannam@32
|
205 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
|
cannam@51
|
206 cp $(HOSTSDK_STATIC) $(INSTALL_SDK_LIBS)
|
cannam@32
|
207 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
|
cannam@51
|
208 cp $(HOSTSDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LIBNAME)
|
cannam@32
|
209 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
|
cannam@32
|
210 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
|
cannam@51
|
211 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI)
|
cannam@51
|
212 ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI)
|
cannam@32
|
213 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
|
cannam@35
|
214 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
|
cannam@51
|
215 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV)
|
cannam@51
|
216 ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV)
|
cannam@33
|
217 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \
|
cannam@33
|
218 > $(INSTALL_PKGCONFIG)/vamp.pc
|
cannam@33
|
219 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \
|
cannam@33
|
220 > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
|
cannam@51
|
221 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-hostsdk.pc.in \
|
cannam@51
|
222 > $(INSTALL_PKGCONFIG)/vamp-hostsdk.pc
|
cannam@33
|
223 sed -e "s,%LIBNAME%,$(INSTALL_SDK_LIBNAME),g" \
|
cannam@33
|
224 -e "s,%LINK_ABI%,$(INSTALL_SDK_LINK_ABI),g" \
|
cannam@33
|
225 -e "s,%LINK_DEV%,$(INSTALL_SDK_LINK_DEV),g" \
|
cannam@33
|
226 -e "s,%STATIC%,$(INSTALL_SDK_STATIC),g" \
|
cannam@34
|
227 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
|
cannam@33
|
228 > $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LA)
|
cannam@51
|
229 sed -e "s,%LIBNAME%,$(INSTALL_HOSTSDK_LIBNAME),g" \
|
cannam@51
|
230 -e "s,%LINK_ABI%,$(INSTALL_HOSTSDK_LINK_ABI),g" \
|
cannam@51
|
231 -e "s,%LINK_DEV%,$(INSTALL_HOSTSDK_LINK_DEV),g" \
|
cannam@51
|
232 -e "s,%STATIC%,$(INSTALL_HOSTSDK_STATIC),g" \
|
cannam@51
|
233 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
|
cannam@51
|
234 > $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LA)
|
cannam@51
|
235
|