File: Makefile

package info (click to toggle)
pd-iemmatrix 0.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,576 kB
  • sloc: ansic: 15,440; makefile: 291; sh: 169
file content (326 lines) | stat: -rw-r--r-- 7,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# Makefile to build class 'iemmatrix' for Pure Data.
# Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build
# settings and rules.

# library name
lib.name = iemmatrix
# use 'lib.version' to set the library version from the cmdline
#lib.version := $(shell git describe || true)

# mtx_*~ and friends make problems...
make-lib-executable=yes

cflags =
ldlibs =
ifneq ($(strip $(lib.version)),)
cflags += -DVERSION='"$(lib.version)"'
endif

cflags += -I. -Isrc

SHELL := /bin/sh

#####################################################################
## external dependencies (used by STUB LIBRARIES at the end)

# set any of these to 'no' to disable the library
# typically this is not needed, as
# - dependencies are only used if found
# - we do "weak" linking (so the external can still be used
#   if the dependencies are not present on the host systems
with-sndfile := yes
with-gsl := yes
with-fftw := yes

# make pkg-config overridable (for cross-building)
PKG_CONFIG ?= pkg-config

# libsndfile
ifneq ($(with-sndfile),no)
have-sndfile := $(shell $(PKG_CONFIG) --exists sndfile && echo yes || echo no)
endif
ifeq ($(have-sndfile),yes)
$(info ++++ info: found libsndfile)
SNDFILE_CFLAGS = $(shell $(PKG_CONFIG) --cflags sndfile)
SNDFILE_LIBS = $(shell $(PKG_CONFIG) --libs sndfile)
else
$(info ++++ info: missing libsndfile)
endif
ifneq ($(SNDFILE_LIBS),)
SNDFILE_CFLAGS += -DUSE_SNDFILE=1 -DHAVE_SNDFILE_H=1
else
have-sndfile=no
endif
cflags += $(SNDFILE_CFLAGS)

# GNU scientific library
ifneq ($(with-gsl),no)
have-gsl := $(shell $(PKG_CONFIG) --exists gsl && echo yes || echo no)
endif
ifeq ($(have-gsl),yes)
$(info ++++ info: found GSL)
GSL_CFLAGS = $(shell $(PKG_CONFIG) --cflags gsl)
GSL_LIBS = $(shell $(PKG_CONFIG) --libs gsl)
else
$(info ++++ info: missing GSL)
endif
ifneq ($(GSL_LIBS),)
have-gsl=yes
GSL_CFLAGS += -DHAVE_LIBGSL=1 -DHAVE_GSL_EIGEN_NONSYMM=1 -DHAVE_GSL_BESSEL=1
else
have-gsl=no
endif
cflags += $(GSL_CFLAGS)
# afaik, all libm implementations have a bessel function
cflags += -DHAVE_MATH_BESSEL=1

# FFTW
ifneq ($(with-fftw),no)
have-fftw3 := $(shell $(PKG_CONFIG) --exists fftw3 && echo yes || echo no)
endif
ifeq ($(have-fftw3),yes)
$(info ++++ info: found FFTW3)
FFTW_CFLAGS = $(shell $(PKG_CONFIG) --cflags fftw3)
FFTW_LIBS = $(shell $(PKG_CONFIG) --libs fftw3)
FFTWF_CFLAGS = $(shell $(PKG_CONFIG) --cflags fftw3f)
FFTWF_LIBS = $(shell $(PKG_CONFIG) --libs fftw3f)
else
$(info ++++ info: missing FFTW3)
endif
ifneq ($(FFTW_LIBS),)
have-fftw=yes
FFTW_CFLAGS += -DHAVE_FFTW=1
else
have-fftw=no
endif
ifneq ($(FFTWF_LIBS),)
have-fftwf=yes
FFTWF_CFLAGS += -DHAVE_FFTWF=1
else
have-fftwf=no
endif
cflags += $(FFTW_CFLAGS) $(FFTWF_CFLAGS)

##
#####################################################################

lib.setup.sources = \
	src/iemmatrix.c

common.sources = \
	src/iemmatrix_utility.c \
	src/iemmatrix_binop.c \
	src/iemmatrix_binops.c \
	src/iemmatrix_unop.c \
	src/iemmatrix_stub.c \
	src/iemmatrix_fft.c \
	$(empty)

