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