aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-08-19 17:34:24 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-08-19 17:34:24 +0000
commit15f97b47155ab542c9349ecde6795e88ed4a58e4 (patch)
tree4b13d53b0b69cc663ceab89c6ef9dd34a61bdd16
parent4e55c359730e61be2dc0763a3aeea2952650d3c3 (diff)
updated Makefile to latest template version to get things building on Debian/kFreeBSD and Debian/HURD
svn path=/trunk/externals/mjlib/; revision=15249
-rw-r--r--Makefile72
1 files changed, 65 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index e3cce7a..cdd7972 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-## Pd library template version 1.0.3
+## Pd library template version 1.0.10
# For instructions on how to use this template, see:
# http://puredata.info/docs/developer/MakefileTemplate
LIBRARY_NAME = mjlib
@@ -25,14 +25,14 @@ EXTRA_DIST = VERSION mjLib.c mjLib.h StdAfx.h about.h convolve~.h metroplus.h mo
-
#------------------------------------------------------------------------------#
#
# things you might need to edit if you are using other C libraries
#
#------------------------------------------------------------------------------#
-CFLAGS = -DPD -I"$(PD_INCLUDE)" -Wall -W -g
+# -I"$(PD_INCLUDE)/pd" supports the header location for 0.43
+CFLAGS = -I"$(PD_INCLUDE)/pd" -Wall -W -g
LDFLAGS =
LIBS =
@@ -45,7 +45,7 @@ LIBS =
# get library version from meta file
LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
-CFLAGS += -DVERSION='"$(LIBRARY_VERSION)"'
+CFLAGS += -DPD -DVERSION='"$(LIBRARY_VERSION)"'
PD_INCLUDE = $(PD_PATH)/include
# where to install the library, overridden below depending on platform
@@ -63,7 +63,7 @@ ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx)
$(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows)
DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
-ORIGDIR=pd-$(LIBRARY_NAME)_$(LIBRARY_VERSION)
+ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
@@ -109,6 +109,28 @@ ifeq ($(UNAME),Darwin)
pkglibdir=$(HOME)/Library/Pd
endif
endif
+# Tho Android uses Linux, we use this fake uname to provide an easy way to
+# setup all this things needed to cross-compile for Android using the NDK
+ifeq ($(UNAME),ANDROID)
+ CPU := arm
+ SOURCES += $(SOURCES_android)
+ EXTENSION = pd_linux
+ OS = android
+ PD_PATH = /usr
+ NDK_BASE := /usr/local/android-ndk
+ NDK_PLATFORM_VERSION := 5
+ NDK_SYSROOT=$(NDK_BASE)/platforms/android-$(NDK_PLATFORM_VERSION)/arch-arm
+ NDK_UNAME := $(shell uname -s | tr '[A-Z]' '[a-z]')
+ NDK_TOOLCHAIN_BASE=$(NDK_BASE)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(NDK_UNAME)-x86
+ CC := $(NDK_TOOLCHAIN_BASE)/bin/arm-linux-androideabi-gcc --sysroot=$(NDK_SYSROOT)
+ OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+ CFLAGS +=
+ LDFLAGS += -Wl,--export-dynamic -shared
+ LIBS += -lc
+ STRIP := $(NDK_TOOLCHAIN_BASE)/bin/arm-linux-androideabi-strip \
+ --strip-unneeded -R .note -R .comment
+ DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
+endif
ifeq ($(UNAME),Linux)
CPU := $(shell uname -m)
SOURCES += $(SOURCES_linux)
@@ -122,12 +144,40 @@ ifeq ($(UNAME),Linux)
STRIP = strip --strip-unneeded -R .note -R .comment
DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
endif
+ifeq ($(UNAME),GNU)
+ # GNU/Hurd, should work like GNU/Linux for basically all externals
+ CPU := $(shell uname -m)
+ SOURCES += $(SOURCES_linux)
+ EXTENSION = pd_linux
+ OS = linux
+ PD_PATH = /usr
+ OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+ CFLAGS += -fPIC
+ LDFLAGS += -Wl,--export-dynamic -shared -fPIC
+ LIBS += -lc
+ STRIP = strip --strip-unneeded -R .note -R .comment
+ DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
+endif
+ifeq ($(UNAME),GNU/kFreeBSD)
+ # Debian GNU/kFreeBSD, should work like GNU/Linux for basically all externals
+ CPU := $(shell uname -m)
+ SOURCES += $(SOURCES_linux)
+ EXTENSION = pd_linux
+ OS = linux
+ PD_PATH = /usr
+ OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+ CFLAGS += -fPIC
+ LDFLAGS += -Wl,--export-dynamic -shared -fPIC
+ LIBS += -lc
+ STRIP = strip --strip-unneeded -R .note -R .comment
+ DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
+endif
ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
CPU := $(shell uname -m)
SOURCES += $(SOURCES_cygwin)
EXTENSION = dll
OS = cygwin
- PD_PATH = $(cygpath $(PROGRAMFILES))/pd
+ PD_PATH = $(shell cygpath $$PROGRAMFILES)/pd
OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
CFLAGS +=
LDFLAGS += -Wl,--export-dynamic -shared -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin"
@@ -140,7 +190,9 @@ ifeq (MINGW,$(findstring MINGW,$(UNAME)))
SOURCES += $(SOURCES_windows)
EXTENSION = dll
OS = windows
- PD_PATH = $(shell cd "$(PROGRAMFILES)"/pd && pwd)
+ PD_PATH = $(shell cd "$$PROGRAMFILES/pd" && pwd)
+ # MinGW doesn't seem to include cc so force gcc
+ CC=gcc
OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer
CFLAGS += -mms-bitfields
LDFLAGS += -s -shared -Wl,--enable-auto-import
@@ -182,6 +234,9 @@ libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install
test -z "$(strip $(SOURCES))" || (\
$(INSTALL_PROGRAM) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \
$(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION))))
+ test -z "$(strip $(shell ls $(SOURCES:.c=.tcl)))" || \
+ $(INSTALL_DATA) $(shell ls $(SOURCES:.c=.tcl)) \
+ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
test -z "$(strip $(PDOBJECTS))" || \
$(INSTALL_DATA) $(PDOBJECTS) \
$(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
@@ -254,6 +309,8 @@ dist: $(DISTDIR)
$(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTDIR)
test -z "$(strip $(ALLSOURCES))" || \
$(INSTALL_DATA) $(ALLSOURCES) $(DISTDIR)
+ test -z "$(strip $(shell ls $(ALLSOURCES:.c=.tcl)))" || \
+ $(INSTALL_DATA) $(shell ls $(ALLSOURCES:.c=.tcl)) $(DISTDIR)
test -z "$(strip $(PDOBJECTS))" || \
$(INSTALL_DATA) $(PDOBJECTS) $(DISTDIR)
test -z "$(strip $(HELPPATCHES))" || \
@@ -286,6 +343,7 @@ etags:
etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h
showsetup:
+ @echo "CC: $(CC)"
@echo "CFLAGS: $(CFLAGS)"
@echo "LDFLAGS: $(LDFLAGS)"
@echo "LIBS: $(LIBS)"