cannam@0: cannam@10: # Makefile for the Vamp plugin SDK. This builds the SDK objects, cannam@10: # example plugins, and the test host. Please adjust to suit your cannam@10: # operating system requirements. cannam@0: cannam@10: SDKDIR = vamp-sdk cannam@10: APIDIR = vamp cannam@10: EXAMPLEDIR = examples cannam@10: HOSTDIR = host cannam@1: cannam@0: cannam@10: ### Start of user-serviceable parts 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@32: INSTALL_PREFIX := /usr/local cannam@32: INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp/ cannam@32: INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk/ cannam@32: INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib/ cannam@32: INSTALL_SDK_LIBNAME := libvamp-sdk.so.0.9.5 cannam@32: INSTALL_SDK_LINK_ABI := libvamp-sdk.so.0 cannam@32: INSTALL_SDK_LINK_DEV := libvamp-sdk.so cannam@32: INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig/ cannam@32: cannam@10: # Compile flags cannam@11: # cannam@22: CXXFLAGS := $(CXXFLAGS) -g -Wall -I$(SDKDIR) -I$(APIDIR) -I. cannam@1: cannam@10: # Libraries required for the host at link time cannam@11: # cannam@32: HOST_LIBS = vamp-sdk/libvamp-sdk.a -lsndfile -ldl cannam@0: cannam@10: # Libraries required for the plugin. Note that we can (and actively cannam@18: # want to) statically link libstdc++, because our plugin exposes only cannam@10: # a C API so there are no boundary compatibility problems. cannam@11: # cannam@32: PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a cannam@32: #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a) cannam@0: cannam@10: # Flags required to tell the compiler to link to a dynamically loadable object cannam@11: # cannam@10: PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc cannam@10: cannam@10: # File extension for a dynamically loadable object cannam@11: # cannam@10: PLUGIN_EXT = .so cannam@10: cannam@10: ## For OS/X with g++: cannam@10: #PLUGIN_LDFLAGS = -dynamiclib cannam@10: #PLUGIN_EXT = .dylib cannam@10: 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@20: $(SDKDIR)/PluginHostAdapter.h \ cannam@20: $(SDKDIR)/RealTime.h cannam@20: cannam@11: SDK_OBJECTS = \ cannam@11: $(SDKDIR)/PluginAdapter.o \ cannam@11: $(SDKDIR)/PluginHostAdapter.o \ cannam@11: $(SDKDIR)/RealTime.o cannam@11: cannam@32: SDK_STATIC = \ cannam@11: $(SDKDIR)/libvamp-sdk.a cannam@10: cannam@32: SDK_DYNAMIC = \ cannam@32: $(SDKDIR)/libvamp-sdk.so cannam@32: cannam@20: PLUGIN_HEADERS = \ cannam@20: $(EXAMPLEDIR)/SpectralCentroid.h \ cannam@20: $(EXAMPLEDIR)/ZeroCrossing.h cannam@20: cannam@10: PLUGIN_OBJECTS = \ cannam@20: $(EXAMPLEDIR)/SpectralCentroid.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@32: all: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) test cannam@11: cannam@32: $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS) cannam@20: $(AR) r $@ $(SDK_OBJECTS) cannam@10: cannam@32: $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS) cannam@32: $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS) cannam@32: cannam@20: $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS) cannam@20: $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS) cannam@10: cannam@20: $(HOST_TARGET): $(HOST_OBJECTS) $(SDK_TARGET) $(HOST_HEADERS) cannam@20: $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS) cannam@10: cannam@10: test: $(HOST_TARGET) $(PLUGIN_TARGET) cannam@10: $(HOST_TARGET) $(PLUGIN_TARGET) cannam@10: cannam@10: clean: cannam@11: rm -f $(SDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS) cannam@10: cannam@32: install: $(SDK_STATIC) $(SDK_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@32: cp $(SDK_STATIC) $(INSTALL_SDK_LIBS) cannam@32: cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_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@32: rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV) cannam@32: ln -s $(INSTALL_SDK_LINK_ABI) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV) cannam@32: sed "s,%PREFIX%,$(INSTALL_PREFIX)," vamp/vamp.pc.in > $(INSTALL_PKGCONFIG)/vamp.pc cannam@32: sed "s,%PREFIX%,$(INSTALL_PREFIX)," vamp-sdk/vamp-sdk.pc.in > $(INSTALL_PKGCONFIG)/vamp-sdk.pc cannam@32: cannam@10: distclean: clean cannam@32: rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~ cannam@10: cannam@10: