comparison Makefile @ 32:13eae6cc6bac

* Add a function to look up the Vamp plugin path for the current platform. * Add make install stage and pkgconfig files. (This bit is rather Linux-specific.)
author cannam
date Mon, 31 Jul 2006 16:12:37 +0000
parents 1eb44d33a371
children 909fe32e2c3c
comparison
equal deleted inserted replaced
31:0e7aa8fabd76 32:13eae6cc6bac
9 HOSTDIR = host 9 HOSTDIR = host
10 10
11 11
12 ### Start of user-serviceable parts 12 ### Start of user-serviceable parts
13 13
14 # Locations for "make install". This will need quite a bit of
15 # editing for non-Linux platforms. Of course you don't necessarily
16 # have to use "make install".
17 #
18 INSTALL_PREFIX := /usr/local
19 INSTALL_API_HEADERS := $(INSTALL_PREFIX)/include/vamp/
20 INSTALL_SDK_HEADERS := $(INSTALL_PREFIX)/include/vamp-sdk/
21 INSTALL_SDK_LIBS := $(INSTALL_PREFIX)/lib/
22 INSTALL_SDK_LIBNAME := libvamp-sdk.so.0.9.5
23 INSTALL_SDK_LINK_ABI := libvamp-sdk.so.0
24 INSTALL_SDK_LINK_DEV := libvamp-sdk.so
25 INSTALL_PKGCONFIG := $(INSTALL_PREFIX)/lib/pkgconfig/
26
14 # Compile flags 27 # Compile flags
15 # 28 #
16 CXXFLAGS := $(CXXFLAGS) -g -Wall -I$(SDKDIR) -I$(APIDIR) -I. 29 CXXFLAGS := $(CXXFLAGS) -g -Wall -I$(SDKDIR) -I$(APIDIR) -I.
17 30
18 # Libraries required for the host at link time 31 # Libraries required for the host at link time
19 # 32 #
20 HOST_LIBS = -Lvamp-sdk -lvamp-sdk -lsndfile -ldl 33 HOST_LIBS = vamp-sdk/libvamp-sdk.a -lsndfile -ldl
21 34
22 # Libraries required for the plugin. Note that we can (and actively 35 # Libraries required for the plugin. Note that we can (and actively
23 # want to) statically link libstdc++, because our plugin exposes only 36 # want to) statically link libstdc++, because our plugin exposes only
24 # a C API so there are no boundary compatibility problems. 37 # a C API so there are no boundary compatibility problems.
25 # 38 #
26 PLUGIN_LIBS = -Lvamp-sdk -lvamp-sdk 39 PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a
27 #PLUGIN_LIBS = -Lvamp-sdk -lvamp-sdk $(shell g++ -print-file-name=libstdc++.a) 40 #PLUGIN_LIBS = vamp-sdk/libvamp-sdk.a $(shell g++ -print-file-name=libstdc++.a)
28 41
29 # Flags required to tell the compiler to link to a dynamically loadable object 42 # Flags required to tell the compiler to link to a dynamically loadable object
30 # 43 #
31 PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc 44 PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -static-libgcc
32 45
37 ## For OS/X with g++: 50 ## For OS/X with g++:
38 #PLUGIN_LDFLAGS = -dynamiclib 51 #PLUGIN_LDFLAGS = -dynamiclib
39 #PLUGIN_EXT = .dylib 52 #PLUGIN_EXT = .dylib
40 53
41 ### End of user-serviceable parts 54 ### End of user-serviceable parts
55
42 56
43 API_HEADERS = \ 57 API_HEADERS = \
44 $(APIDIR)/vamp.h 58 $(APIDIR)/vamp.h
45 59
46 SDK_HEADERS = \ 60 SDK_HEADERS = \
53 SDK_OBJECTS = \ 67 SDK_OBJECTS = \
54 $(SDKDIR)/PluginAdapter.o \ 68 $(SDKDIR)/PluginAdapter.o \
55 $(SDKDIR)/PluginHostAdapter.o \ 69 $(SDKDIR)/PluginHostAdapter.o \
56 $(SDKDIR)/RealTime.o 70 $(SDKDIR)/RealTime.o
57 71
58 SDK_TARGET = \ 72 SDK_STATIC = \
59 $(SDKDIR)/libvamp-sdk.a 73 $(SDKDIR)/libvamp-sdk.a
74
75 SDK_DYNAMIC = \
76 $(SDKDIR)/libvamp-sdk.so
60 77
61 PLUGIN_HEADERS = \ 78 PLUGIN_HEADERS = \
62 $(EXAMPLEDIR)/SpectralCentroid.h \ 79 $(EXAMPLEDIR)/SpectralCentroid.h \
63 $(EXAMPLEDIR)/ZeroCrossing.h 80 $(EXAMPLEDIR)/ZeroCrossing.h
64 81
77 $(HOSTDIR)/vamp-simple-host.o 94 $(HOSTDIR)/vamp-simple-host.o
78 95
79 HOST_TARGET = \ 96 HOST_TARGET = \
80 $(HOSTDIR)/vamp-simple-host 97 $(HOSTDIR)/vamp-simple-host
81 98
82 all: $(SDK_TARGET) $(PLUGIN_TARGET) $(HOST_TARGET) test 99 all: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) test
83 100
84 $(SDK_TARGET): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS) 101 $(SDK_STATIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
85 $(AR) r $@ $(SDK_OBJECTS) 102 $(AR) r $@ $(SDK_OBJECTS)
103
104 $(SDK_DYNAMIC): $(SDK_OBJECTS) $(API_HEADERS) $(SDK_HEADERS)
105 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(SDK_OBJECTS)
86 106
87 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS) 107 $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(SDK_TARGET) $(PLUGIN_HEADERS)
88 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS) 108 $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
89 109
90 $(HOST_TARGET): $(HOST_OBJECTS) $(SDK_TARGET) $(HOST_HEADERS) 110 $(HOST_TARGET): $(HOST_OBJECTS) $(SDK_TARGET) $(HOST_HEADERS)
94 $(HOST_TARGET) $(PLUGIN_TARGET) 114 $(HOST_TARGET) $(PLUGIN_TARGET)
95 115
96 clean: 116 clean:
97 rm -f $(SDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS) 117 rm -f $(SDK_OBJECTS) $(PLUGIN_OBJECTS) $(HOST_OBJECTS)
98 118
119 install: $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET)
120 mkdir -p $(INSTALL_API_HEADERS)
121 mkdir -p $(INSTALL_SDK_HEADERS)
122 mkdir -p $(INSTALL_SDK_LIBS)
123 mkdir -p $(INSTALL_PKGCONFIG)
124 cp $(API_HEADERS) $(INSTALL_API_HEADERS)
125 cp $(SDK_HEADERS) $(INSTALL_SDK_HEADERS)
126 cp $(SDK_STATIC) $(INSTALL_SDK_LIBS)
127 cp $(SDK_DYNAMIC) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LIBNAME)
128 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
129 ln -s $(INSTALL_SDK_LIBNAME) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_ABI)
130 rm -f $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
131 ln -s $(INSTALL_SDK_LINK_ABI) $(INSTALL_SDK_LIBS)/$(INSTALL_SDK_LINK_DEV)
132 sed "s,%PREFIX%,$(INSTALL_PREFIX)," vamp/vamp.pc.in > $(INSTALL_PKGCONFIG)/vamp.pc
133 sed "s,%PREFIX%,$(INSTALL_PREFIX)," vamp-sdk/vamp-sdk.pc.in > $(INSTALL_PKGCONFIG)/vamp-sdk.pc
134
99 distclean: clean 135 distclean: clean
100 rm -f $(SDK_TARGET) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~ 136 rm -f $(SDK_STATIC) $(SDK_DYNAMIC) $(PLUGIN_TARGET) $(HOST_TARGET) *~ */*~
101 137
102 138