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@58: ## Choose your cannam@58: cannam@58: APIDIR = vamp cannam@10: SDKDIR = vamp-sdk cannam@58: HOSTEXTDIR = vamp-sdk/hostext cannam@10: EXAMPLEDIR = examples cannam@10: HOSTDIR = host cannam@1: cannam@58: ### cannam@58: ### Start of user-serviceable parts cannam@58: ### cannam@0: cannam@58: # Default build target (or use "make " to select one). cannam@58: # Targets are: cannam@58: # all -- build everything cannam@58: # sdk -- build all the Vamp SDK libraries for plugins and hosts cannam@58: # plugins -- build the example plugins (and the SDK if required) cannam@58: # host -- build the simple Vamp plugin host (and the SDK if required) cannam@58: # test -- build the host and example plugins, and run a quick test cannam@58: # clean -- remove binary targets cannam@58: # distclean -- remove all targets cannam@58: # cannam@58: default: all cannam@58: cannam@58: # Compile flags cannam@58: # cannam@58: CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I$(SDKDIR) -I$(HOSTEXTDIR) -I$(APIDIR) -I. cannam@58: cannam@58: # Libraries required for the plugins. cannam@58: # (Note that it is desirable to statically link libstdc++ if possible, cannam@58: # because our plugin exposes only a C API so there are no boundary cannam@58: # compatibility problems.) cannam@58: # cannam@58: PLUGIN_LIBS = $(SDKDIR)/libvamp-sdk.a cannam@58: #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a) cannam@58: cannam@58: # Flags required to tell the compiler to link to a dynamically loadable object cannam@58: # cannam@58: PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc cannam@58: cannam@58: # File extension for a dynamically loadable object cannam@58: # cannam@58: PLUGIN_EXT = .so cannam@58: cannam@58: ## For OS/X with g++: cannam@58: #PLUGIN_LDFLAGS = -dynamiclib cannam@58: #PLUGIN_EXT = .dylib cannam@58: cannam@58: # Libraries required for the host. cannam@58: # cannam@58: 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@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@58: $(SDKDIR)/PluginHostAdapter.h \ cannam@58: $(HOSTEXTDIR)/PluginInputDomainAdapter.h \ cannam@58: $(HOSTEXTDIR)/PluginLoader.h \ cannam@58: $(HOSTEXTDIR)/PluginWrapper.h \ cannam@20: $(SDKDIR)/RealTime.h cannam@20: cannam@11: SDK_OBJECTS = \ cannam@11: $(SDKDIR)/PluginAdapter.o \ cannam@51: $(SDKDIR)/RealTime.o cannam@51: cannam@51: HOSTSDK_OBJECTS = \ cannam@58: $(SDKDIR)/PluginHostAdapter.o \ cannam@58: $(HOSTEXTDIR)/PluginInputDomainAdapter.o \ cannam@58: $(HOSTEXTDIR)/PluginLoader.o \ cannam@58: $(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@58: $(SDKDIR)/libvamp-hostsdk.a cannam@51: cannam@32: SDK_DYNAMIC = \ cannam@32: $(SDKDIR)/libvamp-sdk.so cannam@32: cannam@51: HOSTSDK_DYNAMIC = \ cannam@58: $(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@58: sdk: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) cannam@58: cannam@58: plugins: sdk $(PLUGIN_TARGET) cannam@58: cannam@58: host: sdk $(HOST_TARGET) cannam@58: cannam@58: 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@51: $(HOSTSDK_STATIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_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@51: $(HOSTSDK_DYNAMIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) cannam@51: $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(HOSTSDK_OBJECTS) cannam@51: cannam@20: $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS) cannam@20: $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS) cannam@10: cannam@51: $(HOST_TARGET): $(HOST_OBJECTS) $(HOSTSDK_TARGET) $(HOST_HEADERS) cannam@20: $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS) cannam@10: cannam@58: test: plugins host cannam@10: $(HOST_TARGET) $(PLUGIN_TARGET) 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@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@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: