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