annotate Makefile @ 150:573114586df1

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