annotate Makefile @ 36:6891b25dca1a

* avoid compiler warning
author cannam
date Wed, 20 Sep 2006 14:00:09 +0000
parents 154f86cb8c99
children 31cd55174467
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@20 86 $(EXAMPLEDIR)/ZeroCrossing.h
cannam@20 87
cannam@10 88 PLUGIN_OBJECTS = \
cannam@20 89 $(EXAMPLEDIR)/SpectralCentroid.o \
cannam@35 90 $(EXAMPLEDIR)/PercussionOnsetDetector.o \
cannam@10 91 $(EXAMPLEDIR)/ZeroCrossing.o \
cannam@10 92 $(EXAMPLEDIR)/plugins.o
cannam@10 93
cannam@10 94 PLUGIN_TARGET = \
cannam@21 95 $(EXAMPLEDIR)/vamp-example-plugins$(PLUGIN_EXT)
cannam@10 96
cannam@20 97 HOST_HEADERS = \
cannam@20 98 $(HOSTDIR)/system.h
cannam@20 99
cannam@10 100 HOST_OBJECTS = \
cannam@22 101 $(HOSTDIR)/vamp-simple-host.o
cannam@10 102
cannam@10 103 HOST_TARGET = \
cannam@22 104 $(HOSTDIR)/vamp-simple-host
cannam@10 105
cannam@32 106 all: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) test
cannam@11 107
cannam@32 108 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@20 109 $(AR) r $@ $(SDK_OBJECTS)
cannam@10 110
cannam@32 111 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
cannam@32 112 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS)
cannam@32 113
cannam@20 114 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS)
cannam@20 115 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
cannam@10 116
cannam@20 117 $(HOST_TARGET): $(HOST_OBJECTS) $(SDK_TARGET) $(HOST_HEADERS)
cannam@20 118 $(CXX) $(LDFLAGS) $(HOST_LDFLAGS) -o $@ $(HOST_OBJECTS) $(HOST_LIBS)
cannam@10 119
cannam@10 120 test: $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 121 $(HOST_TARGET) $(PLUGIN_TARGET)
cannam@10 122
cannam@10 123 clean:
cannam@11 124 rm -f $(SDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
cannam@10 125
cannam@33 126 distclean: clean
cannam@33 127 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
cannam@33 128
cannam@32 129 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
cannam@32 130 mkdir -p $(INSTALL_API_HEADERS)
cannam@32 131 mkdir -p $(INSTALL_SDK_HEADERS)
cannam@32 132 mkdir -p $(INSTALL_SDK_LIBS)
cannam@32 133 mkdir -p $(INSTALL_PKGCONFIG)
cannam@32 134 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
cannam@32 135 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
cannam@32 136 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
cannam@32 137 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
cannam@32 138 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 139 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
cannam@32 140 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@35 141 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
cannam@33 142 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(APIDIR)/vamp.pc.in \
cannam@33 143 > $(INSTALL_PKGCONFIG)/vamp.pc
cannam@33 144 sed "s,%PREFIX%,$(INSTALL_PREFIX)," $(SDKDIR)/vamp-sdk.pc.in \
cannam@33 145 > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
cannam@33 146 sed -e "s,%LIBNAME%,$(INSTALL_SDK_LIBNAME),g" \
cannam@33 147 -e "s,%LINK_ABI%,$(INSTALL_SDK_LINK_ABI),g" \
cannam@33 148 -e "s,%LINK_DEV%,$(INSTALL_SDK_LINK_DEV),g" \
cannam@33 149 -e "s,%STATIC%,$(INSTALL_SDK_STATIC),g" \
cannam@34 150 -e "s,%LIBS%,$(INSTALL_SDK_LIBS),g" $(SDK_LA).in \
cannam@33 151 > $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LA)