annotate Makefile @ 51:2403ae53b8a5 vamp-plugin-sdk-v1.0pre1

* Split out the host adapter code into a separate host sdk library. Plugins link against libvamp-sdk, hosts against libvamp-hostsdk.
author cannam
date Fri, 02 Mar 2007 12:26:53 +0000
parents 2858c897d90f
children 4ab6224110ef 9d3272c7db60
rev   line source
cannam@0 1
cannam@10 2 # Makefile for the Vamp plugin SDK. This builds the SDK objects,
cannam@51 3 # libraries, example plugins, and the test host. Please adjust to
cannam@51 4 # suit your 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@51 18 INSTALL_PREFIX := /usr/local
cannam@51 19 INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp
cannam@51 20 INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk
cannam@51 21 INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib
cannam@51 22
cannam@51 23 INSTALL_SDK_LIBNAME := libvamp-sdk.so.1.0.0
cannam@51 24 INSTALL_SDK_LINK_ABI := libvamp-sdk.so.1
cannam@51 25 INSTALL_SDK_LINK_DEV := libvamp-sdk.so
cannam@51 26 INSTALL_SDK_STATIC := libvamp-sdk.a
cannam@51 27 INSTALL_SDK_LA := libvamp-sdk.la
cannam@51 28
cannam@51 29 INSTALL_HOSTSDK_LIBNAME := libvamp-hostsdk.so.1.0.0
cannam@51 30 INSTALL_HOSTSDK_LINK_ABI := libvamp-hostsdk.so.1
cannam@51 31 INSTALL_HOSTSDK_LINK_DEV := libvamp-hostsdk.so
cannam@51 32 INSTALL_HOSTSDK_STATIC := libvamp-hostsdk.a
cannam@51 33 INSTALL_HOSTSDK_LA := libvamp-hostsdk.la
cannam@51 34
cannam@51 35 INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig
cannam@32 36
cannam@10 37 # Compile flags
cannam@11 38 #
cannam@33 39 CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I$(SDKDIR) -I$(APIDIR) -I.
cannam@1 40
cannam@10 41 # Libraries required for the host at link time
cannam@11 42 #
cannam@51 43 HOST_LIBS = vamp-sdk/libvamp-hostsdk.a -lsndfile -ldl
cannam@0 44
cannam@10 45 # Libraries required for the plugin. Note that we can (and actively
cannam@18 46 # want to) statically link libstdc++, because our plugin exposes only
cannam@10 47 # a C API so there are no boundary compatibility problems.
cannam@11 48 #
cannam@32 49 PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a
cannam@32 50 #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a)
cannam@0 51
cannam@10 52 # Flags required to tell the compiler to link to a dynamically loadable object
cannam@11 53 #
cannam@10 54 PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc
cannam@10 55
cannam@10 56 # File extension for a dynamically loadable object
cannam@11 57 #
cannam@10 58 PLUGIN_EXT = .so
cannam@10 59
cannam@10 60 ## For OS/X with g++:
cannam@10 61 #PLUGIN_LDFLAGS = -dynamiclib
cannam@10 62 #PLUGIN_EXT = .dylib
cannam@10 63
cannam@10 64 ### End of user-serviceable parts
cannam@10 65
cannam@32 66
cannam@20 67 API_HEADERS = \
cannam@20 68 $(APIDIR)/vamp.h
cannam@20 69
cannam@20 70 SDK_HEADERS = \
cannam@20 71 $(SDKDIR)/Plugin.h \
cannam@20 72 $(SDKDIR)/PluginAdapter.h \
cannam@20 73 $(SDKDIR)/PluginBase.h \
cannam@51 74 $(SDKDIR)/RealTime.h
cannam@51 75
cannam@51 76 HOSTSDK_HEADERS = \
cannam@51 77 $(SDKDIR)/Plugin.h \
cannam@51 78 $(SDKDIR)/PluginBase.h \
cannam@20 79 $(SDKDIR)/PluginHostAdapter.h \
cannam@20 80 $(SDKDIR)/RealTime.h
cannam@20 81
cannam@11 82 SDK_OBJECTS = \
cannam@11 83 $(SDKDIR)/PluginAdapter.o \
cannam@51 84 $(SDKDIR)/RealTime.o
cannam@51 85
cannam@51 86 HOSTSDK_OBJECTS = \
cannam@11 87 $(SDKDIR)/PluginHostAdapter.o \
cannam@11 88 $(SDKDIR)/RealTime.o
cannam@11 89
cannam@32 90 SDK_STATIC = \
cannam@11 91 $(SDKDIR)/libvamp-sdk.a
cannam@10 92
cannam@51 93 HOSTSDK_STATIC = \
cannam@51 94 $(SDKDIR)/libvamp-hostsdk.a
cannam@51 95
cannam@32 96 SDK_DYNAMIC = \
cannam@32 97 $(SDKDIR)/libvamp-sdk.so
cannam@32 98
cannam@51 99 HOSTSDK_DYNAMIC = \
cannam@51 100 $(SDKDIR)/libvamp-hostsdk.so
cannam@51 101
cannam@33 102 SDK_LA = \
cannam@33 103 $(SDKDIR)/libvamp-sdk.la
cannam@33 104
cannam@20 105 PLUGIN_HEADERS = \
cannam@20 106 $(EXAMPLEDIR)/SpectralCentroid.h \
cannam@35 107 $(EXAMPLEDIR)/PercussionOnsetDetector.h \
cannam@41 108 $(EXAMPLEDIR)/AmplitudeFollower.h \
cannam@20 109 $(EXAMPLEDIR)/ZeroCrossing.h
cannam@20 110
cannam@10 111 PLUGIN_OBJECTS = \
cannam@20 112 $(EXAMPLEDIR)/SpectralCentroid.o \
cannam@35 113 $(EXAMPLEDIR)/PercussionOnsetDetector.o \
cannam@41 114 $(EXAMPLEDIR)/AmplitudeFollower.o \
cannam@10 115 $(EXAMPLEDIR)/ZeroCrossing.o \
cannam@10 116 $(EXAMPLEDIR)/plugins.o
cannam@10 117
cannam@10 118 PLUGIN_TARGET = \
cannam@21 119 $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT)
cannam@10 120
cannam@20 121 HOST_HEADERS = \
cannam@20 122 $(HOSTDIR)/system.h
cannam@20 123
cannam@10 124 HOST_OBJECTS = \
cannam@22 125 $(HOSTDIR)/vamp-simple-host.o
cannam@10 126
cannam@10 127 HOST_TARGET = \
cannam@22 128 $(HOSTDIR)/vamp-simple-host
cannam@10 129
cannam@51 130 all: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) test
cannam@11 131
cannam@32 132 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@20 133 $(AR) r $@ $(SDK_OBJECTS)
cannam@10 134
cannam@51 135 $(HOSTSDK_STATIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS)
cannam@51 136 $(AR) r $@ $(HOSTSDK_OBJECTS)
cannam@51 137
cannam@32 138 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@32 139 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS)
cannam@32 140
cannam@51 141 $(HOSTSDK_DYNAMIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS)
cannam@51 142 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(HOSTSDK_OBJECTS)
cannam@51 143
cannam@20 144 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS)
cannam@20 145 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
cannam@10 146
cannam@51 147 $(HOST_TARGET): $(HOST_OBJECTS) $(HOSTSDK_TARGET) $(HOST_HEADERS)
cannam@20 148 $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS)
cannam@10 149
cannam@10 150 test: $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 151 $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 152
cannam@10 153 clean:
cannam@51 154 rm -f $(SDK_OBJECTS) $(HOSTSDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
cannam@10 155
cannam@33 156 distclean: clean
cannam@51 157 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
cannam@33 158
cannam@51 159 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
cannam@32 160 mkdir -p $(INSTALL_API_HEADERS)
cannam@32 161 mkdir -p $(INSTALL_SDK_HEADERS)
cannam@32 162 mkdir -p $(INSTALL_SDK_LIBS)
cannam@32 163 mkdir -p $(INSTALL_PKGCONFIG)
cannam@32 164 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
cannam@32 165 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@51 166 cp $(HOSTSDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@32 167 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@51 168 cp $(HOSTSDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@32 169 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
cannam@51 170 cp $(HOSTSDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LIBNAME)
cannam@32 171 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 172 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@51 173 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI)
cannam@51 174 ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI)
cannam@32 175 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@35 176 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@51 177 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV)
cannam@51 178 ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV)
cannam@33 179 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \
cannam@33 180 > $(INSTALL_PKGCONFIG)/vamp.pc
cannam@33 181 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \
cannam@33 182 > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
cannam@51 183 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-hostsdk.pc.in \
cannam@51 184 > $(INSTALL_PKGCONFIG)/vamp-hostsdk.pc
cannam@33 185 sed -e "s,%LIBNAME%,$(INSTALL_SDK_LIBNAME),g" \
cannam@33 186 -e "s,%LINK_ABI%,$(INSTALL_SDK_LINK_ABI),g" \
cannam@33 187 -e "s,%LINK_DEV%,$(INSTALL_SDK_LINK_DEV),g" \
cannam@33 188 -e "s,%STATIC%,$(INSTALL_SDK_STATIC),g" \
cannam@34 189 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
cannam@33 190 > $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LA)
cannam@51 191 sed -e "s,%LIBNAME%,$(INSTALL_HOSTSDK_LIBNAME),g" \
cannam@51 192 -e "s,%LINK_ABI%,$(INSTALL_HOSTSDK_LINK_ABI),g" \
cannam@51 193 -e "s,%LINK_DEV%,$(INSTALL_HOSTSDK_LINK_DEV),g" \
cannam@51 194 -e "s,%STATIC%,$(INSTALL_HOSTSDK_STATIC),g" \
cannam@51 195 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
cannam@51 196 > $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LA)
cannam@51 197