# input source file (class name == source file basename)
class.sources = \
	src/matrix.c \
	src/mtx_abs.c \
	src/mtx_add.c \
	src/mtx_and.c \
	src/mtx_atan.c \
	src/mtx_atan2.c \
	src/mtx_bessel.c \
	src/mtx_bitand.c \
	src/mtx_bitleft.c \
	src/mtx_bitor.c \
	src/mtx_bitright.c \
	src/mtx_bspline.c \
	src/mtx_check.c \
	src/mtx_cholesky.c \
	src/mtx_col.c \
	src/mtx_colon.c \
	src/mtx_concat.c \
	src/mtx_conv.c \
	src/mtx_cos.c \
	src/mtx_cumprod.c \
	src/mtx_cumsum.c \
	src/mtx_dbtopow.c \
	src/mtx_dbtorms.c \
	src/mtx_decay.c \
	src/mtx_diag.c \
	src/mtx_diegg.c \
	src/mtx_diff.c \
	src/mtx_dispersive_dline.c \
	src/mtx_distance2.c \
	src/mtx_div.c \
	src/mtx_egg.c \
	src/mtx_eig.c \
	src/mtx_element.c \
	src/mtx_eq.c \
	src/mtx_exp.c \
	src/mtx_eye.c \
	src/mtx_fft.c \
	src/mtx_fill.c \
	src/mtx_find.c \
	src/mtx_gauss.c \
	src/mtx_ge.c \
	src/mtx_gt.c \
	src/mtx_ifft.c \
	src/mtx_index.c \
	src/mtx_int.c \
	src/mtx_inverse.c \
	src/mtx_isequal.c \
	src/mtx_le.c \
	src/mtx_log.c \
	src/mtx_lt.c \
	src/mtx_max2.c \
	src/mtx_mean.c \
	src/mtx_min2.c \
	src/mtx_minmax.c \
	src/mtx_mul.c \
	src/mtx_mul~.c \
	src/mtx_neq.c \
	src/mtx_not.c \
	src/mtx_ones.c \
	src/mtx_or.c \
	src/mtx_pack~.c \
	src/mtx_pivot.c \
	src/mtx_pow.c \
	src/mtx_powtodb.c \
	src/mtx_print.c \
	src/mtx_prod.c \
	src/mtx_qr.c \
	src/mtx_rand.c \
	src/mtx_repmat.c \
	src/mtx_resize.c \
	src/mtx_reverse.c \
	src/mtx_rfft.c \
	src/mtx_rifft.c \
	src/mtx_rmstodb.c \
	src/mtx_roll.c \
	src/mtx_row.c \
	src/mtx_scroll.c \
	src/mtx_sin.c \
	src/mtx_size.c \
	src/mtx_slice.c \
	src/mtx_sndfileread.c \
	src/mtx_sort.c \
	src/mtx_sqrt.c \
	src/mtx_sub.c \
	src/mtx_sum.c \
	src/mtx_svd.c \
	src/mtx_tan.c \
	src/mtx_trace.c \
	src/mtx_transpose.c \
	src/mtx_unpack~.c \
	src/mtx_zeros.c \
	$(empty)

class.sources += \
	src/mtx_qhull.c
mtx_qhull.class.sources = \
	src/mtx_qhull/list.c \
	src/mtx_qhull/vectors.c \
	src/mtx_qhull/zhull.c \
	$(empty)

class.sources += \
	src/mtx_spherical_radial.c
mtx_spherical_radial.class.sources = \
	src/mtx_spherical_harmonics/sph_radial.c \
	$(empty)

class.sources += \
	src/mtx_spherical_harmonics.c \
	src/mtx_spherical_harmonics_rotator.c
mtx_spherical_harmonics.class.sources = \
	src/mtx_spherical_harmonics/chebyshev12.c \
	src/mtx_spherical_harmonics/legendre_a.c \
	src/mtx_spherical_harmonics/sharmonics.c \
	src/mtx_spherical_harmonics/sharmonics_normalization.c \
	$(empty)

class.sources += \
	src/mtx_convolver~.c
mtx_convolver~.class.sources = \
	src/mtx_convolver/array.c \
	src/mtx_convolver/convolver.c \
	$(empty)


#ifneq ($(make-lib-executable),yes)
#class.sources += \
#	alias/matrix_mul_line~.c \
#	alias/matrix_mul~.c \
#	alias/matrix~.c \
#	alias/mtx.c \
#	alias/mtx_0x21.c \
#	alias/mtx_0x210x3d.c \
#	alias/mtx_0x26.c \
#	alias/mtx_0x260x26.c \
#	alias/mtx_0x2a.c \
#	alias/mtx_0x2a0x7e.c \
#	alias/mtx_0x2b.c \
#	alias/mtx_0x2d.c \
#	alias/mtx_0x2e0x2a.c \
#	alias/mtx_0x2e0x2f.c \
#	alias/mtx_0x2e0x5e.c \
#	alias/mtx_0x2f.c \
#	alias/mtx_0x3a.c \
#	alias/mtx_0x3c.c \
#	alias/mtx_0x3c0x3c.c \
#	alias/mtx_0x3c0x3d.c \
#	alias/mtx_0x3d0x3d.c \
#	alias/mtx_0x3e.c \
#	alias/mtx_0x3e0x3d.c \
#	alias/mtx_0x3e0x3e.c \
#	alias/mtx_0x7c.c \
#	alias/mtx_0x7c0x7c.c \
#	alias/mtx_div.c \
#	$(empty)
#endif

# all extra files to be included in binary distribution of the library
datafiles = \
	AUTHORS.txt \
	GnuGPL.txt \
	LICENSE.txt \
	README.md \
	$(empty)
datafiles += \
	VERSION.txt \
	iemmatrix-meta.pd \
	$(empty)

datafiles += \
	$(wildcard abs/*.pd) \
	$(wildcard help/*.pd) \
	$(empty)
datafiles += \
	$(wildcard help/*.arr3) \
	$(wildcard help/*.mtx) \
	$(empty)

in.files = $(wildcard *.in)

# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
PDLIBBUILDER_DIR=pd-lib-builder/
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder


src/iemmatrix.c: iemmatrix_sources.h VERSION.txt iemmatrix-meta.pd

iemmatrix_sources.h:
	$(SHELL) src/makesource.sh $(sort $(class.sources)) >$@

%: %.in
	sed -e 's|@PACKAGE_NAME@|$(lib.name)|g' -e 's|@PACKAGE_VERSION@|$(lib.version)|g' $< > $@


.PHONY: check
check:
	$(MAKE) -C tests

.PHONY: clean.local
clean: clean.local
clean.local:
	-rm iemmatrix_sources.h
	-rm $(in.files:%.in=%)

# build stub libraries
-include src/stub/Make.stublibs