Makefile: splitted for osx/linux/mingw32
authorPaul Brossier <piem@piem.org>
Wed, 28 Jan 2015 14:31:09 +0000 (15:31 +0100)
committerPaul Brossier <piem@piem.org>
Wed, 28 Jan 2015 14:31:09 +0000 (15:31 +0100)
Makefile [deleted file]
Makefile.inc [new file with mode: 0644]
Makefile.linux [new file with mode: 0644]
Makefile.mingw32 [new file with mode: 0644]
Makefile.osx [new file with mode: 0644]

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 5b36a09..0000000
--- a/Makefile
+++ /dev/null
@@ -1,46 +0,0 @@
-
-# Location of our plugins
-#
-PLUGINDIR      = plugins
-
-# Compile flags
-#
-CFLAGS         := -fPIC -DDEBUG -O2 -Wall $(CFLAGS)
-CXXFLAGS       := $(CFLAGS)
-LDFLAGS        := -laubio $(LDFLAGS)
-
-# Libraries required for the plugins.
-#
-PLUGIN_LIBS    = -Wl,-Bstatic -lvamp-sdk -Wl,-Bdynamic
-
-# Flags required to tell the compiler to make a dynamically loadable object
-#
-PLUGIN_LDFLAGS = -shared -Wl,-Bsymbolic -Wl,--version-script=vamp-plugin.map
-
-# File extension for a dynamically loadable object
-#
-PLUGIN_EXT     = .so
-
-## For OS/X with g++:
-#PLUGIN_LDFLAGS        = -dynamiclib -exported_symbols_list=vamp-plugin.list
-#PLUGIN_EXT    = .dylib
-
-
-### End of user-serviceable parts
-
-PLUGIN_OBJECTS = libmain.o $(patsubst %.cpp,%.o,$(wildcard $(PLUGINDIR)/*.cpp))
-PLUGIN_HEADERS = $(patsubst %.cpp,%.h,$(wildcard $(PLUGINDIR)/*.cpp))
-PLUGIN_TARGET  = vamp-aubio$(PLUGIN_EXT)
-
-all:           $(PLUGIN_TARGET)
-
-$(PLUGIN_TARGET):      $(PLUGIN_OBJECTS) $(PLUGIN_HEADERS)
-               $(CXX) $(LDFLAGS) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
-
-clean:         
-               rm -f $(PLUGIN_OBJECTS)
-
-distclean:     clean
-               rm -f $(PLUGIN_TARGET) *~ */*~
-
-
diff --git a/Makefile.inc b/Makefile.inc
new file mode 100644 (file)
index 0000000..8dbc8b8
--- /dev/null
@@ -0,0 +1,44 @@
+# Makefile for vamp-aubio. This file gets included from platform specific makefiles.
+#
+# To build on OSX, use:
+#
+#   $ make -f Makefile.osx
+#
+# To build on linux, use:
+#
+#   $ make -f Makefile.linux
+#
+# To build with mingw32, use:
+#
+#   $ make -f Makefile.mingw
+
+CFLAGS         := $(ARCHFLAGS) $(CFLAGS)
+CXXFLAGS       := $(CFLAGS) -I. -I$(VAMPSDK_DIR) $(CXXFLAGS)
+
+LDFLAGS                := $(ARCHFLAGS) -L$(VAMPSDK_DIR) -laubio $(LDFLAGS)
+PLUGIN_LDFLAGS := $(LDFLAGS) $(PLUGIN_LDFLAGS)
+
+# Defaults, overridden from the platform-specific Makefile
+VAMPSDK_DIR    ?= ../vamp-plugin-sdk
+PLUGIN_EXT     ?= .so
+CXX            ?= g++
+CC             ?= gcc
+
+# Location of our plugins
+#
+PLUGINDIR      = plugins
+
+PLUGIN_OBJECTS = libmain.o $(patsubst %.cpp,%.o,$(wildcard $(PLUGINDIR)/*.cpp))
+PLUGIN_HEADERS = $(patsubst %.cpp,%.h,$(wildcard $(PLUGINDIR)/*.cpp))
+PLUGIN_TARGET  = vamp-aubio$(PLUGIN_EXT)
+
+all:           $(PLUGIN_TARGET)
+
+$(PLUGIN_TARGET):      $(PLUGIN_OBJECTS) $(PLUGIN_HEADERS)
+               $(CXX) $(PLUGIN_LDFLAGS) -o $@ $(PLUGIN_OBJECTS) $(PLUGIN_LIBS)
+
+clean:
+               rm -f $(PLUGIN_OBJECTS)
+
+distclean:     clean
+               rm -f $(PLUGIN_TARGET) *~ */*~
diff --git a/Makefile.linux b/Makefile.linux
new file mode 100644 (file)
index 0000000..e1fd4f7
--- /dev/null
@@ -0,0 +1,25 @@
+##  Makefile for Vamp aubio plugin using GNU tools on Linux.
+##
+##  Edit this to adjust compiler and library settings when
+##  building for Linux.
+##
+##  Note that the list of source files, etc, goes in Makefile.inc
+##  instead so that it can be included by all platform Makefiles.
+
+# For a debug build...
+#CFLAGS                := -Wall -Wextra -g -fPIC
+
+# ... or for a release build
+CFLAGS         := -Wall -Wextra -O3 -msse -msse2 -mfpmath=sse -ftree-vectorize -fPIC
+
+# Location of Vamp plugin SDK relative to the project directory
+VAMPSDK_DIR    := ../vamp-plugin-sdk
+
+# Libraries and linker flags required by plugin: add any -l<library>
+# options here
+PLUGIN_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,-z,defs -Wl,--version-script=vamp-plugin.map $(VAMPSDK_DIR)/libvamp-sdk.a
+
+# File extension for plugin library on this platform
+PLUGIN_EXT     := .so
+
+include Makefile.inc
diff --git a/Makefile.mingw32 b/Makefile.mingw32
new file mode 100644 (file)
index 0000000..e7405b7
--- /dev/null
@@ -0,0 +1,33 @@
+##  Makefile for Vamp aubio plugin using MinGW tools on Windows.
+##
+##  Edit this to adjust compiler and library settings when
+##  building using MinGW.
+##
+##  Note that the list of source files, etc, goes in Makefile.inc
+##  instead so that it can be included by all platform Makefiles.
+
+TOOLPREFIX     ?=
+CXX            = $(TOOLPREFIX)g++
+CC             = $(TOOLPREFIX)gcc
+LD             = $(TOOLPREFIX)g++
+AR             = $(TOOLPREFIX)ar
+RANLIB         = $(TOOLPREFIX)ranlib
+
+# For a debug build...
+#CFLAGS                := -Wall -Wextra -g
+
+# ... or for a release build
+CFLAGS         := -Wall -Wextra -O3 -ftree-vectorize
+
+# Location of Vamp plugin SDK relative to the project directory
+VAMPSDK_DIR    := ../vamp-plugin-sdk
+
+# Libraries and linker flags required by plugin: add any -l<library>
+# options here
+PLUGIN_LDFLAGS := -shared -static -Wl,--retain-symbols-file=vamp-plugin.list $(VAMPSDK_DIR)/libvamp-sdk.a
+
+
+# File extension for plugin library on this platform
+PLUGIN_EXT     := .dll
+
+include Makefile.inc
diff --git a/Makefile.osx b/Makefile.osx
new file mode 100644 (file)
index 0000000..9450b9d
--- /dev/null
@@ -0,0 +1,28 @@
+##  Makefile for Vamp aubio plugin using command-line tools on OS/X.
+##
+##  Edit this to adjust compiler and library settings when
+##  building for OS/X.
+##
+##  Note that the list of source files, etc, goes in Makefile.inc
+##  instead so that it can be included by all platform Makefiles.
+
+# For a debug build...
+#CFLAGS                := -Wall -Wextra -g -fPIC
+
+# ... or for a release build
+CFLAGS         := -Wall -Wextra -O3 -ftree-vectorize -fPIC
+
+# Flags to determine processor architecture and system SDK
+ARCHFLAGS      ?= -mmacosx-version-min=10.6 -arch x86_64
+
+# Location of Vamp plugin SDK relative to the project directory
+VAMPSDK_DIR    := ../vamp-plugin-sdk
+
+# Libraries and linker flags required by plugin: add any -l<library>
+# options here
+PLUGIN_LDFLAGS := -dynamiclib -exported_symbols_list vamp-plugin.list -lvamp-sdk
+
+# File extension for plugin library on this platform
+PLUGIN_EXT     := .dylib
+
+include Makefile.inc