aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-07-29 15:31:27 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-07-29 15:31:27 +0000
commit40c012ec96b22dcfcecd87a157f71c60cf41fe1c (patch)
tree630a886397722070711f7ec0be34ffa164f93160
parentc50fd3fb4e20097d57c33c04441a969392ba5d4d (diff)
ported new template Makefile changes to motex
svn path=/trunk/externals/motex/; revision=11887
-rw-r--r--Makefile75
1 files changed, 52 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 0564c1e..c88bca5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,22 @@
-# to use this Makefile for your project, you should only need to add your
-# source files to the SOURCES variable. For objects that only build on
-# certain platforms, add those to the SOURCES line for the right platforms.
+# To use this Makefile for your project, first put the name of your library in
+# LIBRARY_NAME variable. The folder for your project should have the same name
+# as your library.
+LIBRARY_NAME = motex
+# Next, add your source files to the SOURCES variable.
SOURCES = getenv.c ln~.c pansig~.c pan~.c pol2rec~.c polygate~.c rec2pol~.c shuffle.c system.c
-LIBRARY_NAME := $(shell basename `pwd`)
+# For objects that only build on certain platforms, add those to the SOURCES
+# line for the right platforms.
+SOURCES_Darwin =
+SOURCES_Linux =
+SOURCES_Windows =
+
+#------------------------------------------------------------------------------#
+#
+# you shouldn't need to edit anything below here, if we did it right :)
+#
+#------------------------------------------------------------------------------#
pd_src = ../../pd
objectsdir = $(pd_src)/extra
@@ -15,7 +27,7 @@ LIBS =
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
- SOURCES +=
+ SOURCES += $(SOURCES_Darwin)
EXTENSION = pd_darwin
OS = macosx
OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
@@ -26,7 +38,7 @@ ifeq ($(UNAME),Darwin)
STRIP = strip -x
endif
ifeq ($(UNAME),Linux)
- SOURCES +=
+ SOURCES += $(SOURCES_Linux)
EXTENSION = pd_linux
OS = linux
OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
@@ -36,11 +48,12 @@ ifeq ($(UNAME),Linux)
STRIP = strip --strip-unneeded -R .note -R .comment
endif
ifeq (MINGW,$(findstring MINGW,$(UNAME)))
- SOURCES +=
+ SOURCES += $(SOURCES_Windows)
EXTENSION = dll
OS = windows
OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
- CFLAGS += -mms-bitfields
+ WINDOWS_HACKS = -D'O_NONBLOCK=1'
+ CFLAGS += -mms-bitfields $(WINDOWS_HACKS)
LDFLAGS += -s -shared -Wl,--enable-auto-import
LIBS += -L$(pd_src)/bin -L$(pd_src)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
STRIP = strip --strip-unneeded -R .note -R .comment
@@ -59,15 +72,12 @@ all: $(SOURCES:.c=.$(EXTENSION))
%.$(EXTENSION): %.o
$(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
chmod a-x "$*.$(EXTENSION)"
- $(STRIP) $*.$(EXTENSION)
rm -f -- $*.o
# this links everything into a single binary file
$(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o
$(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS)
chmod a-x $(LIBRARY_NAME).$(EXTENSION)
- $(STRIP) $(LIBRARY_NAME).$(EXTENSION)
- rm -f -- $*.o
install: libdir_install
@@ -75,25 +85,27 @@ install: libdir_install
# The meta and help files are explicitly installed to make sure they are
# actually there. Those files are not optional, then need to be there.
libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-exec
- install -d $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p $(LIBRARY_NAME)-meta.pd $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p $(SOURCES:.c=.$(EXTENSION)) $(objectsdir)/$(LIBRARY_NAME)
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(LIBRARY_NAME)-meta.pd $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION)))
# install library linked as single binary
single_install: $(LIBRARY_NAME) install-doc install-exec
- install -d $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p $(LIBRARY_NAME).$(EXTENSION) $(objectsdir)/$(LIBRARY_NAME)
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
install-doc:
- install -d $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p $(SOURCES:.c=-help.pd) $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p $(wildcard *.pd) $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p README $(objectsdir)/$(LIBRARY_NAME)/README.txt
- install -m644 -p LICENCE $(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt
+ install -d $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(SOURCES:.c=-help.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(wildcard *.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p README $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
+ install -m644 -p LICENCE $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt
install-exec:
install -d $(objectsdir)/$(LIBRARY_NAME)
- install -m644 -p $(wildcard *.pd) $(objectsdir)/$(LIBRARY_NAME)
+ install -m644 -p $(wildcard *.pd) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
clean:
@@ -101,10 +113,27 @@ clean:
-rm -f -- $(SOURCES:.c=.$(EXTENSION))
-rm -f -- $(LIBRARY_NAME).$(EXTENSION)
+distclean: clean
+ -rm -f -- ../$(LIBRARY_NAME)-$(OS)-$(shell uname -m).tar.bz2
+ -rm -f -- ../$(LIBRARY_NAME)-$(OS).tar.bz2
-dist:
+dist: all dist_$(OS)
+
+dist_linux:
+ cd .. && tar --exclude=.svn -cjpf $(LIBRARY_NAME)-$(OS)-$(shell uname -m).tar.bz2 $(LIBRARY_NAME)
+
+dist_macosx:
+ cd .. && tar --exclude=.svn -cjpf $(LIBRARY_NAME)-$(OS).tar.bz2 $(LIBRARY_NAME)
+
+dist_windows:
cd .. && tar --exclude=.svn -cjpf $(LIBRARY_NAME)-$(OS).tar.bz2 $(LIBRARY_NAME)
etags:
etags *.[ch] ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h
+
+showpaths:
+ @echo "pd_src: $(pd_src)"
+ @echo "objectsdir: $(objectsdir)"
+ @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
+ @echo "SOURCES: $(SOURCES)"