annotate Makefile @ 77:ba5f87117b67 vamp-plugin-sdk-v1.1pre1

...
author cannam
date Thu, 07 Jun 2007 14:22:22 +0000
parents 9d3272c7db60
children e33fa45f0935
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@64 6 APIDIR = vamp
cannam@10 7 SDKDIR = vamp-sdk
cannam@64 8 HOSTEXTDIR = vamp-sdk/hostext
cannam@10 9 EXAMPLEDIR = examples
cannam@10 10 HOSTDIR = host
cannam@1 11
cannam@64 12 ###
cannam@64 13 ### Start of user-serviceable parts
cannam@64 14 ###
cannam@0 15
cannam@64 16 # Default build target (or use "make <target>" to select one).
cannam@64 17 # Targets are:
cannam@64 18 # all -- build everything
cannam@64 19 # sdk -- build all the Vamp SDK libraries for plugins and hosts
cannam@64 20 # plugins -- build the example plugins (and the SDK if required)
cannam@64 21 # host -- build the simple Vamp plugin host (and the SDK if required)
cannam@64 22 # test -- build the host and example plugins, and run a quick test
cannam@64 23 # clean -- remove binary targets
cannam@64 24 # distclean -- remove all targets
cannam@64 25 #
cannam@64 26 default: all
cannam@64 27
cannam@64 28 # Compile flags
cannam@64 29 #
cannam@77 30 CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I.
cannam@64 31
cannam@64 32 # Libraries required for the plugins.
cannam@64 33 # (Note that it is desirable to statically link libstdc++ if possible,
cannam@64 34 # because our plugin exposes only a C API so there are no boundary
cannam@64 35 # compatibility problems.)
cannam@64 36 #
cannam@64 37 PLUGIN_LIBS = $(SDKDIR)/libvamp-sdk.a
cannam@64 38 #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a)
cannam@64 39
cannam@64 40 # Flags required to tell the compiler to link to a dynamically loadable object
cannam@64 41 #
cannam@64 42 PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc
cannam@64 43
cannam@64 44 # File extension for a dynamically loadable object
cannam@64 45 #
cannam@64 46 PLUGIN_EXT = .so
cannam@64 47
cannam@64 48 ## For OS/X with g++:
cannam@64 49 #PLUGIN_LDFLAGS = -dynamiclib
cannam@64 50 #PLUGIN_EXT = .dylib
cannam@64 51
cannam@64 52 # Libraries required for the host.
cannam@64 53 #
cannam@64 54 HOST_LIBS = $(SDKDIR)/libvamp-hostsdk.a -lsndfile -ldl
cannam@1 55
cannam@32 56 # Locations for "make install". This will need quite a bit of
cannam@32 57 # editing for non-Linux platforms. Of course you don't necessarily
cannam@32 58 # have to use "make install".
cannam@32 59 #
cannam@51 60 INSTALL_PREFIX := /usr/local
cannam@51 61 INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp
cannam@51 62 INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk
cannam@64 63 INSTALL_HOSTEXT_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk/hostext
cannam@51 64 INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib
cannam@51 65
cannam@51 66 INSTALL_SDK_LIBNAME := libvamp-sdk.so.1.0.0
cannam@51 67 INSTALL_SDK_LINK_ABI := libvamp-sdk.so.1
cannam@51 68 INSTALL_SDK_LINK_DEV := libvamp-sdk.so
cannam@51 69 INSTALL_SDK_STATIC := libvamp-sdk.a
cannam@51 70 INSTALL_SDK_LA := libvamp-sdk.la
cannam@51 71
cannam@51 72 INSTALL_HOSTSDK_LIBNAME := libvamp-hostsdk.so.1.0.0
cannam@51 73 INSTALL_HOSTSDK_LINK_ABI := libvamp-hostsdk.so.1
cannam@51 74 INSTALL_HOSTSDK_LINK_DEV := libvamp-hostsdk.so
cannam@51 75 INSTALL_HOSTSDK_STATIC := libvamp-hostsdk.a
cannam@51 76 INSTALL_HOSTSDK_LA := libvamp-hostsdk.la
cannam@51 77
cannam@51 78 INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig
cannam@32 79
cannam@10 80 ### End of user-serviceable parts
cannam@10 81
cannam@32 82
cannam@20 83 API_HEADERS = \
cannam@20 84 $(APIDIR)/vamp.h
cannam@20 85
cannam@20 86 SDK_HEADERS = \
cannam@20 87 $(SDKDIR)/Plugin.h \
cannam@20 88 $(SDKDIR)/PluginAdapter.h \
cannam@20 89 $(SDKDIR)/PluginBase.h \
cannam@51 90 $(SDKDIR)/RealTime.h
cannam@51 91
cannam@51 92 HOSTSDK_HEADERS = \
cannam@51 93 $(SDKDIR)/Plugin.h \
cannam@51 94 $(SDKDIR)/PluginBase.h \
cannam@20 95 $(SDKDIR)/PluginHostAdapter.h \
cannam@20 96 $(SDKDIR)/RealTime.h
cannam@20 97
cannam@64 98 HOSTEXT_HEADERS = \
cannam@64 99 $(HOSTEXTDIR)/PluginChannelAdapter.h \
cannam@64 100 $(HOSTEXTDIR)/PluginInputDomainAdapter.h \
cannam@64 101 $(HOSTEXTDIR)/PluginLoader.h \
cannam@64 102 $(HOSTEXTDIR)/PluginWrapper.h
cannam@64 103
cannam@11 104 SDK_OBJECTS = \
cannam@11 105 $(SDKDIR)/PluginAdapter.o \
cannam@51 106 $(SDKDIR)/RealTime.o
cannam@51 107
cannam@51 108 HOSTSDK_OBJECTS = \
cannam@11 109 $(SDKDIR)/PluginHostAdapter.o \
cannam@64 110 $(HOSTEXTDIR)/PluginChannelAdapter.o \
cannam@64 111 $(HOSTEXTDIR)/PluginInputDomainAdapter.o \
cannam@64 112 $(HOSTEXTDIR)/PluginLoader.o \
cannam@64 113 $(HOSTEXTDIR)/PluginWrapper.o \
cannam@11 114 $(SDKDIR)/RealTime.o
cannam@11 115
cannam@32 116 SDK_STATIC = \
cannam@11 117 $(SDKDIR)/libvamp-sdk.a
cannam@10 118
cannam@51 119 HOSTSDK_STATIC = \
cannam@51 120 $(SDKDIR)/libvamp-hostsdk.a
cannam@51 121
cannam@32 122 SDK_DYNAMIC = \
cannam@32 123 $(SDKDIR)/libvamp-sdk.so
cannam@32 124
cannam@51 125 HOSTSDK_DYNAMIC = \
cannam@51 126 $(SDKDIR)/libvamp-hostsdk.so
cannam@51 127
cannam@33 128 SDK_LA = \
cannam@33 129 $(SDKDIR)/libvamp-sdk.la
cannam@33 130
cannam@20 131 PLUGIN_HEADERS = \
cannam@20 132 $(EXAMPLEDIR)/SpectralCentroid.h \
cannam@35 133 $(EXAMPLEDIR)/PercussionOnsetDetector.h \
cannam@41 134 $(EXAMPLEDIR)/AmplitudeFollower.h \
cannam@20 135 $(EXAMPLEDIR)/ZeroCrossing.h
cannam@20 136
cannam@10 137 PLUGIN_OBJECTS = \
cannam@20 138 $(EXAMPLEDIR)/SpectralCentroid.o \
cannam@35 139 $(EXAMPLEDIR)/PercussionOnsetDetector.o \
cannam@41 140 $(EXAMPLEDIR)/AmplitudeFollower.o \
cannam@10 141 $(EXAMPLEDIR)/ZeroCrossing.o \
cannam@10 142 $(EXAMPLEDIR)/plugins.o
cannam@10 143
cannam@10 144 PLUGIN_TARGET = \
cannam@21 145 $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT)
cannam@10 146
cannam@20 147 HOST_HEADERS = \
cannam@20 148 $(HOSTDIR)/system.h
cannam@20 149
cannam@10 150 HOST_OBJECTS = \
cannam@22 151 $(HOSTDIR)/vamp-simple-host.o
cannam@10 152
cannam@10 153 HOST_TARGET = \
cannam@22 154 $(HOSTDIR)/vamp-simple-host
cannam@10 155
cannam@64 156 sdk: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC)
cannam@64 157
cannam@64 158 plugins: $(PLUGIN_TARGET)
cannam@64 159
cannam@64 160 host: $(HOST_TARGET)
cannam@64 161
cannam@64 162 all: sdk plugins host test
cannam@11 163
cannam@32 164 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@20 165 $(AR) r $@ $(SDK_OBJECTS)
cannam@10 166
cannam@64 167 $(HOSTSDK_STATIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS)
cannam@51 168 $(AR) r $@ $(HOSTSDK_OBJECTS)
cannam@51 169
cannam@32 170 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@32 171 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS)
cannam@32 172
cannam@64 173 $(HOSTSDK_DYNAMIC): $(HOSTSDK_OBJECTS) $(API_HEADERS) $(HOSTSDK_HEADERS) $(HOSTEXT_HEADERS)
cannam@51 174 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(HOSTSDK_OBJECTS)
cannam@51 175
cannam@64 176 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_STATIC) $(PLUGIN_HEADERS)
cannam@20 177 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
cannam@10 178
cannam@64 179 $(HOST_TARGET): $(HOST_OBJECTS) $(HOSTSDK_STATIC) $(HOST_HEADERS)
cannam@20 180 $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS)
cannam@10 181
cannam@64 182 test: plugins host
cannam@64 183 VAMP_PATH=$(EXAMPLEDIR) $(HOST_TARGET) -l
cannam@10 184
cannam@10 185 clean:
cannam@51 186 rm -f $(SDK_OBJECTS) $(HOSTSDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
cannam@10 187
cannam@33 188 distclean: clean
cannam@51 189 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
cannam@33 190
cannam@51 191 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(HOSTSDK_STATIC) $(HOSTSDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
cannam@32 192 mkdir -p $(INSTALL_API_HEADERS)
cannam@32 193 mkdir -p $(INSTALL_SDK_HEADERS)
cannam@64 194 mkdir -p $(INSTALL_HOSTEXT_HEADERS)
cannam@32 195 mkdir -p $(INSTALL_SDK_LIBS)
cannam@32 196 mkdir -p $(INSTALL_PKGCONFIG)
cannam@32 197 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
cannam@32 198 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@51 199 cp $(HOSTSDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@64 200 cp $(HOSTEXT_HEADERS) $(INSTALL_HOSTEXT_HEADERS)
cannam@32 201 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@51 202 cp $(HOSTSDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@32 203 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
cannam@51 204 cp $(HOSTSDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LIBNAME)
cannam@32 205 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 206 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@51 207 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI)
cannam@51 208 ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_ABI)
cannam@32 209 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@35 210 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@51 211 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV)
cannam@51 212 ln -s $(INSTALL_HOSTSDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LINK_DEV)
cannam@33 213 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \
cannam@33 214 > $(INSTALL_PKGCONFIG)/vamp.pc
cannam@33 215 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \
cannam@33 216 > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
cannam@51 217 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-hostsdk.pc.in \
cannam@51 218 > $(INSTALL_PKGCONFIG)/vamp-hostsdk.pc
cannam@33 219 sed -e "s,%LIBNAME%,$(INSTALL_SDK_LIBNAME),g" \
cannam@33 220 -e "s,%LINK_ABI%,$(INSTALL_SDK_LINK_ABI),g" \
cannam@33 221 -e "s,%LINK_DEV%,$(INSTALL_SDK_LINK_DEV),g" \
cannam@33 222 -e "s,%STATIC%,$(INSTALL_SDK_STATIC),g" \
cannam@34 223 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
cannam@33 224 > $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LA)
cannam@51 225 sed -e "s,%LIBNAME%,$(INSTALL_HOSTSDK_LIBNAME),g" \
cannam@51 226 -e "s,%LINK_ABI%,$(INSTALL_HOSTSDK_LINK_ABI),g" \
cannam@51 227 -e "s,%LINK_DEV%,$(INSTALL_HOSTSDK_LINK_DEV),g" \
cannam@51 228 -e "s,%STATIC%,$(INSTALL_HOSTSDK_STATIC),g" \
cannam@51 229 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
cannam@51 230 > $(INSTALL_SDK_LIBS)/$(INSTALL_HOSTSDK_LA)
cannam@51 231