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