annotate Makefile @ 32:13eae6cc6bac

* Add a function to look up the Vamp plugin path for the current platform. * Add make install stage and pkgconfig files. (This bit is rather Linux-specific.)
author cannam
date Mon, 31 Jul 2006 16:12:37 +0000
parents 1eb44d33a371
children 909fe32e2c3c
rev   line source
cannam@0 1
cannam@10 2 # Makefile for the Vamp plugin SDK. This builds the SDK objects,
cannam@10 3 # example plugins, and the test host. Please adjust to suit your
cannam@10 4 # operating system requirements.
cannam@0 5
cannam@10 6 SDKDIR = vamp-sdk
cannam@10 7 APIDIR = vamp
cannam@10 8 EXAMPLEDIR = examples
cannam@10 9 HOSTDIR = host
cannam@1 10
cannam@0 11
cannam@10 12 ### Start of user-serviceable parts
cannam@1 13
cannam@32 14 # Locations for "make install". This will need quite a bit of
cannam@32 15 # editing for non-Linux platforms. Of course you don't necessarily
cannam@32 16 # have to use "make install".
cannam@32 17 #
cannam@32 18 INSTALL_PREFIX := /usr/local
cannam@32 19 INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp/
cannam@32 20 INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk/
cannam@32 21 INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib/
cannam@32 22 INSTALL_SDK_LIBNAME := libvamp-sdk.so.0.9.5
cannam@32 23 INSTALL_SDK_LINK_ABI := libvamp-sdk.so.0
cannam@32 24 INSTALL_SDK_LINK_DEV := libvamp-sdk.so
cannam@32 25 INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig/
cannam@32 26
cannam@10 27 # Compile flags
cannam@11 28 #
cannam@22 29 CXXFLAGS := $(CXXFLAGS) -g -Wall -I$(SDKDIR) -I$(APIDIR) -I.
cannam@1 30
cannam@10 31 # Libraries required for the host at link time
cannam@11 32 #
cannam@32 33 HOST_LIBS = vamp-sdk/libvamp-sdk.a -lsndfile -ldl
cannam@0 34
cannam@10 35 # Libraries required for the plugin. Note that we can (and actively
cannam@18 36 # want to) statically link libstdc++, because our plugin exposes only
cannam@10 37 # a C API so there are no boundary compatibility problems.
cannam@11 38 #
cannam@32 39 PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a
cannam@32 40 #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a)
cannam@0 41
cannam@10 42 # Flags required to tell the compiler to link to a dynamically loadable object
cannam@11 43 #
cannam@10 44 PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc
cannam@10 45
cannam@10 46 # File extension for a dynamically loadable object
cannam@11 47 #
cannam@10 48 PLUGIN_EXT = .so
cannam@10 49
cannam@10 50 ## For OS/X with g++:
cannam@10 51 #PLUGIN_LDFLAGS = -dynamiclib
cannam@10 52 #PLUGIN_EXT = .dylib
cannam@10 53
cannam@10 54 ### End of user-serviceable parts
cannam@10 55
cannam@32 56
cannam@20 57 API_HEADERS = \
cannam@20 58 $(APIDIR)/vamp.h
cannam@20 59
cannam@20 60 SDK_HEADERS = \
cannam@20 61 $(SDKDIR)/Plugin.h \
cannam@20 62 $(SDKDIR)/PluginAdapter.h \
cannam@20 63 $(SDKDIR)/PluginBase.h \
cannam@20 64 $(SDKDIR)/PluginHostAdapter.h \
cannam@20 65 $(SDKDIR)/RealTime.h
cannam@20 66
cannam@11 67 SDK_OBJECTS = \
cannam@11 68 $(SDKDIR)/PluginAdapter.o \
cannam@11 69 $(SDKDIR)/PluginHostAdapter.o \
cannam@11 70 $(SDKDIR)/RealTime.o
cannam@11 71
cannam@32 72 SDK_STATIC = \
cannam@11 73 $(SDKDIR)/libvamp-sdk.a
cannam@10 74
cannam@32 75 SDK_DYNAMIC = \
cannam@32 76 $(SDKDIR)/libvamp-sdk.so
cannam@32 77
cannam@20 78 PLUGIN_HEADERS = \
cannam@20 79 $(EXAMPLEDIR)/SpectralCentroid.h \
cannam@20 80 $(EXAMPLEDIR)/ZeroCrossing.h
cannam@20 81
cannam@10 82 PLUGIN_OBJECTS = \
cannam@20 83 $(EXAMPLEDIR)/SpectralCentroid.o \
cannam@10 84 $(EXAMPLEDIR)/ZeroCrossing.o \
cannam@10 85 $(EXAMPLEDIR)/plugins.o
cannam@10 86
cannam@10 87 PLUGIN_TARGET = \
cannam@21 88 $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT)
cannam@10 89
cannam@20 90 HOST_HEADERS = \
cannam@20 91 $(HOSTDIR)/system.h
cannam@20 92
cannam@10 93 HOST_OBJECTS = \
cannam@22 94 $(HOSTDIR)/vamp-simple-host.o
cannam@10 95
cannam@10 96 HOST_TARGET = \
cannam@22 97 $(HOSTDIR)/vamp-simple-host
cannam@10 98
cannam@32 99 all: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) test
cannam@11 100
cannam@32 101 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@20 102 $(AR) r $@ $(SDK_OBJECTS)
cannam@10 103
cannam@32 104 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@32 105 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS)
cannam@32 106
cannam@20 107 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS)
cannam@20 108 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
cannam@10 109
cannam@20 110 $(HOST_TARGET): $(HOST_OBJECTS) $(SDK_TARGET) $(HOST_HEADERS)
cannam@20 111 $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS)
cannam@10 112
cannam@10 113 test: $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 114 $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 115
cannam@10 116 clean:
cannam@11 117 rm -f $(SDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
cannam@10 118
cannam@32 119 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
cannam@32 120 mkdir -p $(INSTALL_API_HEADERS)
cannam@32 121 mkdir -p $(INSTALL_SDK_HEADERS)
cannam@32 122 mkdir -p $(INSTALL_SDK_LIBS)
cannam@32 123 mkdir -p $(INSTALL_PKGCONFIG)
cannam@32 124 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
cannam@32 125 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@32 126 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@32 127 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
cannam@32 128 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 129 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 130 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@32 131 ln -s $(INSTALL_SDK_LINK_ABI) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@32 132 sed "s,%PREFIX%,$(INSTALL_PREFIX)," vamp/vamp.pc.in > $(INSTALL_PKGCONFIG)/vamp.pc
cannam@32 133 sed "s,%PREFIX%,$(INSTALL_PREFIX)," vamp-sdk/vamp-sdk.pc.in > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
cannam@32 134
cannam@10 135 distclean: clean
cannam@32 136 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
cannam@10 137
cannam@10 138