comparison skeleton/Makefile.skeleton @ 312:2ad57dd004ba

* Make plugin objects depend on headers as well as source files * Note that we require GNU make * Use non-recursive variable assignments throughout
author Chris Cannam
date Wed, 09 Feb 2011 09:28:34 +0000
parents b923a3d9c3d5
children a1be2e4a5d22
comparison
equal deleted inserted replaced
311:e006db9a6489 312:2ad57dd004ba
1 1
2 ## Skeleton Makefile for Vamp plugin builds using command-line tools. 2 ## Skeleton Makefile for Vamp plugin builds using command-line tools.
3 ## This requires GNU make, which is what you get with OS/X, Linux, or
4 ## MinGW/Cygwin on Windows.
3 ## 5 ##
4 ## Rename this to Makefile, and edit as appropriate. 6 ## Rename this to Makefile, and edit as appropriate.
5 ## This Makefile WILL NOT WORK until you have edited it as described 7 ## This Makefile WILL NOT WORK until you have edited it as described
6 ## below -- the Makefile as supplied does nothing useful at all! 8 ## below -- the Makefile as supplied does nothing useful at all!
7 ## 9 ##
8 ## Various sets of options are provided, commented out -- just uncomment 10 ## Various sets of options are provided, commented out -- just uncomment
9 ## (remove the '#' characters for) the set that most closely resembles 11 ## (remove the '#' characters for) the set that most closely resembles
10 ## your own situation, and adjust to taste. Then run "make". 12 ## your own situation, and adjust to taste. Then run "gmake".
11 ## 13 ##
12 ## (For Windows builds using MS Visual Studio, start instead with the 14 ## (For Windows builds using MS Visual Studio, start instead with the
13 ## VampExamplePlugins project found in the build directory of the SDK.) 15 ## VampExamplePlugins project found in the build directory of the SDK.)
14 16
15 17
16 # Edit this to the base name of your plugin library 18 # Edit this to the base name of your plugin library
17 # 19 #
18 PLUGIN_LIBRARY_NAME = myplugins 20 PLUGIN_LIBRARY_NAME := myplugins
19 21
20 # Edit this to list one .o file for each .cpp file in your plugin project 22 # Edit this to list the .cpp or .c files in your plugin project
21 # 23 #
22 PLUGIN_CODE_OBJECTS = MyPlugin.o plugins.o 24 PLUGIN_SOURCES := MyPlugin.cpp plugins.cpp
25
26 # Edit this to list the .h files in your plugin project
27 #
28 PLUGIN_HEADERS := MyPlugin.h
23 29
24 # Edit this to the location of the Vamp plugin SDK, relative to your 30 # Edit this to the location of the Vamp plugin SDK, relative to your
25 # project directory 31 # project directory
26 # 32 #
27 VAMP_SDK_DIR = ../vamp-plugin-sdk 33 VAMP_SDK_DIR := ../vamp-plugin-sdk
28 34
29 35
30 ## Uncomment these for an OS/X universal binary (PPC and 32- and 36 ## Uncomment these for an OS/X universal binary (PPC and 32- and
31 ## 64-bit Intel) supporting 10.4 or newer (if you have the 10.4 SDK): 37 ## 64-bit Intel) supporting 10.4 or newer (if you have the 10.4 SDK):
32 38
33 # CXXFLAGS = -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC 39 # CXXFLAGS := -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC
34 # PLUGIN_EXT = .dylib 40 # PLUGIN_EXT := .dylib
35 # PLUGIN = $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) 41 # LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
36 # LDFLAGS = $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
37 42
38 43
39 ## Uncomment these for an OS/X universal binary (PPC and 32- and 44 ## Uncomment these for an OS/X universal binary (PPC and 32- and
40 ## 64-bit Intel) supporting 10.5 or newer (use this if you have the 45 ## 64-bit Intel) supporting 10.5 or newer (use this if you have the
41 ## default 10.6 developer tools): 46 ## default 10.6 developer tools):
42 47
43 # CXXFLAGS = -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC 48 # CXXFLAGS := -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -arch i386 -arch x86_64 -arch ppc -I$(VAMP_SDK_DIR) -Wall -fPIC
44 # PLUGIN_EXT = .dylib 49 # PLUGIN_EXT := .dylib
45 # PLUGIN = $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) 50 # LDFLAGS := $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
46 # LDFLAGS = $(CXXFLAGS) -dynamiclib -install_name $(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -exported_symbols_list vamp-plugin.list
47 51
48 52
49 ## Uncomment these for Linux using the standard tools: 53 ## Uncomment these for Linux using the standard tools:
50 54
51 # CXXFLAGS = -I$(VAMP_SDK_DIR) -Wall -fPIC 55 # CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall -fPIC
52 # PLUGIN_EXT = .so 56 # PLUGIN_EXT := .so
53 # PLUGIN = $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) 57 # LDFLAGS := -shared -Wl,-soname=$(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -Wl,--version-script=vamp-plugin.map
54 # LDFLAGS = -shared -Wl,-soname=$(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -Wl,--version-script=vamp-plugin.map
55 58
56 59
57 ## Uncomment these for a cross-compile from Linux to Windows using MinGW: 60 ## Uncomment these for a cross-compile from Linux to Windows using MinGW:
58 61
59 # CXX = i586-mingw32msvc-g++ 62 # CXX := i586-mingw32msvc-g++
60 # CXXFLAGS = -I$(VAMP_SDK_DIR) -Wall 63 # CXXFLAGS := -I$(VAMP_SDK_DIR) -Wall
61 # PLUGIN_EXT = .dll 64 # PLUGIN_EXT := .dll
62 # PLUGIN = $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) 65 # LDFLAGS := --static-libgcc -Wl,-soname=$(PLUGIN) -shared $(VAMP_SDK_DIR)/libvamp-sdk.a
63 # LDFLAGS = --static-libgcc -Wl,-soname=$(PLUGIN) -shared $(VAMP_SDK_DIR)/libvamp-sdk.a
64 66
65 67
66 ## Uncomment these for OpenSolaris using SunStudio compiler and GNU make: 68 ## Uncomment these for OpenSolaris using SunStudio compiler and GNU make:
67 69
68 # CXX = CC 70 # CXX := CC
69 # CXXFLAGS = -G -I$(VAMP_SDK_DIR) +w -KPIC 71 # CXXFLAGS := -G -I$(VAMP_SDK_DIR) +w -KPIC
70 # PLUGIN_EXT = .so 72 # PLUGIN_EXT := .so
71 # PLUGIN = $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT) 73 # LDFLAGS := -G -h$(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -Qoption ld -Mvamp-plugin.map
72 # LDFLAGS = -G -h$(PLUGIN) $(VAMP_SDK_DIR)/libvamp-sdk.a -Qoption ld -Mvamp-plugin.map
73 74
74 75
75 76
76 ## All of the above 77 ## All of the above
77 78
78 $(PLUGIN): $(PLUGIN_CODE_OBJECTS) 79 PLUGIN := $(PLUGIN_LIBRARY_NAME)$(PLUGIN_EXT)
80
81 PLUGIN_OBJECTS := $(PLUGIN_SOURCES:.cpp=.o)
82 PLUGIN_OBJECTS := $(PLUGIN_OBJECTS:.c=.o)
83
84 $(PLUGIN): $(PLUGIN_OBJECTS)
79 $(CXX) -o $@ $^ $(LDFLAGS) 85 $(CXX) -o $@ $^ $(LDFLAGS)
86
87 $(PLUGIN_OBJECTS): $(PLUGIN_HEADERS)
80 88
81 clean: 89 clean:
82 rm -f *.o 90 rm -f *.o
83 91