annotate Makefile @ 44:ce61ad9b9159 1.0

...
author cannam
date Wed, 01 Nov 2006 17:48:21 +0000
parents 31cd55174467
children 2858c897d90f
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@33 19 INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp
cannam@33 20 INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk
cannam@33 21 INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib
cannam@33 22 INSTALL_SDK_LIBNAME := libvamp-sdk.so.0.0.5
cannam@32 23 INSTALL_SDK_LINK_ABI := libvamp-sdk.so.0
cannam@32 24 INSTALL_SDK_LINK_DEV := libvamp-sdk.so
cannam@33 25 INSTALL_SDK_STATIC := libvamp-sdk.a
cannam@33 26 INSTALL_SDK_LA := libvamp-sdk.la
cannam@33 27 INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig
cannam@32 28
cannam@10 29 # Compile flags
cannam@11 30 #
cannam@33 31 CXXFLAGS := $(CXXFLAGS) -O2 -Wall -I$(SDKDIR) -I$(APIDIR) -I.
cannam@1 32
cannam@10 33 # Libraries required for the host at link time
cannam@11 34 #
cannam@32 35 HOST_LIBS = vamp-sdk/libvamp-sdk.a -lsndfile -ldl
cannam@0 36
cannam@10 37 # Libraries required for the plugin. Note that we can (and actively
cannam@18 38 # want to) statically link libstdc++, because our plugin exposes only
cannam@10 39 # a C API so there are no boundary compatibility problems.
cannam@11 40 #
cannam@32 41 PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a
cannam@32 42 #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a)
cannam@0 43
cannam@10 44 # Flags required to tell the compiler to link to a dynamically loadable object
cannam@11 45 #
cannam@10 46 PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc
cannam@10 47
cannam@10 48 # File extension for a dynamically loadable object
cannam@11 49 #
cannam@10 50 PLUGIN_EXT = .so
cannam@10 51
cannam@10 52 ## For OS/X with g++:
cannam@10 53 #PLUGIN_LDFLAGS = -dynamiclib
cannam@10 54 #PLUGIN_EXT = .dylib
cannam@10 55
cannam@10 56 ### End of user-serviceable parts
cannam@10 57
cannam@32 58
cannam@20 59 API_HEADERS = \
cannam@20 60 $(APIDIR)/vamp.h
cannam@20 61
cannam@20 62 SDK_HEADERS = \
cannam@20 63 $(SDKDIR)/Plugin.h \
cannam@20 64 $(SDKDIR)/PluginAdapter.h \
cannam@20 65 $(SDKDIR)/PluginBase.h \
cannam@20 66 $(SDKDIR)/PluginHostAdapter.h \
cannam@20 67 $(SDKDIR)/RealTime.h
cannam@20 68
cannam@11 69 SDK_OBJECTS = \
cannam@11 70 $(SDKDIR)/PluginAdapter.o \
cannam@11 71 $(SDKDIR)/PluginHostAdapter.o \
cannam@11 72 $(SDKDIR)/RealTime.o
cannam@11 73
cannam@32 74 SDK_STATIC = \
cannam@11 75 $(SDKDIR)/libvamp-sdk.a
cannam@10 76
cannam@32 77 SDK_DYNAMIC = \
cannam@32 78 $(SDKDIR)/libvamp-sdk.so
cannam@32 79
cannam@33 80 SDK_LA = \
cannam@33 81 $(SDKDIR)/libvamp-sdk.la
cannam@33 82
cannam@20 83 PLUGIN_HEADERS = \
cannam@20 84 $(EXAMPLEDIR)/SpectralCentroid.h \
cannam@35 85 $(EXAMPLEDIR)/PercussionOnsetDetector.h \
cannam@41 86 $(EXAMPLEDIR)/AmplitudeFollower.h \
cannam@20 87 $(EXAMPLEDIR)/ZeroCrossing.h
cannam@20 88
cannam@10 89 PLUGIN_OBJECTS = \
cannam@20 90 $(EXAMPLEDIR)/SpectralCentroid.o \
cannam@35 91 $(EXAMPLEDIR)/PercussionOnsetDetector.o \
cannam@41 92 $(EXAMPLEDIR)/AmplitudeFollower.o \
cannam@10 93 $(EXAMPLEDIR)/ZeroCrossing.o \
cannam@10 94 $(EXAMPLEDIR)/plugins.o
cannam@10 95
cannam@10 96 PLUGIN_TARGET = \
cannam@21 97 $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT)
cannam@10 98
cannam@20 99 HOST_HEADERS = \
cannam@20 100 $(HOSTDIR)/system.h
cannam@20 101
cannam@10 102 HOST_OBJECTS = \
cannam@22 103 $(HOSTDIR)/vamp-simple-host.o
cannam@10 104
cannam@10 105 HOST_TARGET = \
cannam@22 106 $(HOSTDIR)/vamp-simple-host
cannam@10 107
cannam@32 108 all: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) test
cannam@11 109
cannam@32 110 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@20 111 $(AR) r $@ $(SDK_OBJECTS)
cannam@10 112
cannam@32 113 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@32 114 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS)
cannam@32 115
cannam@20 116 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS)
cannam@20 117 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
cannam@10 118
cannam@20 119 $(HOST_TARGET): $(HOST_OBJECTS) $(SDK_TARGET) $(HOST_HEADERS)
cannam@20 120 $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS)
cannam@10 121
cannam@10 122 test: $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 123 $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 124
cannam@10 125 clean:
cannam@11 126 rm -f $(SDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
cannam@10 127
cannam@33 128 distclean: clean
cannam@33 129 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
cannam@33 130
cannam@32 131 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
cannam@32 132 mkdir -p $(INSTALL_API_HEADERS)
cannam@32 133 mkdir -p $(INSTALL_SDK_HEADERS)
cannam@32 134 mkdir -p $(INSTALL_SDK_LIBS)
cannam@32 135 mkdir -p $(INSTALL_PKGCONFIG)
cannam@32 136 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
cannam@32 137 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@32 138 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@32 139 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
cannam@32 140 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 141 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 142 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@35 143 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@33 144 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \
cannam@33 145 > $(INSTALL_PKGCONFIG)/vamp.pc
cannam@33 146 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \
cannam@33 147 > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
cannam@33 148 sed -e "s,%LIBNAME%,$(INSTALL_SDK_LIBNAME),g" \
cannam@33 149 -e "s,%LINK_ABI%,$(INSTALL_SDK_LINK_ABI),g" \
cannam@33 150 -e "s,%LINK_DEV%,$(INSTALL_SDK_LINK_DEV),g" \
cannam@33 151 -e "s,%STATIC%,$(INSTALL_SDK_STATIC),g" \
cannam@34 152 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
cannam@33 153 > $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LA)