From 503a3dd6d7a76883b018f7ff54ae04bbfe37737e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 23 Aug 2010 21:31:13 +0000 Subject: added abstractions and updated Makefile to version 1.0.2 svn path=/trunk/externals/apple/; revision=13899 --- Makefile | 80 ++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 43652c9..2c242c7 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,20 @@ -## Pd library template version 1.0 +## Pd library template version 1.0.2 # For instructions on how to use this template, see: # http://puredata.info/docs/developer/MakefileTemplate LIBRARY_NAME = apple -# add your .c source files to the SOURCES variable, help files will be -# included automatically +# add your .c source files, one object per file, to the SOURCES +# variable, help files will be included automatically SOURCES = # For objects that only build on certain platforms, add those to the SOURCES # line for the right platforms. -SOURCES_android = -SOURCES_cygwin = SOURCES_macosx = ambient_light_sensor.c iodisplay.c keyboard_light.c sudden_motion_sensor.c smc.c SOURCES_iphoneos = multitouch.c -SOURCES_linux = -SOURCES_windows = # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will # be included automatically -PDOBJECTS = +PDOBJECTS = brightness.pd cpu_temperature.pd fans.pd # example patches and related files, in the 'examples' subfolder EXAMPLES = @@ -27,13 +23,23 @@ EXAMPLES = MANUAL = # if you want to include any other files in the source and binary tarballs, -# list them here. This can be anything from header files, example patches, +# list them here. This can be anything from header files, test patches, # documentation, etc. README.txt and LICENSE.txt are required and therefore # automatically included -EXTRA_DIST = +EXTRA_DIST = MultitouchSupport.h +#------------------------------------------------------------------------------# +# +# things you might need to edit if you are using other C libraries +# +#------------------------------------------------------------------------------# + +CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g +LDFLAGS = +LIBS = + #------------------------------------------------------------------------------# # # you shouldn't need to edit anything below here, if we did it right :) @@ -51,17 +57,16 @@ libdir = $(prefix)/lib pkglibdir = $(libdir)/pd-externals objectsdir = $(pkglibdir) - INSTALL = install INSTALL_FILE = $(INSTALL) -p -m 644 INSTALL_DIR = $(INSTALL) -p -m 755 -d -CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g -LDFLAGS = -LIBS = 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) + UNAME := $(shell uname -s) ifeq ($(UNAME),Darwin) CPU := $(shell uname -p) @@ -81,7 +86,6 @@ ifeq ($(UNAME),Darwin) LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT) LIBS += -lc STRIP = strip -x - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) else # Mac OS X SOURCES += $(SOURCES_macosx) @@ -102,13 +106,13 @@ ifeq ($(UNAME),Darwin) LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd) LIBS += -lc STRIP = strip -x - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) # install into ~/Library/Pd on Mac OS X since /usr/local isn't used much pkglibdir=$(HOME)/Library/Pd endif endif ifeq ($(UNAME),Linux) + CPU := $(shell uname -m) SOURCES += $(SOURCES_linux) EXTENSION = pd_linux OS = linux @@ -117,10 +121,10 @@ ifeq ($(UNAME),Linux) LDFLAGS += -Wl,--export-dynamic -shared -fPIC LIBS += -lc STRIP = strip --strip-unneeded -R .note -R .comment - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m) endif ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) + CPU := $(shell uname -m) SOURCES += $(SOURCES_cygwin) EXTENSION = dll OS = cygwin @@ -129,10 +133,10 @@ ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME))) LDFLAGS += -Wl,--export-dynamic -shared -L$(PD_PATH)/src LIBS += -lc -lpd STRIP = strip --strip-unneeded -R .note -R .comment - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) endif ifeq (MINGW,$(findstring MINGW,$(UNAME))) + CPU := $(shell uname -m) SOURCES += $(SOURCES_windows) EXTENSION = dll OS = windows @@ -141,14 +145,16 @@ ifeq (MINGW,$(findstring MINGW,$(UNAME))) 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 STRIP = strip --strip-unneeded -R .note -R .comment - DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION) DISTBINDIR=$(DISTDIR)-$(OS) endif +# in case somebody manually set the HELPPATCHES above +HELPPATCHES ?= $(SOURCES:.c=-help.pd) $(PDOBJECTS:.c=-help.pd) + CFLAGS += $(OPT_CFLAGS) -.PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags +.PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags $(LIBRARY_NAME) all: $(SOURCES:.c=.$(EXTENSION)) @@ -164,7 +170,6 @@ $(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) - install: libdir_install # The meta and help files are explicitly installed to make sure they are @@ -188,11 +193,8 @@ single_install: $(LIBRARY_NAME) install-doc install-exec install-doc: $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - test -z "$(strip $(SOURCES))" || \ - $(INSTALL_FILE) $(SOURCES:.c=-help.pd) \ - $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) - test -z "$(strip $(PDOBJECTS))" || \ - $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \ + test -z "$(strip $(SOURCES) $(PDOBJECTS))" || \ + $(INSTALL_FILE) $(HELPPATCHES) \ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) $(INSTALL_FILE) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt $(INSTALL_FILE) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt @@ -213,7 +215,7 @@ install-manual: clean: - -rm -f -- $(SOURCES:.c=.o) + -rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o) -rm -f -- $(SOURCES:.c=.$(EXTENSION)) -rm -f -- $(LIBRARY_NAME).o -rm -f -- $(LIBRARY_NAME).$(EXTENSION) @@ -223,6 +225,8 @@ distclean: clean -rm -rf -- $(DISTBINDIR) -rm -f -- $(DISTDIR).tar.gz -rm -rf -- $(DISTDIR) + -rm -f -- $(ORIGDIR).tar.gz + -rm -rf -- $(ORIGDIR) $(DISTBINDIR): @@ -231,7 +235,7 @@ $(DISTBINDIR): libdir: all $(DISTBINDIR) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR) $(INSTALL_FILE) $(SOURCES) $(DISTBINDIR) - $(INSTALL_FILE) $(SOURCES:.c=-help.pd) $(DISTBINDIR) + $(INSTALL_FILE) $(HELPPATCHES) $(DISTBINDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTBINDIR) # tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR) @@ -239,6 +243,9 @@ libdir: all $(DISTBINDIR) $(DISTDIR): $(INSTALL_DIR) $(DISTDIR) +$(ORIGDIR): + $(INSTALL_DIR) $(ORIGDIR) + dist: $(DISTDIR) $(INSTALL_FILE) Makefile $(DISTDIR) $(INSTALL_FILE) README.txt $(DISTDIR) @@ -246,12 +253,10 @@ dist: $(DISTDIR) $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR) test -z "$(strip $(ALLSOURCES))" || \ $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR) - test -z "$(strip $(ALLSOURCES))" || \ - $(INSTALL_FILE) $(ALLSOURCES:.c=-help.pd) $(DISTDIR) test -z "$(strip $(PDOBJECTS))" || \ $(INSTALL_FILE) $(PDOBJECTS) $(DISTDIR) - test -z "$(strip $(PDOBJECTS))" || \ - $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR) + test -z "$(strip $(HELPPATCHES))" || \ + $(INSTALL_FILE) $(HELPPATCHES) $(DISTDIR) test -z "$(strip $(EXTRA_DIST))" || \ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR) test -z "$(strip $(EXAMPLES))" || \ @@ -266,6 +271,15 @@ dist: $(DISTDIR) done tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR) +# make a Debian source package +dpkg-source: + debclean + make distclean dist + mv $(DISTDIR) $(ORIGDIR) + tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR) + rm -f -- $(DISTDIR).tar.gz + rm -rf -- $(DISTDIR) $(ORIGDIR) + cd .. && dpkg-source -b $(LIBRARY_NAME) etags: etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h @@ -281,3 +295,5 @@ showsetup: @echo "UNAME: $(UNAME)" @echo "CPU: $(CPU)" @echo "pkglibdir: $(pkglibdir)" + @echo "DISTDIR: $(DISTDIR)" + @echo "ORIGDIR: $(ORIGDIR)" -- cgit v1.2.1