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