updated on Fri Jan 20 20:16:25 UTC 2012
[aur-mirror.git] / pd-pmpd / Makefile
blob97f1a211678a679772152a3e7800032d6c613e38
1 ## Pd library template version 1.0.1
2 # For instructions on how to use this template, see:
3 # http://puredata.info/docs/developer/MakefileTemplate
4 LIBRARY_NAME = pmpd
6 # add your .c source files to the SOURCES variable, help files will be
7 # included automatically
8 SOURCES = iAmbient2D.c iAmbient3D.c iCircle2D.c iCircle3D.c iCylinder3D.c iLine2D.c iPlane3D.c iSeg2D.c iSphere3D.c link.c link2D.c link3D.c mass.c mass2D.c mass3D.c pmpd~.c tCircle2D.c tCircle3D.c tCube3D.c tCylinder3D.c tLine2D.c tLink2D.c tLink3D.c tPlane3D.c tSeg2D.c tSphere3D.c tSquare2D.c
10 # For objects that only build on certain platforms, add those to the SOURCES
11 # line for the right platforms.
12 SOURCES_android =
13 SOURCES_cygwin =
14 SOURCES_macosx =
15 SOURCES_iphoneos =
16 SOURCES_linux =
17 SOURCES_windows =
19 # list all pd objects (i.e. myobject.pd) files here, and their helpfiles will
20 # be included automatically
21 PDOBJECTS =
23 # example patches and related files, in the 'examples' subfolder
24 EXAMPLES = 00_pmpd.pd 01_basics.pd 02_string.pd 03_chaos2D.pd 04_3D_exemple.pd 05_corde2D.pd 06_pyramide3D.pd 07_corde3D.pd 08_ball2D.pd 09_tutorial2D.pd 10_game.pd 11_comportement.pd 12_exitation.pd 13_plane3D.pd 14_MP_curve3d.pd 15_constant_force_field.pd 16_name_and_interactors.pd 17_rnd_mouvmnt_and_obstacles.pd 18_flipper.pd 19_vertex.pd 20_moving_vertex.pd 21_fluid_circulation_cylinder.pd 22_gaz_molecules.pd 23_test.pd 24_sand.pd 25_sand2.pd 26_sand3.pd 27_tLia.pd 28_Lia.pd 29_aglom.pd 30_falling_aglom.pd 31_paste.pd 32_Kelvin_Helmoltz_instability.pd 33_vorticity_ellipse.pd 34_cigarette_smoke.pd 35_gravitation.pd 36_3D_interactors.pd 37_hollywood_planette_explosion.pd 38_elastique_membrane_on_a_sphere.pd 39_blob.pd 40_i3D.pd 41_morfing.pd 42_tentacule.pd 43_game.pd 44_flag.pd 45_newWave.pd 46_non_linear.pd 47_scann_synth.pd 48_pmpd.pd 49_pmpd~.pd 50-simple_oscilator~.pd 51_string~.pd aglom.pd aglom2.pd aglom3.pd aglom4.pd blob.pd ch_gemwin.pd ch_uzi.pd constructor.pd explose1.pd explose2.pd fluide_mass.pd fluide_mass2.pd fluide_mass3.pd fluide_mass4.pd fluide_mass5.pd fluide_mass6.pd fluide_masse.pd fluide_masse2.pd fluide_masse3.pd fluide_masse4.pd fluide_masse5.pd fluide_masse6.pd game_line.pd gemLia.pd gemLia2.pd gemMasse.pd gemMasse2.pd gemMasse3.pd i3D.pd i3D2.pd mass_link.pd mass_link2.pd mass_link3.pd mountain.pd pd_lia.pd pd_lia2.pd pd_link.pd pd_link2.pd pd_mass.pd pd_mass2.pd pd_masse.pd pd_masse2.pd rain.pd rain1.pd sand.pd smoke.pd smoke1.pd smoke_vortex.pd tut_link.pd tut_mass.pd tut_masse.pd vortex.pd vortex2.pd
26 # manuals and related files, in the 'manual' subfolder
27 MANUAL = pmpd.pdf pmpd.sxw
29 # if you want to include any other files in the source and binary tarballs,
30 # list them here. This can be anything from header files, example patches,
31 # documentation, etc. README.txt and LICENSE.txt are required and therefore
32 # automatically included
33 EXTRA_DIST = pmpd.c pmpd-help.pd
37 #------------------------------------------------------------------------------#
39 # you shouldn't need to edit anything below here, if we did it right :)
41 #------------------------------------------------------------------------------#
43 # get library version from meta file
44 LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
46 # where Pd lives
47 PD_PATH = ../../pd
48 # where to install the library
49 prefix = /usr/
50 libdir = $(prefix)/lib
51 pkglibdir = $(libdir)/pd/extra
52 objectsdir = $(pkglibdir)
55 INSTALL = install
56 INSTALL_FILE = $(INSTALL) -p -m 644
57 INSTALL_DIR = $(INSTALL) -p -m 755 -d
59 CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g
60 LDFLAGS =
61 LIBS =
62 ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \
63 $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows)
65 DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
66 ORIGDIR=pd-$(LIBRARY_NAME)_$(LIBRARY_VERSION)
68 UNAME := $(shell uname -s)
69 ifeq ($(UNAME),Darwin)
70 CPU := $(shell uname -p)
71 ifeq ($(CPU),arm) # iPhone/iPod Touch
72 SOURCES += $(SOURCES_iphoneos)
73 EXTENSION = pd_darwin
74 OS = iphoneos
75 IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
76 CC=$(IPHONE_BASE)/gcc
77 CPP=$(IPHONE_BASE)/cpp
78 CXX=$(IPHONE_BASE)/g++
79 ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk
80 IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6
81 OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer
82 CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) \
83 -I/Applications/Pd-extended.app/Contents/Resources/include
84 LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT)
85 LIBS += -lc
86 STRIP = strip -x
87 DISTBINDIR=$(DISTDIR)-$(OS)
88 else # Mac OS X
89 SOURCES += $(SOURCES_macosx)
90 EXTENSION = pd_darwin
91 OS = macosx
92 OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
93 # build universal 32-bit on 10.4 and 32/64 on newer
94 ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8)
95 FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4
96 else
97 FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4
98 SOURCES += $(SOURCES_iphoneos)
99 endif
100 CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \
101 -I/Applications/Pd-extended.app/Contents/Resources/include
102 LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
103 # if the 'pd' binary exists, check the linking against it to aid with stripping
104 LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
105 LIBS += -lc
106 STRIP = strip -x
107 DISTBINDIR=$(DISTDIR)-$(OS)
108 # install into ~/Library/Pd on Mac OS X since /usr/local isn't used much
109 pkglibdir=$(HOME)/Library/Pd
110 endif
111 endif
112 ifeq ($(UNAME),Linux)
113 SOURCES += $(SOURCES_linux)
114 EXTENSION = pd_linux
115 OS = linux
116 OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
117 CFLAGS += -fPIC
118 LDFLAGS += -Wl,--export-dynamic -shared -fPIC
119 LIBS += -lc
120 STRIP = strip --strip-unneeded -R .note -R .comment
121 DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
122 endif
123 ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
124 SOURCES += $(SOURCES_cygwin)
125 EXTENSION = dll
126 OS = cygwin
127 OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
128 CFLAGS +=
129 LDFLAGS += -Wl,--export-dynamic -shared -L$(PD_PATH)/src
130 LIBS += -lc -lpd
131 STRIP = strip --strip-unneeded -R .note -R .comment
132 DISTBINDIR=$(DISTDIR)-$(OS)
133 endif
134 ifeq (MINGW,$(findstring MINGW,$(UNAME)))
135 SOURCES += $(SOURCES_windows)
136 EXTENSION = dll
137 OS = windows
138 OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
139 CFLAGS += -mms-bitfields
140 LDFLAGS += -s -shared -Wl,--enable-auto-import
141 LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
142 STRIP = strip --strip-unneeded -R .note -R .comment
143 DISTBINDIR=$(DISTDIR)-$(OS)
144 endif
146 CFLAGS += $(OPT_CFLAGS)
149 .PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags
151 all: $(SOURCES:.c=.$(EXTENSION))
153 %.o: %.c
154 $(CC) $(CFLAGS) -o "$*.o" -c "$*.c"
156 %.$(EXTENSION): %.o
157 $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
158 chmod a-x "$*.$(EXTENSION)"
160 # this links everything into a single binary file
161 $(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o
162 $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS)
163 chmod a-x $(LIBRARY_NAME).$(EXTENSION)
166 install: libdir_install
168 # The meta and help files are explicitly installed to make sure they are
169 # actually there. Those files are not optional, then need to be there.
170 libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual
171 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
172 $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd \
173 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
174 test -z "$(strip $(SOURCES))" || (\
175 $(INSTALL_FILE) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \
176 $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION))))
177 test -z "$(strip $(PDOBJECTS))" || \
178 $(INSTALL_FILE) $(PDOBJECTS) \
179 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
181 # install library linked as single binary
182 single_install: $(LIBRARY_NAME) install-doc install-exec
183 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
184 $(INSTALL_FILE) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
185 $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
187 install-doc:
188 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
189 test -z "$(strip $(SOURCES))" || \
190 $(INSTALL_FILE) $(SOURCES:.c=-help.pd) \
191 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
192 test -z "$(strip $(PDOBJECTS))" || \
193 $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \
194 $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
195 $(INSTALL_FILE) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
196 $(INSTALL_FILE) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt
198 install-examples:
199 test -z "$(strip $(EXAMPLES))" || \
200 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \
201 for file in $(EXAMPLES); do \
202 $(INSTALL_FILE) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \
203 done
205 install-manual:
206 test -z "$(strip $(MANUAL))" || \
207 $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \
208 for file in $(MANUAL); do \
209 $(INSTALL_FILE) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \
210 done
213 clean:
214 -rm -f -- $(SOURCES:.c=.o)
215 -rm -f -- $(SOURCES:.c=.$(EXTENSION))
216 -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
218 distclean: clean
219 -rm -f -- $(DISTBINDIR).tar.gz
220 -rm -rf -- $(DISTBINDIR)
221 -rm -f -- $(DISTDIR).tar.gz
222 -rm -rf -- $(DISTDIR)
223 -rm -f -- $(ORIGDIR).tar.gz
224 -rm -rf -- $(ORIGDIR)
227 $(DISTBINDIR):
228 $(INSTALL_DIR) $(DISTBINDIR)
230 libdir: all $(DISTBINDIR)
231 $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR)
232 $(INSTALL_FILE) $(SOURCES) $(DISTBINDIR)
233 $(INSTALL_FILE) $(SOURCES:.c=-help.pd) $(DISTBINDIR)
234 test -z "$(strip $(EXTRA_DIST))" || \
235 $(INSTALL_FILE) $(EXTRA_DIST) $(DISTBINDIR)
236 # tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR)
238 $(DISTDIR):
239 $(INSTALL_DIR) $(DISTDIR)
241 $(ORIGDIR):
242 $(INSTALL_DIR) $(ORIGDIR)
244 dist: $(DISTDIR)
245 $(INSTALL_FILE) Makefile $(DISTDIR)
246 $(INSTALL_FILE) README.txt $(DISTDIR)
247 $(INSTALL_FILE) LICENSE.txt $(DISTDIR)
248 $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR)
249 test -z "$(strip $(ALLSOURCES))" || \
250 $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR)
251 test -z "$(strip $(ALLSOURCES))" || \
252 $(INSTALL_FILE) $(ALLSOURCES:.c=-help.pd) $(DISTDIR)
253 test -z "$(strip $(PDOBJECTS))" || \
254 $(INSTALL_FILE) $(PDOBJECTS) $(DISTDIR)
255 test -z "$(strip $(PDOBJECTS))" || \
256 $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR)
257 test -z "$(strip $(EXTRA_DIST))" || \
258 $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR)
259 test -z "$(strip $(EXAMPLES))" || \
260 $(INSTALL_DIR) $(DISTDIR)/examples && \
261 for file in $(EXAMPLES); do \
262 $(INSTALL_FILE) examples/$$file $(DISTDIR)/examples; \
263 done
264 test -z "$(strip $(MANUAL))" || \
265 $(INSTALL_DIR) $(DISTDIR)/manual && \
266 for file in $(MANUAL); do \
267 $(INSTALL_FILE) manual/$$file $(DISTDIR)/manual; \
268 done
269 tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
271 # make a Debian source package
272 dpkg-source:
273 debclean
274 make distclean dist
275 mv $(DISTDIR) $(ORIGDIR)
276 tar --exclude-vcs -czpf ../$(ORIGDIR).orig.tar.gz $(ORIGDIR)
277 rm -f -- $(DISTDIR).tar.gz
278 rm -rf -- $(DISTDIR) $(ORIGDIR)
279 cd .. && dpkg-source -b $(LIBRARY_NAME)
281 etags:
282 etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h
284 showsetup:
285 @echo "PD_PATH: $(PD_PATH)"
286 @echo "objectsdir: $(objectsdir)"
287 @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
288 @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)"
289 @echo "SOURCES: $(SOURCES)"
290 @echo "PDOBJECTS: $(PDOBJECTS)"
291 @echo "ALLSOURCES: $(ALLSOURCES)"
292 @echo "UNAME: $(UNAME)"
293 @echo "CPU: $(CPU)"
294 @echo "pkglibdir: $(pkglibdir)"
295 @echo "DISTDIR: $(DISTDIR)"
296 @echo "ORIGDIR: $(ORIGDIR)"