annotate Makefile @ 57:09a1aac6c362 host-factory-stuff

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