]> sigrok.org Git - libsigrok.git/blob - Makefile.am
output/csv: use intermediate time_t var, silence compiler warning
[libsigrok.git] / Makefile.am
1 ##
2 ## This file is part of the libsigrok project.
3 ##
4 ## Copyright (C) 2010-2012 Bert Vermeulen <bert@biot.com>
5 ## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
6 ##
7 ## This program is free software: you can redistribute it and/or modify
8 ## it under the terms of the GNU General Public License as published by
9 ## the Free Software Foundation, either version 3 of the License, or
10 ## (at your option) any later version.
11 ##
12 ## This program is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
16 ##
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 ##
20
21 ACLOCAL_AMFLAGS = -I autostuff
22
23 AM_CPPFLAGS = -I$(srcdir)/src -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
24
25 lib_LTLIBRARIES = libsigrok.la
26
27 # Backend files
28 libsigrok_la_SOURCES = \
29         src/backend.c \
30         src/device.c \
31         src/session.c \
32         src/session_file.c \
33         src/session_driver.c \
34         src/drivers.c \
35         src/hwdriver.c \
36         src/trigger.c \
37         src/soft-trigger.c \
38         src/strutil.c \
39         src/log.c \
40         src/version.c \
41         src/error.c \
42         src/std.c
43
44 # Input modules
45 libsigrok_la_SOURCES += \
46         src/input/binary.c \
47         src/input/chronovu_la8.c \
48         src/input/csv.c \
49         src/input/input.c \
50         src/input/vcd.c \
51         src/input/wav.c
52
53 # Output modules
54 libsigrok_la_SOURCES += \
55         src/output/output.c \
56         src/output/analog.c \
57         src/output/ascii.c \
58         src/output/bits.c \
59         src/output/binary.c \
60         src/output/csv.c \
61         src/output/chronovu_la8.c \
62         src/output/wav.c \
63         src/output/gnuplot.c \
64         src/output/hex.c \
65         src/output/ols.c \
66         src/output/vcd.c
67
68 # SCPI support
69 libsigrok_la_SOURCES += \
70         src/scpi/scpi.c \
71         src/scpi/scpi_tcp.c
72 if NEED_RPC
73 libsigrok_la_SOURCES += \
74         src/scpi/scpi_vxi.c \
75         src/scpi/vxi_clnt.c \
76         src/scpi/vxi_xdr.c \
77         src/scpi/vxi.h
78 endif
79 if NEED_SERIAL
80 libsigrok_la_SOURCES += \
81         src/serial.c \
82         src/scpi/scpi_serial.c
83 endif
84 if NEED_USB
85 libsigrok_la_SOURCES += \
86         src/ezusb.c \
87         src/usb.c \
88         src/scpi/scpi_usbtmc_libusb.c
89 endif
90 if NEED_VISA
91 libsigrok_la_SOURCES += \
92         src/scpi/scpi_visa.c
93 endif
94
95 # Hardware (DMM chip parsers)
96 libsigrok_la_SOURCES += \
97         src/dmm/es519xx.c \
98         src/dmm/fs9721.c \
99         src/dmm/fs9922.c \
100         src/dmm/m2110.c \
101         src/dmm/metex14.c \
102         src/dmm/rs9lcd.c \
103         src/dmm/bm25x.c
104
105 # Hardware drivers
106 if HW_AGILENT_DMM
107 libsigrok_la_SOURCES += \
108         src/hardware/agilent-dmm/api.c \
109         src/hardware/agilent-dmm/agilent-dmm.h \
110         src/hardware/agilent-dmm/sched.c
111 endif
112 if HW_APPA_55II
113 libsigrok_la_SOURCES += \
114         src/hardware/appa-55ii/protocol.h \
115         src/hardware/appa-55ii/protocol.c \
116         src/hardware/appa-55ii/api.c
117 endif
118 if HW_ASIX_SIGMA
119 libsigrok_la_SOURCES += \
120         src/hardware/asix-sigma/asix-sigma.h \
121         src/hardware/asix-sigma/asix-sigma.c
122 endif
123 if HW_ATTEN_PPS3XXX
124 libsigrok_la_SOURCES += \
125         src/hardware/atten-pps3xxx/protocol.h \
126         src/hardware/atten-pps3xxx/protocol.c \
127         src/hardware/atten-pps3xxx/api.c
128 endif
129 if HW_BEAGLELOGIC
130 libsigrok_la_SOURCES += \
131         src/hardware/beaglelogic/beaglelogic.h \
132         src/hardware/beaglelogic/protocol.h \
133         src/hardware/beaglelogic/protocol.c \
134         src/hardware/beaglelogic/api.c
135 endif
136 if HW_BRYMEN_BM86X
137 libsigrok_la_SOURCES += \
138         src/hardware/brymen-bm86x/protocol.h \
139         src/hardware/brymen-bm86x/protocol.c \
140         src/hardware/brymen-bm86x/api.c
141 endif
142 if HW_BRYMEN_DMM
143 libsigrok_la_SOURCES += \
144         src/hardware/brymen-dmm/parser.c \
145         src/hardware/brymen-dmm/protocol.h \
146         src/hardware/brymen-dmm/protocol.c \
147         src/hardware/brymen-dmm/api.c
148 endif
149 if HW_CEM_DT_885X
150 libsigrok_la_SOURCES += \
151         src/hardware/cem-dt-885x/protocol.h \
152         src/hardware/cem-dt-885x/protocol.c \
153         src/hardware/cem-dt-885x/api.c
154 endif
155 if HW_CENTER_3XX
156 libsigrok_la_SOURCES += \
157         src/hardware/center-3xx/protocol.h \
158         src/hardware/center-3xx/protocol.c \
159         src/hardware/center-3xx/api.c
160 endif
161 if HW_CHRONOVU_LA
162 libsigrok_la_SOURCES += \
163         src/hardware/chronovu-la/protocol.h \
164         src/hardware/chronovu-la/protocol.c \
165         src/hardware/chronovu-la/api.c
166 endif
167 if HW_COLEAD_SLM
168 libsigrok_la_SOURCES += \
169         src/hardware/colead-slm/protocol.h \
170         src/hardware/colead-slm/protocol.c \
171         src/hardware/colead-slm/api.c
172 endif
173 if HW_CONRAD_DIGI_35_CPU
174 libsigrok_la_SOURCES += \
175         src/hardware/conrad-digi-35-cpu/protocol.h \
176         src/hardware/conrad-digi-35-cpu/protocol.c \
177         src/hardware/conrad-digi-35-cpu/api.c
178 endif
179 if HW_DEMO
180 libsigrok_la_SOURCES += \
181         src/hardware/demo/demo.c
182 endif
183 if HW_FLUKE_DMM
184 libsigrok_la_SOURCES += \
185         src/hardware/fluke-dmm/fluke-dmm.h \
186         src/hardware/fluke-dmm/fluke.c \
187         src/hardware/fluke-dmm/api.c
188 endif
189 if HW_FX2LAFW
190 libsigrok_la_SOURCES += \
191         src/hardware/fx2lafw/protocol.h \
192         src/hardware/fx2lafw/protocol.c \
193         src/hardware/fx2lafw/api.c
194 endif
195 if HW_GMC_MH_1X_2X
196 libsigrok_la_SOURCES += \
197         src/hardware/gmc-mh-1x-2x/protocol.h \
198         src/hardware/gmc-mh-1x-2x/protocol.c \
199         src/hardware/gmc-mh-1x-2x/api.c
200 endif
201 if HW_HAMEG_HMO
202 libsigrok_la_SOURCES += \
203         src/hardware/hameg-hmo/protocol.h \
204         src/hardware/hameg-hmo/protocol.c \
205         src/hardware/hameg-hmo/api.c
206 endif
207 if HW_HANTEK_DSO
208 libsigrok_la_SOURCES += \
209         src/hardware/hantek-dso/dso.h \
210         src/hardware/hantek-dso/dso.c \
211         src/hardware/hantek-dso/api.c
212 endif
213 if HW_IKALOGIC_SCANALOGIC2
214 libsigrok_la_SOURCES += \
215         src/hardware/ikalogic-scanalogic2/protocol.h \
216         src/hardware/ikalogic-scanalogic2/protocol.c \
217         src/hardware/ikalogic-scanalogic2/api.c
218 endif
219 if HW_IKALOGIC_SCANAPLUS
220 libsigrok_la_SOURCES += \
221         src/hardware/ikalogic-scanaplus/protocol.h \
222         src/hardware/ikalogic-scanaplus/protocol.c \
223         src/hardware/ikalogic-scanaplus/api.c
224 endif
225 if HW_KECHENG_KC_330B
226 libsigrok_la_SOURCES += \
227         src/hardware/kecheng-kc-330b/protocol.h \
228         src/hardware/kecheng-kc-330b/protocol.c \
229         src/hardware/kecheng-kc-330b/api.c
230 endif
231 if HW_LASCAR_EL_USB
232 libsigrok_la_SOURCES += \
233         src/hardware/lascar-el-usb/protocol.h \
234         src/hardware/lascar-el-usb/protocol.c \
235         src/hardware/lascar-el-usb/api.c
236 endif
237 if HW_MANSON_HCS_3XXX
238 libsigrok_la_SOURCES += \
239         src/hardware/manson-hcs-3xxx/protocol.h \
240         src/hardware/manson-hcs-3xxx/protocol.c \
241         src/hardware/manson-hcs-3xxx/api.c
242 endif
243 if HW_MIC_985XX
244 libsigrok_la_SOURCES += \
245         src/hardware/mic-985xx/protocol.h \
246         src/hardware/mic-985xx/protocol.c \
247         src/hardware/mic-985xx/api.c
248 endif
249 if HW_MOTECH_LPS_30X
250 libsigrok_la_SOURCES += \
251         src/hardware/motech-lps-30x/protocol.h \
252         src/hardware/motech-lps-30x/protocol.c \
253         src/hardware/motech-lps-30x/api.c
254 endif
255 if HW_NORMA_DMM
256 libsigrok_la_SOURCES += \
257         src/hardware/norma-dmm/protocol.h \
258         src/hardware/norma-dmm/protocol.c \
259         src/hardware/norma-dmm/api.c
260 endif
261 if HW_OPENBENCH_LOGIC_SNIFFER
262 libsigrok_la_SOURCES += \
263         src/hardware/openbench-logic-sniffer/protocol.h \
264         src/hardware/openbench-logic-sniffer/protocol.c \
265         src/hardware/openbench-logic-sniffer/api.c
266 endif
267 if HW_RIGOL_DS
268 libsigrok_la_SOURCES += \
269         src/hardware/rigol-ds/protocol.h \
270         src/hardware/rigol-ds/protocol.c \
271         src/hardware/rigol-ds/api.c
272 endif
273 if HW_SALEAE_LOGIC16
274 libsigrok_la_SOURCES += \
275         src/hardware/saleae-logic16/protocol.h \
276         src/hardware/saleae-logic16/protocol.c \
277         src/hardware/saleae-logic16/api.c
278 endif
279 if HW_SERIAL_DMM
280 libsigrok_la_SOURCES += \
281         src/hardware/serial-dmm/protocol.h \
282         src/hardware/serial-dmm/protocol.c \
283         src/hardware/serial-dmm/api.c
284 endif
285 if HW_SYSCLK_LWLA
286 libsigrok_la_SOURCES += \
287         src/hardware/sysclk-lwla/lwla.h \
288         src/hardware/sysclk-lwla/lwla.c \
289         src/hardware/sysclk-lwla/protocol.h \
290         src/hardware/sysclk-lwla/protocol.c \
291         src/hardware/sysclk-lwla/api.c
292 endif
293 if HW_TELEINFO
294 libsigrok_la_SOURCES += \
295         src/hardware/teleinfo/protocol.h \
296         src/hardware/teleinfo/protocol.c \
297         src/hardware/teleinfo/api.c
298 endif
299 if HW_TESTO
300 libsigrok_la_SOURCES += \
301         src/hardware/testo/protocol.h \
302         src/hardware/testo/protocol.c \
303         src/hardware/testo/api.c
304 endif
305 if HW_TONDAJ_SL_814
306 libsigrok_la_SOURCES += \
307         src/hardware/tondaj-sl-814/protocol.h \
308         src/hardware/tondaj-sl-814/protocol.c \
309         src/hardware/tondaj-sl-814/api.c
310 endif
311 if HW_UNI_T_DMM
312 libsigrok_la_SOURCES += \
313         src/hardware/uni-t-dmm/protocol.h \
314         src/hardware/uni-t-dmm/protocol.c \
315         src/hardware/uni-t-dmm/api.c
316 endif
317 if HW_UNI_T_UT32X
318 libsigrok_la_SOURCES += \
319         src/hardware/uni-t-ut32x/protocol.h \
320         src/hardware/uni-t-ut32x/protocol.c \
321         src/hardware/uni-t-ut32x/api.c
322 endif
323 if HW_VICTOR_DMM
324 libsigrok_la_SOURCES += \
325         src/hardware/victor-dmm/protocol.h \
326         src/hardware/victor-dmm/protocol.c \
327         src/hardware/victor-dmm/api.c
328 endif
329 if HW_ZEROPLUS_LOGIC_CUBE
330 libsigrok_la_SOURCES += \
331         src/hardware/zeroplus-logic-cube/analyzer.c \
332         src/hardware/zeroplus-logic-cube/analyzer.h \
333         src/hardware/zeroplus-logic-cube/gl_usb.h \
334         src/hardware/zeroplus-logic-cube/gl_usb.c \
335         src/hardware/zeroplus-logic-cube/protocol.h \
336         src/hardware/zeroplus-logic-cube/protocol.c \
337         src/hardware/zeroplus-logic-cube/api.c
338 endif
339
340 libsigrok_la_LIBADD = $(LIBOBJS)
341
342 libsigrok_la_LDFLAGS = $(SR_LIB_LDFLAGS)
343
344 library_includedir = $(includedir)/libsigrok
345 library_include_HEADERS = \
346         include/libsigrok/libsigrok.h \
347         include/libsigrok/proto.h \
348         include/libsigrok/version.h
349 noinst_HEADERS = src/libsigrok-internal.h
350
351 pkgconfigdir = $(libdir)/pkgconfig
352 pkgconfig_DATA = libsigrok.pc
353
354 EXTRA_DIST = \
355         Doxyfile \
356         HACKING \
357         README.devices \
358         contrib/gnuplot_chronovu_la8.gpi \
359         contrib/gnuplot_rigol_ds1xx2.gpi \
360         contrib/gnuplot_usbeesx.gpi \
361         contrib/gnuplot_usbeedx8.gpi \
362         contrib/gnuplot_usbeedx16.gpi \
363         contrib/sigrok-logo-notext.png \
364         contrib/z60_libsigrok.rules
365
366 if HAVE_CHECK
367
368 TESTS = tests/check_main
369
370 check_PROGRAMS = ${TESTS}
371
372 tests_check_main_SOURCES = \
373         include/libsigrok/libsigrok.h \
374         tests/lib.c \
375         tests/lib.h \
376         tests/check_main.c \
377         tests/check_core.c \
378         tests/check_input_all.c \
379         tests/check_input_binary.c \
380         tests/check_output_all.c \
381         tests/check_session.c \
382         tests/check_strutil.c \
383         tests/check_version.c \
384         tests/check_driver_all.c
385
386 tests_check_main_CFLAGS = @check_CFLAGS@
387
388 tests_check_main_LDADD = $(top_builddir)/libsigrok.la @check_LIBS@
389
390 endif
391
392 BUILD_EXTRA =
393 INSTALL_EXTRA =
394 CLEAN_EXTRA =
395
396 if BINDINGS_CXX
397
398 lib_LTLIBRARIES += bindings/cxx/libsigrokxx.la
399
400 bindings_cxx_libsigrokxx_la_SOURCES = bindings/cxx/classes.cpp
401
402 bindings_cxx_libsigrokxx_la_LIBADD = libsigrok.la $(glibmm_LIBS)
403
404 bindings_cxx_libsigrokxx_la_LDFLAGS = $(SR_LIB_LDFLAGS)
405
406 library_include_HEADERS += \
407         bindings/cxx/include/libsigrok/libsigrok.hpp \
408         bindings/cxx/include/libsigrok/enums.hpp
409
410 pkgconfig_DATA += bindings/cxx/libsigrokxx.pc
411
412 doxy/xml/index.xml: include/libsigrok/libsigrok.h
413         $(AM_V_GEN)cd $(srcdir) && BUILDDIR=$(abs_builddir)/ doxygen Doxyfile 2>/dev/null
414
415 bindings/cxx/enums.cpp: bindings/cxx/enums.timestamp
416
417 bindings/cxx/include/libsigrok/enums.hpp: bindings/cxx/enums.timestamp
418
419 bindings/cxx/enums.timestamp: bindings/cxx/enums.py doxy/xml/index.xml \
420                 bindings/cxx/ConfigKey_methods.cpp bindings/cxx/QuantityFlag_methods.cpp
421         $(AM_V_GEN)python $< doxy/xml/index.xml
422         $(AM_V_at)touch $@
423
424 bindings/cxx/classes.lo: bindings/cxx/classes.cpp bindings/cxx/enums.cpp \
425                 $(library_include_HEADERS)
426
427 cxx-clean:
428         rm -rf doxy/
429         rm -rf bindings/cxx/doxy/
430         rm -f bindings/cxx/enums.cpp
431         rm -f bindings/cxx/include/libsigrok/enums.hpp
432         rm -f bindings/cxx/enums.timestamp
433
434 CLEAN_EXTRA += cxx-clean
435
436 endif
437
438 CPPXMLDOC = bindings/cxx/doxy/xml/index.xml
439
440 $(CPPXMLDOC): bindings/cxx/include/libsigrok/libsigrok.hpp \
441                 bindings/cxx/enums.timestamp
442         $(AM_V_GEN)cd $(srcdir)/bindings/cxx && BUILDDIR=$(abs_builddir)/bindings/cxx/ doxygen Doxyfile 2>/dev/null
443
444 if BINDINGS_PYTHON
445
446 PDIR = bindings/python
447 PDOC = bindings/python/sigrok/core/doc.i
448
449 $(PDOC): bindings/swig/doc.py $(CPPXMLDOC)
450         $(AM_V_at)test -d $(PDIR)/sigrok/core || mkdir -p $(PDIR)/sigrok/core
451         $(AM_V_GEN)python $< python $(CPPXMLDOC) > $@
452
453 python-build: $(PDIR)/timestamp
454
455 python-quietclean:
456         $(AM_V_at)cd $(PDIR) && python $(abs_srcdir)/$(PDIR)/setup.py --quiet clean --all 3>&1 1>&2 2>&3 \
457                 | grep -v "can.t clean it"; true
458
459 $(PDIR)/timestamp: bindings/cxx/libsigrokxx.la $(PDIR)/sigrok/core/classes.i \
460                 bindings/swig/classes.i $(PDOC) $(library_include_HEADERS)
461         $(AM_V_at)$(MAKE) python-quietclean
462         $(AM_V_GEN)cd $(PDIR) && python $(abs_srcdir)/$(PDIR)/setup.py --quiet build 3>&1 1>&2 2>&3 \
463                 | grep -v "command line option.*Wstrict-prototypes"; true
464         $(AM_V_at)touch $(PDIR)/timestamp
465
466 python-install:
467         cd $(PDIR) && python $(abs_srcdir)/$(PDIR)/setup.py --quiet install --prefix $(prefix)
468
469 python-clean:
470         $(AM_V_at)$(MAKE) python-quietclean
471         $(AM_V_at)rm -f $(PDIR)/timestamp
472         $(AM_V_at)rm -rf $(PDIR)/doxy/
473
474 python-doc:
475         $(AM_V_at)cd $(srcdir)/$(PDIR) && BUILDDIR=$(abs_builddir)/$(PDIR)/ doxygen Doxyfile 2>/dev/null
476
477 BUILD_EXTRA += python-build
478 INSTALL_EXTRA += python-install
479 CLEAN_EXTRA += python-clean
480
481 endif
482
483 if BINDINGS_JAVA
484
485 JDIR = bindings/java
486 JPKG = org/sigrok/core
487 JCLS = $(JDIR)/$(JPKG)/classes
488 JINT = $(JDIR)/$(JPKG)/interfaces
489 JSRC = $(JCLS)/*.java $(srcdir)/$(JINT)/*.java
490 JSWG = $(JCLS)/classes.i
491 JDOC = $(JCLS)/doc.i
492 JCXX = $(JCLS)/classes_wrap.cxx
493 JLIB = $(JDIR)/libsigrok_java_core_classes.so
494 JJAR = $(JDIR)/sigrok-core.jar
495
496 java-build: $(JJAR) $(JLIB)
497
498 $(JDOC): bindings/swig/doc.py $(CPPXMLDOC)
499         $(AM_V_at)test -d $(JCLS) || mkdir -p $(JCLS)
500         $(AM_V_GEN)python $< java $(CPPXMLDOC) > $@
501
502 $(JCXX): $(JSWG) $(JDOC) bindings/swig/classes.i $(library_include_HEADERS)
503         $(AM_V_GEN)swig -c++ -java -package org.sigrok.core.classes \
504                 -I$(srcdir)/include -I$(srcdir)/bindings/cxx/include -I$(srcdir) -I$(JCLS) -Ibindings/cxx/include -outdir $(JCLS) -o $@ $<
505
506 $(JJAR): $(JCXX)
507         $(AM_V_GEN)$(JAVAC) -sourcepath $(JDIR) -d $(JDIR) $(JSRC)
508         $(AM_V_at)jar cf $(JJAR) -C $(JDIR) $(JPKG)
509
510 $(JLIB): $(JCXX) bindings/cxx/libsigrokxx.la $(library_include_HEADERS)
511         $(AM_V_GEN)$(CXX) $(CXXFLAGS) -L.libs -Lbindings/cxx/.libs \
512                 -fno-strict-aliasing -fPIC -shared $(JCLS)/classes_wrap.cxx \
513                 -lsigrokxx -o $(JLIB)
514
515 java-install:
516         $(INSTALL) -d $(libdir)/jni
517         $(INSTALL) $(JLIB) -t $(libdir)/jni
518         $(INSTALL) -d $(datadir)/java
519         $(INSTALL) $(JJAR) -t $(datadir)/java
520
521 java-clean:
522         rm -f $(JCXX)
523         rm -f $(JCLS)/*.java
524         rm -f $(JCLS)/*.class
525         rm -f $(JINT)/*.class
526         rm -f $(JJAR)
527         rm -f $(JLIB)
528         rm -rf $(JDIR)/doxy/
529
530 java-doc:
531         $(AM_V_at)cd $(srcdir)/$(JDIR) && BUILDDIR=$(abs_builddir)/$(JDIR)/ doxygen Doxyfile 2>/dev/null
532
533 BUILD_EXTRA += java-build
534 INSTALL_EXTRA += java-install
535 CLEAN_EXTRA += java-clean
536
537 endif
538
539 all-local: $(BUILD_EXTRA)
540 install-exec-local: $(INSTALL_EXTRA)
541 clean-local: $(CLEAN_EXTRA)
542
543 MAINTAINERCLEANFILES = ChangeLog
544
545 .PHONY: ChangeLog
546 ChangeLog:
547         git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
548
549 dist-hook: ChangeLog
550