updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / pd-ggee / Makefile
blob911f46ac6d7019b7b162e9d2cc0dda2e7e840c4f
1 ## Pd library template version 1.0.5
2 # For instructions on how to use this template, see:
3 # http://puredata.info/docs/developer/MakefileTemplate
4 LIBRARY_NAME = ggee
6 # add your .c source files, one object per file, to the SOURCES
7 # variable, help files will be included automatically
9 SOURCES = control/constant.c control/rl.c control/serial_ms.c control/sl.c control/getdir.c control/rtout.c control/serial_mt.c control/stripdir.c control/inv.c control/serial_bird.c control/shell.c control/unserialize.c control/qread.c control/serialize.c control/sinh.c control/unwonk.c experimental/fofsynth~.c experimental/tabwrite4~.c experimental/pvocfreq.c filters/bandpass.c filters/highpass.c filters/hlshelf.c filters/lowshelf.c filters/notch.c filters/equalizer.c filters/highshelf.c filters/lowpass.c filters/moog~.c gui/button.c gui/fatom.c gui/image.c gui/sliderh.c gui/ticker.c gui/envgen.c gui/gcanvas.c gui/slider.c gui/state.c gui/toddle.c signal/atan2~.c signal/mixer~.c signal/sfwrite~.c signal/streamin~.c signal/streamout~.c
11 SOURCES_linux =
13 # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will
14 # be included automatically
15 PDOBJECTS =
17 # example patches and related files, in the 'examples' subfolder
18 EXAMPLES =
20 # manuals and related files, in the 'manual' subfolder
21 MANUAL =
23 # if you want to include any other files in the source and binary tarballs,
24 # list them here. This can be anything from header files, test patches,
25 # documentation, etc. README.txt and LICENSE.txt are required and therefore
26 # automatically included
27 EXTRA_DIST =
31 #------------------------------------------------------------------------------#
33 # things you might need to edit if you are using other C libraries
35 #------------------------------------------------------------------------------#
37 CFLAGS = -DPD -I. -I"$(PD_INCLUDE)"/pd -Wall -W -g
38 LDFLAGS =
39 LIBS =
41 #------------------------------------------------------------------------------#
43 # you shouldn't need to edit anything below here, if we did it right :)
45 #------------------------------------------------------------------------------#
47 # get library version from meta file
48 LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
50 CFLAGS += -DVERSION='"$(LIBRARY_VERSION)"'
52 PD_INCLUDE = $(PD_PATH)/include
53 # where to install the library, overridden below depending on platform
54 prefix = /usr
55 libdir = $(prefix)/lib
56 pkglibdir = $(libdir)/pd/extra
57 objectsdir = $(pkglibdir)
59 INSTALL = install
60 INSTALL_PROGRAM = $(INSTALL) -p -m 644
61 INSTALL_DATA = $(INSTALL) -p -m 644
62 INSTALL_DIR = $(INSTALL) -p -m 755 -d
64 ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \
65 $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows)
67 DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
68 ORIGDIR=pd-$(LIBRARY_NAME:~=)_$(LIBRARY_VERSION)
70 UNAME := $(shell uname -s)
71 ifeq ($(UNAME),Darwin)
72 CPU := $(shell uname -p)
73 ifeq ($(CPU),arm) # iPhone/iPod Touch
74 SOURCES += $(SOURCES_iphoneos)
75 EXTENSION = pd_darwin
76 OS = iphoneos
77 PD_PATH = /Applications/Pd-extended.app/Contents/Resources
78 IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
79 CC=$(IPHONE_BASE)/gcc
80 CPP=$(IPHONE_BASE)/cpp
81 CXX=$(IPHONE_BASE)/g++
82 ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk
83 IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6
84 OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer
85 CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS)
86 LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT)
87 LIBS += -lc
88 STRIP = strip -x
89 DISTBINDIR=$(DISTDIR)-$(OS)
90 else # Mac OS X
91 SOURCES += $(SOURCES_macosx)
92 EXTENSION = pd_darwin
93 OS = macosx
94 PD_PATH = /Applications/Pd-extended.app/Contents/Resources
95 OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
96 # build universal 32-bit on 10.4 and 32/64 on newer
97 ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8)
98 FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4
99 else
100 FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4
101 SOURCES += $(SOURCES_iphoneos)
102 endif
103 CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include
104 LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
105 # if the 'pd' binary exists, check the linking against it to aid with stripping
106 LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
107 LIBS += -lc
108 STRIP = strip -x
109 DISTBINDIR=$(DISTDIR)-$(OS)
110 # install into ~/Library/Pd on Mac OS X since /usr/local isn't used much
111 pkglibdir=$(HOME)/Library/Pd
112 endif
113 endif
114 ifeq ($(UNAME),Linux)
115 CPU := $(shell uname -m)
116 SOURCES += $(SOURCES_linux)
117 EXTENSION = pd_linux
118 OS = linux
119 PD_PATH = /usr
120 OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
121 CFLAGS += -fPIC
122 LDFLAGS += -Wl,--export-dynamic -shared -fPIC
123 LIBS += -lc
124 STRIP = strip --strip-unneeded -R .note -R .comment
125 DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
126 endif
127 ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
128 CPU := $(shell uname -m)
129 SOURCES += $(SOURCES_cygwin)
130 EXTENSION = dll
131 OS = cygwin
132 PD_PATH = $(cygpath $(PROGRAMFILES))/pd
133 OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
134 CFLAGS +=
135 LDFLAGS += -Wl,--export-dynamic -shared -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin"
136 LIBS += -lc -lpd
137 STRIP = strip --strip-unneeded -R .note -R .comment
138 DISTBINDIR=$(DISTDIR)-$(OS)
139 endif
140 ifeq (MINGW,$(findstring MINGW,$(UNAME)))
141 CPU := $(shell uname -m)
142 SOURCES += $(SOURCES_windows)
143 EXTENSION = dll
144 OS = windows
145 PD_PATH = $(shell cd "$(PROGRAMFILES)"/pd && pwd)
146 OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer
147 CFLAGS += -mms-bitfields
148 LDFLAGS += -s -shared -Wl,--enable-auto-import
149 LIBS += -L"$(PD_PATH)/src" -L"$(PD_PATH)/bin" -L"$(PD_PATH)/obj" -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
150 STRIP = strip --strip-unneeded -R .note -R .comment
151 DISTBINDIR=$(DISTDIR)-$(OS)
152 endif
154 # in case somebody manually set the HELPPATCHES above
155 HELPPATCHES ?= $(SOURCES:.c=-help.pd) $(PDOBJECTS:.pd=-help.pd)
157 CFLAGS += $(OPT_CFLAGS)
160 .PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags $(LIBRARY_NAME)
162 all: $(SOURCES:.c=.$(EXTENSION))
164 %.o: %.c
165 $(CC) $(CFLAGS) -o "$*.o" -c "$*.c"
167 %.$(EXTENSION): %.o
168 $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
169 chmod a-x "$*.$(EXTENSION)"
171 # this links everything into a single binary file
172 $(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o
173 $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS)
174 chmod a-x $(LIBRARY_NAME).$(EXTENSION)
176 install: libdir_install
178 # The meta and help files are explicitly installed to make sure they are
179 # actually there. Those files are not optional, then need to be there.
180 libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual
181 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
182 $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd \
183 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
184 test -z "$(strip $(SOURCES))" || \
185 $(INSTALL_PROGRAM) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
186 $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/*.$(EXTENSION)
187 test -z "$(strip $(PDOBJECTS))" || \
188 $(INSTALL_DATA) $(PDOBJECTS) \
189 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
191 # install library linked as single binary
192 single_install: $(LIBRARY_NAME) install-doc install-exec
193 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
194 $(INSTALL_PROGRAM) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
195 $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
197 install-doc:
198 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
199 test -z "$(strip $(SOURCES) $(PDOBJECTS))" || \
200 $(INSTALL_DATA) $(HELPPATCHES) \
201 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
202 $(INSTALL_DATA) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
203 $(INSTALL_DATA) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt
205 install-examples:
206 test -z "$(strip $(EXAMPLES))" || \
207 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \
208 for file in $(EXAMPLES); do \
209 $(INSTALL_DATA) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \
210 done
212 install-manual:
213 test -z "$(strip $(MANUAL))" || \
214 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \
215 for file in $(MANUAL); do \
216 $(INSTALL_DATA) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \
217 done
220 clean:
221 -rm -f -- $(SOURCES:.c=.o) $(SOURCES_LIB:.c=.o)
222 -rm -f -- $(SOURCES:.c=.$(EXTENSION))
223 -rm -f -- $(LIBRARY_NAME).o
224 -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
226 distclean: clean
227 -rm -f -- $(DISTBINDIR).tar.gz
228 -rm -rf -- $(DISTBINDIR)
229 -rm -f -- $(DISTDIR).tar.gz
230 -rm -rf -- $(DISTDIR)
231 -rm -f -- $(ORIGDIR).tar.gz
232 -rm -rf -- $(ORIGDIR)
235 $(DISTBINDIR):
236 $(INSTALL_DIR) $(DISTBINDIR)
238 libdir: all $(DISTBINDIR)
239 $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR)
240 $(INSTALL_DATA) $(SOURCES) $(DISTBINDIR)
241 $(INSTALL_DATA) $(HELPPATCHES) $(DISTBINDIR)
242 test -z "$(strip $(EXTRA_DIST))" || \
243 $(INSTALL_DATA) $(EXTRA_DIST) $(DISTBINDIR)
244 # tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR)
246 $(DISTDIR):
247 $(INSTALL_DIR) $(DISTDIR)
249 $(ORIGDIR):
250 $(INSTALL_DIR) $(ORIGDIR)
252 dist: $(DISTDIR)
253 $(INSTALL_DATA) Makefile $(DISTDIR)
254 $(INSTALL_DATA) README.txt $(DISTDIR)
255 $(INSTALL_DATA) LICENSE.txt $(DISTDIR)
256 $(INSTALL_DATA) $(LIBRARY_NAME)-meta.pd $(DISTDIR)
257 test -z "$(strip $(ALLSOURCES))" || \
258 $(INSTALL_DATA) $(ALLSOURCES) $(DISTDIR)
259 test -z "$(strip $(PDOBJECTS))" || \
260 $(INSTALL_DATA) $(PDOBJECTS) $(DISTDIR)
261 test -z "$(strip $(HELPPATCHES))" || \
262 $(INSTALL_DATA) $(HELPPATCHES) $(DISTDIR)
263 test -z "$(strip $(EXTRA_DIST))" || \
264 $(INSTALL_DATA) $(EXTRA_DIST) $(DISTDIR)
265 test -z "$(strip $(EXAMPLES))" || \
266 $(INSTALL_DIR) $(DISTDIR)/examples && \
267 for file in $(EXAMPLES); do \
268 $(INSTALL_DATA) examples/$$file $(DISTDIR)/examples; \
269 done
270 test -z "$(strip $(MANUAL))" || \
271 $(INSTALL_DIR) $(DISTDIR)/manual && \
272 for file in $(MANUAL); do \
273 $(INSTALL_DATA) manual/$$file $(DISTDIR)/manual; \
274 done
275 tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
277 # make a Debian source package
278 dpkg-source:
279 debclean
280 make distclean dist
281 mv $(DISTDIR) $(ORIGDIR)
282 tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR)
283 rm -f -- $(DISTDIR).tar.gz
284 rm -rf -- $(DISTDIR) $(ORIGDIR)
285 cd .. && dpkg-source -b $(LIBRARY_NAME)
287 etags:
288 etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h
290 showsetup:
291 @echo "CFLAGS: $(CFLAGS)"
292 @echo "LDFLAGS: $(LDFLAGS)"
293 @echo "LIBS: $(LIBS)"
294 @echo "PD_INCLUDE: $(PD_INCLUDE)"
295 @echo "PD_PATH: $(PD_PATH)"
296 @echo "objectsdir: $(objectsdir)"
297 @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
298 @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)"
299 @echo "SOURCES: $(SOURCES)"
300 @echo "PDOBJECTS: $(PDOBJECTS)"
301 @echo "ALLSOURCES: $(ALLSOURCES)"
302 @echo "UNAME: $(UNAME)"
303 @echo "CPU: $(CPU)"
304 @echo "pkglibdir: $(pkglibdir)"
305 @echo "DISTDIR: $(DISTDIR)"
306 @echo "ORIGDIR: $(ORIGDIR)"