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@10: SDKDIR = vamp-sdk cannam@64: HOSTEXTDIR = vamp-sdk/hostext 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@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@64: CXXFLAGS := $(CXXFLAGS) -g -Wall -I. cannam@64: cannam@64: # Libraries required for the plugins. cannam@64: # (Note that it is desirable to statically link libstdc++ if possible, cannam@64: # because our plugin exposes only a C API so there are no boundary cannam@64: # compatibility problems.) cannam@64: # cannam@64: PLUGIN_LIBS = $(SDKDIR)/libvamp-sdk.a cannam@64: #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a) cannam@64: cannam@64: # Flags required to tell the compiler to link to a dynamically loadable object cannam@64: # cannam@64: PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc cannam@64: cannam@64: # File extension for a dynamically loadable object cannam@64: # cannam@64: PLUGIN_EXT = .so cannam@64: cannam@64: ## For OS/X with g++: cannam@64: #PLUGIN_LDFLAGS = -dynamiclib cannam@64: #PLUGIN_EXT = .dylib cannam@64: cannam@64: # Libraries required for the host. cannam@64: # cannam@64: HOST_LIBS = $(SDKDIR)/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@51: 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@51: INSTALL_SDK_LIBNAME := libvamp-sdk.so.1.0.0 cannam@51: INSTALL_SDK_LINK_ABI := libvamp-sdk.so.1 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@51: INSTALL_HOSTSDK_LIBNAME := libvamp-hostsdk.so.1.0.0 cannam@51: INSTALL_HOSTSDK_LINK_ABI := libvamp-hostsdk.so.1 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@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@51: $(SDKDIR)/Plugin.h \ cannam@51: $(SDKDIR)/PluginBase.h \ cannam@20: $(SDKDIR)/PluginHostAdapter.h \ cannam@20: $(SDKDIR)/RealTime.h cannam@20: cannam@64: HOSTEXT_HEADERS = \ cannam@64: $(HOSTEXTDIR)/PluginChannelAdapter.h \ cannam@64: $(HOSTEXTDIR)/PluginInputDomainAdapter.h \ cannam@64: $(HOSTEXTDIR)/PluginLoader.h \ cannam@64: $(HOSTEXTDIR)/PluginWrapper.h cannam@64: cannam@11: SDK_OBJECTS = \ cannam@11: $(SDKDIR)/PluginAdapter.o \ cannam@51: $(SDKDIR)/RealTime.o cannam@51: cannam@51: HOSTSDK_OBJECTS = \ cannam@11: $(SDKDIR)/PluginHostAdapter.o \ cannam@64: $(HOSTEXTDIR)/PluginChannelAdapter.o \ cannam@64: $(HOSTEXTDIR)/PluginInputDomainAdapter.o \ cannam@64: $(HOSTEXTDIR)/PluginLoader.o \ cannam@64: $(HOSTEXTDIR)/PluginWrapper.o \ cannam@11: $(SDKDIR)/RealTime.o cannam@11: cannam@32: SDK_STATIC = \ cannam@11: $(SDKDIR)/libvamp-sdk.a cannam@10: cannam@51: HOSTSDK_STATIC = \ cannam@51: $(SDKDIR)/libvamp-hostsdk.a cannam@51: cannam@32: SDK_DYNAMIC = \ cannam@32: $(SDKDIR)/libvamp-sdk.so cannam@32: cannam@51: HOSTSDK_DYNAMIC = \ cannam@51: $(SDKDIR)/libvamp-hostsdk.so cannam@51: cannam@33: SDK_LA = \ cannam@33: $(SDKDIR)/libvamp-sdk.la cannam@33: cannam@20: PLUGIN_HEADERS = \ cannam@20: $(EXAMPLEDIR)/SpectralCentroid.h \ cannam@35: $(EXAMPLEDIR)/PercussionOnsetDetector.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@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@64: sdk: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) cannam@64: 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@32: $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS) cannam@32: cannam@64: $(HOSTSDK_DYNAMIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS) cannam@51: $(CXX) $(LDFLAGS) $(PLUGIN_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@32: mkdir -p $(INSTALL_API_HEADERS) cannam@32: mkdir -p $(INSTALL_SDK_HEADERS) cannam@64: mkdir -p $(INSTALL_HOSTEXT_HEADERS) cannam@32: mkdir -p $(INSTALL_SDK_LIBS) cannam@32: mkdir -p $(INSTALL_PKGCONFIG) cannam@32: cp $(API_HEADERS) $(INSTALL_API_HEADERS) cannam@32: cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS) cannam@51: cp $(HOSTSDK_HEADERS) $(INSTALL_SDK_HEADERS) cannam@64: cp $(HOSTEXT_HEADERS) $(INSTALL_HOSTEXT_HEADERS) cannam@32: cp $(SDK_STATIC) $(INSTALL_SDK_LIBS) cannam@51: cp $(HOSTSDK_STATIC) $(INSTALL_SDK_LIBS) cannam@32: cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME) cannam@51: cp $(HOSTSDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LIBNAME) cannam@32: rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI) cannam@32: ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI) cannam@51: rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI) cannam@51: ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI) cannam@32: rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV) cannam@35: ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV) cannam@51: rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV) cannam@51: ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV) cannam@33: sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \ cannam@33: > $(INSTALL_PKGCONFIG)/vamp.pc cannam@33: sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \ cannam@33: > $(INSTALL_PKGCONFIG)/vamp-sdk.pc cannam@51: sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-hostsdk.pc.in \ cannam@51: > $(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@33: > $(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@51: -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \ cannam@51: > $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LA) cannam@51: