cannam@0: cannam@10: # Makefile for the Vamp plugin SDK. This builds the SDK objects, cannam@51: # libraries, example plugins, and the test host. Please adjust to cannam@51: # suit your operating system requirements. cannam@0: cannam@64: APIDIR = vamp cannam@230: cannam@10: SDKDIR = vamp-sdk cannam@230: HOSTSDKDIR = vamp-hostsdk cannam@230: HOSTEXTDIR = vamp-hostsdk/hostext cannam@230: cannam@230: SRCDIR = src cannam@230: SDKSRCDIR = src/vamp-sdk cannam@230: HOSTSDKSRCDIR = src/vamp-hostsdk cannam@230: HOSTEXTSRCDIR = src/vamp-hostsdk/hostext cannam@230: cannam@10: EXAMPLEDIR = examples cannam@10: HOSTDIR = host cannam@1: cannam@64: ### cannam@64: ### Start of user-serviceable parts cannam@64: ### cannam@0: cannam@64: # Default build target (or use "make " to select one). cannam@64: # Targets are: cannam@64: # all -- build everything cannam@64: # sdk -- build all the Vamp SDK libraries for plugins and hosts cannam@82: # sdkstatic -- build only the static versions of the SDK libraries cannam@64: # plugins -- build the example plugins (and the SDK if required) cannam@64: # host -- build the simple Vamp plugin host (and the SDK if required) cannam@64: # test -- build the host and example plugins, and run a quick test cannam@64: # clean -- remove binary targets cannam@64: # distclean -- remove all targets cannam@64: # cannam@64: default: all cannam@64: cannam@64: # Compile flags cannam@64: # cannam@168: CXXFLAGS := $(CXXFLAGS) -g -Wall -I. -fPIC cannam@64: cannam@89: # ar, ranlib cannam@89: # cannam@89: AR := ar cannam@89: RANLIB := ranlib cannam@89: cannam@64: # Libraries required for the plugins. cannam@64: # cannam@230: PLUGIN_LIBS = $(SRCDIR)/libvamp-sdk.a cannam@64: cannam@64: # File extension for a dynamically loadable object cannam@64: # cannam@64: PLUGIN_EXT = .so cannam@89: #PLUGIN_EXT = .dll cannam@64: #PLUGIN_EXT = .dylib cannam@64: cannam@64: # Libraries required for the host. cannam@64: # cannam@230: HOST_LIBS = $(SRCDIR)/libvamp-hostsdk.a -lsndfile -ldl cannam@1: cannam@32: # Locations for "make install". This will need quite a bit of cannam@32: # editing for non-Linux platforms. Of course you don't necessarily cannam@32: # have to use "make install". cannam@32: # cannam@162: INSTALL_PREFIX := /usr/local cannam@51: INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp cannam@51: INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk cannam@64: INSTALL_HOSTEXT_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk/hostext cannam@51: INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib cannam@51: cannam@168: INSTALL_SDK_LIBNAME := libvamp-sdk.so.2.0.0 cannam@168: INSTALL_SDK_LINK_ABI := libvamp-sdk.so.2 cannam@51: INSTALL_SDK_LINK_DEV := libvamp-sdk.so cannam@51: INSTALL_SDK_STATIC := libvamp-sdk.a cannam@51: INSTALL_SDK_LA := libvamp-sdk.la cannam@51: cannam@168: INSTALL_HOSTSDK_LIBNAME := libvamp-hostsdk.so.3.0.0 cannam@168: INSTALL_HOSTSDK_LINK_ABI := libvamp-hostsdk.so.3 cannam@51: INSTALL_HOSTSDK_LINK_DEV := libvamp-hostsdk.so cannam@51: INSTALL_HOSTSDK_STATIC := libvamp-hostsdk.a cannam@51: INSTALL_HOSTSDK_LA := libvamp-hostsdk.la cannam@51: cannam@51: INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig cannam@32: cannam@81: # Flags required to tell the compiler to create a dynamically loadable object cannam@81: # cannam@160: DYNAMIC_LDFLAGS = -static-libgcc -shared -Wl,-Bsymbolic cannam@107: SDK_DYNAMIC_LDFLAGS = $(DYNAMIC_LDFLAGS) -Wl,-soname=$(INSTALL_SDK_LINK_ABI) cannam@107: HOSTSDK_DYNAMIC_LDFLAGS = $(DYNAMIC_LDFLAGS) -Wl,-soname=$(INSTALL_HOSTSDK_LINK_ABI) cannam@81: cannam@162: # Additional flags for making a plugin. This version script tells the cannam@162: # GNU linker to make all symbols in the library hidden except for the cannam@162: # public entry point. It's not essential, but makes a tidier library. cannam@230: PLUGIN_LDFLAGS = $(DYNAMIC_LDFLAGS) -Wl,--version-script=build/vamp-plugin.map cannam@162: cannam@162: cannam@81: ## For OS/X with g++: cannam@94: #DYNAMIC_LDFLAGS = -dynamiclib cannam@94: #PLUGIN_LDFLAGS = $(DYNAMIC_LDFLAGS) cannam@94: #SDK_DYNAMIC_LDFLAGS = $(DYNAMIC_LDFLAGS) cannam@94: #HOSTSDK_DYNAMIC_LDFLAGS = $(DYNAMIC_LDFLAGS) cannam@81: cannam@81: cannam@10: ### End of user-serviceable parts cannam@10: cannam@32: cannam@20: API_HEADERS = \ cannam@20: $(APIDIR)/vamp.h cannam@20: cannam@20: SDK_HEADERS = \ cannam@20: $(SDKDIR)/Plugin.h \ cannam@20: $(SDKDIR)/PluginAdapter.h \ cannam@20: $(SDKDIR)/PluginBase.h \ cannam@51: $(SDKDIR)/RealTime.h cannam@51: cannam@51: HOSTSDK_HEADERS = \ cannam@230: $(HOSTSDKDIR)/Plugin.h \ cannam@230: $(HOSTSDKDIR)/PluginBase.h \ cannam@230: $(HOSTSDKDIR)/PluginHostAdapter.h \ cannam@230: $(HOSTSDKDIR)/RealTime.h cannam@20: cannam@64: HOSTEXT_HEADERS = \ cannam@92: $(HOSTEXTDIR)/PluginBufferingAdapter.h \ cannam@64: $(HOSTEXTDIR)/PluginChannelAdapter.h \ cannam@64: $(HOSTEXTDIR)/PluginInputDomainAdapter.h \ cannam@64: $(HOSTEXTDIR)/PluginLoader.h \ cannam@174: $(HOSTEXTDIR)/PluginSummarisingAdapter.h \ cannam@64: $(HOSTEXTDIR)/PluginWrapper.h cannam@64: cannam@11: SDK_OBJECTS = \ cannam@230: $(SDKSRCDIR)/PluginAdapter.o \ cannam@230: $(SDKSRCDIR)/RealTime.o cannam@51: cannam@51: HOSTSDK_OBJECTS = \ cannam@230: $(HOSTSDKSRCDIR)/PluginHostAdapter.o \ cannam@230: $(HOSTSDKSRCDIR)/RealTime.o \ cannam@230: $(HOSTEXTSRCDIR)/PluginBufferingAdapter.o \ cannam@230: $(HOSTEXTSRCDIR)/PluginChannelAdapter.o \ cannam@230: $(HOSTEXTSRCDIR)/PluginInputDomainAdapter.o \ cannam@230: $(HOSTEXTSRCDIR)/PluginLoader.o \ cannam@230: $(HOSTEXTSRCDIR)/PluginSummarisingAdapter.o \ cannam@230: $(HOSTEXTSRCDIR)/PluginWrapper.o cannam@11: cannam@32: SDK_STATIC = \ cannam@230: $(SRCDIR)/libvamp-sdk.a cannam@10: cannam@51: HOSTSDK_STATIC = \ cannam@230: $(SRCDIR)/libvamp-hostsdk.a cannam@51: cannam@32: SDK_DYNAMIC = \ cannam@230: $(SRCDIR)/libvamp-sdk$(PLUGIN_EXT) cannam@32: cannam@51: HOSTSDK_DYNAMIC = \ cannam@230: $(SRCDIR)/libvamp-hostsdk$(PLUGIN_EXT) cannam@51: cannam@33: SDK_LA = \ cannam@230: $(SRCDIR)/libvamp-sdk.la cannam@33: cannam@86: HOSTSDK_LA = \ cannam@230: $(SRCDIR)/libvamp-hostsdk.la cannam@86: cannam@20: PLUGIN_HEADERS = \ cannam@20: $(EXAMPLEDIR)/SpectralCentroid.h \ cannam@35: $(EXAMPLEDIR)/PercussionOnsetDetector.h \ cannam@198: $(EXAMPLEDIR)/FixedTempoEstimator.h \ cannam@41: $(EXAMPLEDIR)/AmplitudeFollower.h \ cannam@20: $(EXAMPLEDIR)/ZeroCrossing.h cannam@20: cannam@10: PLUGIN_OBJECTS = \ cannam@20: $(EXAMPLEDIR)/SpectralCentroid.o \ cannam@35: $(EXAMPLEDIR)/PercussionOnsetDetector.o \ cannam@198: $(EXAMPLEDIR)/FixedTempoEstimator.o \ cannam@41: $(EXAMPLEDIR)/AmplitudeFollower.o \ cannam@10: $(EXAMPLEDIR)/ZeroCrossing.o \ cannam@10: $(EXAMPLEDIR)/plugins.o cannam@10: cannam@10: PLUGIN_TARGET = \ cannam@21: $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT) cannam@10: cannam@20: HOST_HEADERS = \ cannam@20: $(HOSTDIR)/system.h cannam@20: cannam@10: HOST_OBJECTS = \ cannam@22: $(HOSTDIR)/vamp-simple-host.o cannam@10: cannam@10: HOST_TARGET = \ cannam@22: $(HOSTDIR)/vamp-simple-host cannam@10: cannam@89: sdk: sdkstatic $(SDK_DYNAMIC) $(HOSTSDK_DYNAMIC) cannam@64: cannam@82: sdkstatic: $(SDK_STATIC) $(HOSTSDK_STATIC) cannam@89: $(RANLIB) $(SDK_STATIC) cannam@89: $(RANLIB) $(HOSTSDK_STATIC) cannam@82: cannam@64: plugins: $(PLUGIN_TARGET) cannam@64: cannam@64: host: $(HOST_TARGET) cannam@64: cannam@64: all: sdk plugins host test cannam@11: cannam@32: $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS) cannam@20: $(AR) r $@ $(SDK_OBJECTS) cannam@10: cannam@64: $(HOSTSDK_STATIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS) cannam@51: $(AR) r $@ $(HOSTSDK_OBJECTS) cannam@51: cannam@32: $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS) cannam@81: $(CXX) $(LDFLAGS) $(SDK_DYNAMIC_LDFLAGS) -o $@ $(SDK_OBJECTS) cannam@32: cannam@64: $(HOSTSDK_DYNAMIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS) cannam@81: $(CXX) $(LDFLAGS) $(HOSTSDK_DYNAMIC_LDFLAGS) -o $@ $(HOSTSDK_OBJECTS) cannam@51: cannam@64: $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_STATIC) $(PLUGIN_HEADERS) cannam@20: $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS) cannam@10: cannam@64: $(HOST_TARGET): $(HOST_OBJECTS) $(HOSTSDK_STATIC) $(HOST_HEADERS) cannam@20: $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS) cannam@10: cannam@64: test: plugins host cannam@64: VAMP_PATH=$(EXAMPLEDIR) $(HOST_TARGET) -l cannam@10: cannam@10: clean: cannam@51: rm -f $(SDK_OBJECTS) $(HOSTSDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS) cannam@10: cannam@33: distclean: clean cannam@51: rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~ cannam@33: cannam@51: install: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) cannam@96: mkdir -p $(DESTDIR)$(INSTALL_API_HEADERS) cannam@96: mkdir -p $(DESTDIR)$(INSTALL_SDK_HEADERS) cannam@96: mkdir -p $(DESTDIR)$(INSTALL_HOSTEXT_HEADERS) cannam@96: mkdir -p $(DESTDIR)$(INSTALL_SDK_LIBS) cannam@96: mkdir -p $(DESTDIR)$(INSTALL_PKGCONFIG) cannam@96: cp $(API_HEADERS) $(DESTDIR)$(INSTALL_API_HEADERS) cannam@96: cp $(SDK_HEADERS) $(DESTDIR)$(INSTALL_SDK_HEADERS) cannam@96: cp $(HOSTSDK_HEADERS) $(DESTDIR)$(INSTALL_SDK_HEADERS) cannam@96: cp $(HOSTEXT_HEADERS) $(DESTDIR)$(INSTALL_HOSTEXT_HEADERS) cannam@96: cp $(SDK_STATIC) $(DESTDIR)$(INSTALL_SDK_LIBS) cannam@96: cp $(HOSTSDK_STATIC) $(DESTDIR)$(INSTALL_SDK_LIBS) cannam@96: cp $(SDK_DYNAMIC) $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME) cannam@96: cp $(HOSTSDK_DYNAMIC) $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LIBNAME) cannam@96: rm -f $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI) cannam@96: ln -s $(INSTALL_SDK_LIBNAME) $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI) cannam@96: rm -f $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI) cannam@96: ln -s $(INSTALL_HOSTSDK_LIBNAME) $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI) cannam@96: rm -f $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV) cannam@96: ln -s $(INSTALL_SDK_LIBNAME) $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV) cannam@96: rm -f $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV) cannam@96: ln -s $(INSTALL_HOSTSDK_LIBNAME) $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV) cannam@33: sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \ cannam@96: > $(DESTDIR)$(INSTALL_PKGCONFIG)/vamp.pc cannam@33: sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \ cannam@96: > $(DESTDIR)$(INSTALL_PKGCONFIG)/vamp-sdk.pc cannam@51: sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-hostsdk.pc.in \ cannam@96: > $(DESTDIR)$(INSTALL_PKGCONFIG)/vamp-hostsdk.pc cannam@33: sed -e "s,%LIBNAME%,$(INSTALL_SDK_LIBNAME),g" \ cannam@33: -e "s,%LINK_ABI%,$(INSTALL_SDK_LINK_ABI),g" \ cannam@33: -e "s,%LINK_DEV%,$(INSTALL_SDK_LINK_DEV),g" \ cannam@33: -e "s,%STATIC%,$(INSTALL_SDK_STATIC),g" \ cannam@34: -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \ cannam@96: > $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LA) cannam@51: sed -e "s,%LIBNAME%,$(INSTALL_HOSTSDK_LIBNAME),g" \ cannam@51: -e "s,%LINK_ABI%,$(INSTALL_HOSTSDK_LINK_ABI),g" \ cannam@51: -e "s,%LINK_DEV%,$(INSTALL_HOSTSDK_LINK_DEV),g" \ cannam@51: -e "s,%STATIC%,$(INSTALL_HOSTSDK_STATIC),g" \ cannam@86: -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(HOSTSDK_LA).in \ cannam@96: > $(DESTDIR)$(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LA) cannam@51: