aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-02-08 17:43:02 +0000
committerIOhannes m zmölnig <zmoelnig@iem.at>2015-10-14 13:53:22 +0200
commita6c1a0bbb5c6aeea55a73fcd977c8c7c9e80e02c (patch)
tree861a84af38dfa38677a827378e4fde05c8bd0e3b /Makefile
parent3985f790deaab15905959e70d2f2288cb57f4733 (diff)
updated Makefile to get Android support
svn path=/trunk/externals/maxlib/; revision=14874
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile62
1 files changed, 57 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 793bf3d..9a76c68 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-## Pd library template version 1.0.3
+## Pd library template version 1.0.8
# For instructions on how to use this template, see:
# http://puredata.info/docs/developer/MakefileTemplate
LIBRARY_NAME = maxlib
@@ -25,13 +25,15 @@ EXTRA_DIST = HISTORY automata.txt examplescore.txt maxlib-help.pd maxlib.c maxli
# NOTE: added -lpthreadGC2 to MinGW LIBS
+
#------------------------------------------------------------------------------#
#
# things you might need to edit if you are using other C libraries
#
#------------------------------------------------------------------------------#
-CFLAGS = -DPD -I"$(PD_INCLUDE)/pd" -Wall -W -g
+# -I"$(PD_INCLUDE)/pd" supports the header location for 0.43
+CFLAGS = -I"$(PD_INCLUDE)/pd" -Wall -W -g
LDFLAGS =
LIBS =
@@ -44,7 +46,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
@@ -62,7 +64,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)
@@ -108,6 +110,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=$(NDK_BASE)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$(NDK_UNAME)-x86
+ CC := $(NDK_TOOLCHAIN)/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)/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)
@@ -121,6 +145,34 @@ 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)
@@ -143,7 +195,7 @@ ifeq (MINGW,$(findstring MINGW,$(UNAME)))
OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer
CFLAGS += -mms-bitfields
LDFLAGS += -s -shared -Wl,--enable-auto-import
- LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 -lpthreadGC2
+ LIBS += -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" -L"$(PD_PATH)/obj" -lpd -lwsock32 -lkernel32 -luser32 -lgdi32 -lpthreadGC2
STRIP = strip --strip-unneeded -R .note -R .comment
DISTBINDIR=$(DISTDIR)-$(OS)
endif