1 # Automake description for gpsd
3 # This file is Copyright (c) 2010 by the GPSD project
4 # BSD terms apply: see the file COPYING in the distribution root for details.
9 # For a detailed explanation of what this ugly code is doing, see
10 # http://www.gnu.org/software/automake/manual/automake.html#Multiple-Outputs
11 MULTIOUT_RECOVER_DELETED = \
12 if test -f '$@'; then :; else \
13 trap "rm -rf '$$WITNESS.lock' '$$WITNESS'" HUP INT PIPE TERM; \
14 if mkdir "$$WITNESS.lock" 2>/dev/null; then \
16 $(MAKE) $(AM_MAKEFLAGS) "$$WITNESS"; \
17 result=$$?; rm -rf "$$WITNESS.lock"; exit $$result; \
19 while test -d "$$WITNESS.lock"; do sleep 1; done; \
20 test -f "$$WITNESS"; \
29 # Conditionally add programs depending on libraries that may or may not be present.
32 CURSESPROGS = cgps gpsmon
35 # Conditional includes.
36 INCLUDES = $(LIBUSB_CFLAGS)
38 INCLUDES += $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) -DDBUS_API_SUBJECT_TO_CHANGE=1
41 INCLUDES += $(BLUEZ_CFLAGS)
44 RTCM104PAGES_DIST = gpsdecode.1
48 RTCM104PROGS = gpsdecode
49 RTCM104PAGES = $(RTCM104PAGES_DIST)
54 bin_PROGRAMS = $(XAW_PROGS) $(RTCM104PROGS) $(CURSESPROGS) gpsctl gpspipe gpxlogger lcdgps
57 # \todo Add programs to TESTS if not already. used.
58 check_PROGRAMS = test_float test_trig test_bits test_packet test_mkgmtime test_geoid test_json
60 check_PROGRAMS += test_gpsmm
63 check_PROGRAMS += test_qgpsmm
66 # List of Python scripts and modules, which are handled by setup.py.
67 # Required to ensure that the extensions/modules/scripts are rebuilt via
68 # setup.py in case they changed.
69 # Also used to specify which files to include during make dist.
70 PYTHONSCRIPTS_DIST = gpscat gpsfake gpsprof xgps xgpsspeed
71 PYTHONMODULES_DIST = gps/__init__.py gps/misc.py gps/fake.py gps/gps.py gps/client.py
73 PYTHONPAGES_DIST = gpsprof.1 gpsfake.1 gpscat.1 xgpsspeed.1 xgps.1
75 python_PYTHON = gpscap.py
76 PYTHONPAGES = $(PYTHONPAGES_DIST)
84 cgps_LDADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(NCURSES_LIBS) libgps.la -lm $(LIBPTHREAD)
89 gpxlogger_SOURCES = gpxlogger.c
90 gpxlogger_LDADD = $(DBUS_GLIB_LIBS) libgps.la -lm
95 gpsd_c_sources = gpsd_dbus.c gpsd.c
96 gpsd_SOURCES = $(gpsd_c_sources) gpsd_dbus.h
97 gpsd_LDADD = $(DBUS_LIBS) $(LIBM) libgpsd.la libgps.la -lm $(LIBPTHREAD) $(LIBUSB_LIBS)
102 gpsctl_SOURCES = gpsctl.c
103 gpsctl_LDADD = $(LIBM) libgpsd.la libgps.la -lm $(LIBPTHREAD) $(LIBUSB_LIBS)
108 gpspipe_SOURCES = gpspipe.c
109 gpspipe_LDADD = $(DBUS_LIBS) $(LIBM) libgps.la -lm
114 lcdgps_SOURCES = lcdgps.c
115 lcdgps_LDADD = $(LIBM) libgps.la -lm
120 gpsmon_SOURCES = gpsmon.c monitor_nmea.c monitor_sirf.c \
121 monitor_italk.c monitor_ubx.c monitor_superstar2.c \
122 monitor_oncore.c monitor_tnt.c
123 gpsmon_LDADD = $(LIBM) $(NCURSES_LIBS) libgpsd.la libgps.la -lm $(LIBPTHREAD) $(LIBUSB_LIBS)
128 gpsdecode_SOURCES = gpsdecode.c
129 gpsdecode_LDADD = $(LIBM) libgpsd.la libgps.la -lm $(LIBPTHREAD) $(LIBUSB_LIBS)
132 # Build shared libraries
134 # As we need to retrieve the version from qmake to build the Qt library,
135 # we provide targets to print the necessary informations.
136 libgps_VERSION_CURRENT = 19
137 libgps_VERSION__REVISION = 0
138 libgps_VERSION_AGE = 0
139 libgps_VERSION_NUMBER = $(libgps_VERSION_AGE):$(libgps_VERSION__REVISION):$(libgps_VERSION_AGE)
140 libgps_la_LDFLAGS = -version-number $(libgps_VERSION_CURRENT):$(libgps_VERSION__REVISION):$(libgps_VERSION_AGE)
141 lib_LTLIBRARIES = libgps.la libgpsd.la
143 libgps_SONAME = $(shell expr $(libgps_VERSION_CURRENT) - $(libgps_VERSION_AGE))
144 libgps_VERSION = $(libgps_SONAME).$(libgps_VERSION_AGE).$(libgps_VERSION__REVISION)
145 print_libgps_VERSION_CURRENT:
146 echo $(libgps_VERSION_CURRENT)
147 print_libgps_VERSION__REVISION:
148 echo $(libgps_VERSION__REVISION)
149 print_libgps_VERSION_AGE:
150 echo $(libgps_VERSION_AGE)
152 echo $(libgps_SONAME)
153 print_libgps_VERSION:
154 echo $(libgps_VERSION)
172 libgpsd_c_sources = \
181 net_gnss_dispatch.c \
193 driver_garmin_txt.c \
201 driver_superstar2.c \
206 libgpsd_h_sources = \
213 BUILT_SOURCES = packet_names.h gpsd.h revision.h ais_json.i gps_maskdump.c gpsd_maskdump.c
215 packet_names.h: packet_states.h
216 rm -f packet_names.h && \
217 sed -e '/^ *\([A-Z][A-Z0-9_]*\),/s// "\1",/' -e '/_states/s//_names/' < `test -f 'packet_states.h' || echo '$(srcdir)/'`packet_states.h > packet_names.h && \
218 chmod a-w packet_names.h
220 gpsd.h: gpsd.h-head gpsd.h-tail gpsd_config.h
222 echo "/* This file is generated. Do not hand-hack it! */" >gpsd.h && \
223 cat $(srcdir)/gpsd.h-head >>gpsd.h && \
224 cat $(srcdir)/gpsd_config.h >>gpsd.h && \
225 cat $(srcdir)/gpsd.h-tail >>gpsd.h && \
228 ais_json.i: jsongen.py
229 rm -f ais_json.i && \
230 $(PYTHON) jsongen.py --ais --target=parser >ais_json.i && \
234 @rm -f revision.h && \
235 echo '#define' REVISION '"'`date -u +%Y-%m-%dT%H:%M:%S`'"' >revision.h && \
238 gps_maskdump.c: gps.h maskaudit.py
239 rm -f gps_maskdump.c && \
240 $(PYTHON) maskaudit.py -c >gps_maskdump.c && \
241 chmod a-w gps_maskdump.c
243 gpsd_maskdump.c: gpsd.h maskaudit.py
244 rm -f gpsd_maskdump.c && \
245 $(PYTHON) maskaudit.py -d >gpsd_maskdump.c && \
246 chmod a-w gpsd_maskdump.c
248 libgps_la_SOURCES = $(libgps_c_sources)
250 libgpsd_la_SOURCES = $(libgpsd_c_sources) $(libgpsd_h_sources) \
251 driver_rtcm2.h packet_states.h
253 # Warning: This overrides autoconf's normal link-line generation process
255 libgps_la_SOURCES += libgpsmm.cpp
256 libgps_la_LINK = /bin/sh ./libtool --tag=CXX --mode=link g++ $(libgps_la_LDFLAGS) -o $@
258 libgps_la_LINK = /bin/sh ./libtool --tag=CC --mode=link gcc $(libgps_la_LDFLAGS) -o $@
261 nodist_libgpsd_la_SOURCES = packet_names.h ais_json.i
262 libgps_la_LIBADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(LIBPTHREAD)
263 libgpsd_la_LIBADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(LIBPTHREAD) $(BLUEZ_LIBS) libgps.la
267 # Build Python binding
270 PYEXTENSIONS = gpspacket.so gpslib.so
271 noinst_SCRIPTS += stamp-python setup.py
273 # Multiple-outputs hack. See
274 # http://www.gnu.org/software/automake/manual/automake.html#Multiple-Outputs
275 $(PYEXTENSIONS): stamp-python
276 +@WITNESS=stamp-python; $(MULTIOUT_RECOVER_DELETED)
277 # TODO: Should the dependency on libgps.la be enforced inside
278 # setup.py? (See the variable 'needed_files' in setup.py.)
279 stamp-python: gpspacket.c gpsclient.c libgps.la setup.py $(PYTHONMODULES_DIST) $(PYTHONSCRIPTS_DIST)
280 # Build Python modules and scripts using distutils via setup.py.
281 # We define build-lib and build-scripts as distutils might have been
282 # configured to use different directories, but we want to use the
283 # produced files within the regress-driver script - therefore we
284 # need to build them in directories we know about.
285 # See configure.ac for the definition of PYTHON_DISTUTILS_LIBDIR
286 # and PYTHON_DISTUTILS_SCRIPTDIR.
288 @echo 'timestamp for $@' > '$@.tmp'
290 env abs_builddir='$(abs_builddir)' \
292 $(PYTHON) setup.py build \
293 --build-lib '$(srcdir)/$(PYTHON_DISTUTILS_LIBDIR)' \
294 --build-scripts '$(srcdir)/$(PYTHON_DISTUTILS_SCRIPTDIR)' \
295 --mangenerator '$(XMLPROC)') && \
296 (cd '$(srcdir)/gps' && \
298 ln -s ../$(PYTHON_DISTUTILS_LIBDIR)/gps/*.so . ) && \
300 CLEANFILES += stamp-python stamp-python.tmp
303 QTLIB_DIST = libQgpsmm/libQgpsmm.pro \
304 libQgpsmm/gpsutils.cpp \
305 libQgpsmm/libgps_core.cpp \
306 libQgpsmm/libQgpsmm_global.h
308 QTLIB_DIST_MINGW = libQgpsmm/mingw/gpsd_config.h \
309 libQgpsmm/mingw/test_qgpsmm.pro
311 if LIB_Q_GPSMM_ENABLE
312 noinst_SCRIPTS += stamp-qt
313 QTLIBS = libQgpsmm/binaries/libQgpsmm.so \
314 libQgpsmm/binaries/libQgpsmm.so.$(libgps_SONAME) \
315 libQgpsmm/binaries/libQgpsmm.so.$(libgps_SONAME).$(libgps_VERSION_AGE) \
316 libQgpsmm/binaries/libQgpsmm.so.$(libgps_VERSION)
318 QTLIB_sources = gpsutils.c \
337 QMAKE_OPTS = "PREFIX=${prefix}" \
341 "QMAKE_CFLAGS+=$(CFLAGS)" \
342 "QMAKE_LFLAGS+=$(LDFLAGS)" \
343 "VERSION=$(libgps_VERSION)" \
344 "TARGET_LIBDIR=${libdir}" \
345 "TARGET_INCLUDEDIR=${includedir}"
347 libQgpsmm/Makefile: libQgpsmm/libQgpsmm.pro gpsd.h ais_json.i
348 cd $(srcdir)/libQgpsmm && $(QMAKE) $(QMAKE_OPTS)
349 # Yet another multiple-outputs hack:
351 +@WITNESS=stamp-qt; $(MULTIOUT_RECOVER_DELETED)
352 stamp-qt: $(QTLIB_sources) libQgpsmm/Makefile
353 $(MAKE) -C $(srcdir)/libQgpsmm
355 CLEANFILES += stamp-qt
358 # Clean up after Python and QT
361 rm -rf build gps/*.so
363 if LIB_Q_GPSMM_ENABLE
364 if test -r $(srcdir)/libQgpsmm/Makefile; then \
365 $(MAKE) -C $(srcdir)/libQgpsmm distclean || true; \
367 rm -rf $(srcdir)/libQgpsmm/binaries
368 rm -f $(srcdir)/libQgpsmm/*.o $(srcdir)/libQgpsmm/Makefile
371 # Install Python modules and QT library
374 # Make sure we do not use --root as option to setup.py install
375 # when DESTDIR is not defined as distutils would use the current
376 # working directory as root directory and not install to ${prefix}.
377 if test -z "$(DESTDIR)"; then \
378 $(PYTHON) setup.py install --prefix=${prefix} ;\
380 $(PYTHON) setup.py install --prefix=${prefix} --root=$(DESTDIR) ;\
383 if LIB_Q_GPSMM_ENABLE
384 $(MAKE) -C libQgpsmm install INSTALL_ROOT=$(DESTDIR)
390 test_float_SOURCES = test_float.c
391 test_float_LDADD = $(LIBC) -lm
396 test_trig_SOURCES = test_trig.c
397 test_trig_LDADD = $(LIBC) -lm
403 test_gpsmm_SOURCES = test_gpsmm.cpp
404 test_gpsmm_LDADD = $(LIBC) libgps.la -lm $(LIBUSB_LIBS)
407 if LIB_Q_GPSMM_ENABLE
411 test_qgpsmm_SOURCES = test_gpsmm.cpp
412 test_qgpsmm_LDFLAGS = -Wl,-rpath,$(srcdir)/libQgpsmm/binaries
413 test_qgpsmm_LDADD = $(LIBC) $(LIBUSB) $(QtNetwork_LIBS) -LlibQgpsmm/binaries -lQgpsmm
414 test_qgpsmm_DEPENDENCIES = libQgpsmm/binaries/libQgpsmm.so
418 # Build test_bits tester
420 test_bits_SOURCES = test_bits.c
421 test_bits_LDADD = $(LIBC) libgpsd.la libgps.la $(LIBUSB_LIBS)
424 # Build packets tester
426 test_packet_SOURCES = test_packet.c
427 test_packet_LDADD = $(LIBC) libgpsd.la libgps.la -lm $(LIBUSB_LIBS)
430 # Build geoid model tester
432 test_geoid_SOURCES = test_geoid.c
433 test_geoid_LDADD = $(LIBC) libgps.la -lm
436 # Build time functions tester
438 test_mkgmtime_SOURCES = test_mkgmtime.c
439 test_mkgmtime_LDADD = $(LIBC) libgps.la -lm
442 # Build JSON parse tester
443 test_json_SOURCES = test_json.c
444 test_json_LDADD = $(LIBC) libgps.la -lm
460 if HAVE_XSLT_PROCESSOR
463 $(RTCM104PAGES_DIST) \
474 BUILT_MANPAGES = $(MANPAGES_DIST)
477 $(XMLPROC) $(XMLPROCFLAGS) $(MANTARGET) $<
480 $(XMLPROC) $(XMLPROCFLAGS) $(MANTARGET) $<
483 $(XMLPROC) $(XMLPROCFLAGS) $(MANTARGET) $<
486 $(XMLPROC) $(XMLPROCFLAGS) $(MANTARGET) $<
488 # Another instance of the multiple-outputs hack.
489 gps.1 xgps.1 xgpsspeed.1 cgps.1 lcdgps.1: stamp-gps-manpages
490 +@WITNESS=stamp-gps-manpages; $(MULTIOUT_RECOVER_DELETED)
491 stamp-gps-manpages: gps.xml
493 echo 'timestamp for $@' > '$@.tmp' && \
494 $(XMLPROC) $(XMLPROCFLAGS) $(MANTARGET) '$(srcdir)/gps.xml' && \
496 CLEANFILES += stamp-gps-manpages stamp-gps-manpages.tmp
499 noinst_HEADERS = gpsd_config.h \
500 driver_italk.h driver_rtcm2.h driver_superstar2.h \
501 driver_ubx.h gpsmon.h gpsdclient.h json.h gps_json.h \
502 revision.h TachometerP.h Tachometer.h
503 nodist_include_HEADERS = gpsd.h
506 include_HEADERS = gps.h libgpsmm.h
508 include_HEADERS = gps.h
527 # Note: packaging/rpm/gpsd.spec is generated, but it needs to be in the
528 # tarball in order for 'make dist-rpm' to work. The BUILT_SOURCES
529 # files are here in order to minimize build dependencies for package
530 # builders who never alter anything, especially the Python dependency.
531 # Also note that the test and gps directories are here rather than
532 # being the contents of a SUBDIRS variable so that autconf won't
533 # go looking for makefiles in them.
557 gpsd.hotplug.wrapper \
560 valgrind-suppressions \
570 packaging/deb/etc_default_gpsd \
571 packaging/deb/etc_init.d_gpsd \
572 packaging/rpm/gpsd.spec \
573 packaging/rpm/gpsd.init \
574 packaging/rpm/gpsd.sysconfig \
575 packaging/X11/xgps.desktop \
576 packaging/X11/xgpsspeed.desktop \
577 packaging/X11/gpsd-logo.png \
580 $(PYTHONSCRIPTS_DIST) \
581 $(PYTHONMODULES_DIST) \
583 $(QTLIB_DIST_MINGW) \
587 # Prepare necessary files to build the mingw-port of libQgpsmm
588 # while creating the dist tarball.
589 dist-hook: ais_json.i gpsd_config.h
590 $(MKDIR_P) '$(distdir)/libQgpsmm/mingw'
591 cp -p ais_json.i $(distdir)/libQgpsmm/mingw
592 grep "#define VERSION" gpsd_config.h > $(distdir)/libQgpsmm/mingw/version.h
593 echo "VERSION=$(libgps_VERSION)" > $(distdir)/libQgpsmm/mingw/version.pri
595 rm -f $(distdir)/libQgpsmm/mingw/version.* $(distdir)/libQgpsmm/mingw/ais_json.i
598 CLEANFILES += $(BUILT_SOURCES) *.core $(PYEXTENSIONS) $(BUILT_MANPAGES)
600 pkgconfig_DATA = libgps.pc libgpsd.pc
601 pkgconfigdir = $(libdir)/pkgconfig
603 # These are not distributed
604 libgps: libgps_core.c gps.h .libs/libgps.a
605 $(CC) $(CFLAGS) -o libgps -lm -DTESTMAIN $(LIBPTHREAD) -g libgps_core.c .libs/libgps.a
607 # Report splint warnings
608 SPLINTOPTS = -I/usr/include/dbus-1.0/ $(LIBUSB_CFLAGS) +quiet
609 splint: gpsd.h packet_names.h
610 @echo "Running splint on daemon and libraries..."
611 -splint $(SPLINTOPTS) -exportlocal -redef $(gpsd_c_sources) $(libgpsd_c_sources) $(libgps_c_sources)
612 @echo "Running splint on cgps..."
613 -splint $(SPLINTOPTS) -exportlocal $(cgps_SOURCES)
614 @echo "Running splint on gpsctl..."
615 -splint $(SPLINTOPTS) $(gpsctl_SOURCES)
616 @echo "Running splint on gpsmon..."
617 -splint $(SPLINTOPTS) -exportlocal $(gpsmon_SOURCES)
618 @echo "Running splint on gpspipe..."
619 -splint $(SPLINTOPTS) $(gpspipe_SOURCES)
620 @echo "Running splint on gpsdecode..."
621 -splint $(SPLINTOPTS) $(gpsdecode_SOURCES)
622 @echo "Running splint on gpxlogger..."
623 -splint $(SPLINTOPTS) $(gpxlogger_SOURCES)
624 @echo "Running splint on test_bits test harness..."
625 -splint $(SPLINTOPTS) $(test_bits_SOURCES)
626 @echo "Running splint on test_packet test harness..."
627 -splint $(SPLINTOPTS) $(test_packet_SOURCES)
628 @echo "Running splint on test_mkgmtime test harness..."
629 -splint $(SPLINTOPTS) $(test_mkgmtime_SOURCES)
630 @echo "Running splint on test_geoid test harness..."
631 -splint $(SPLINTOPTS) $(test_geoid_SOURCES)
632 @echo "Running splint on test_json test harness..."
633 -splint $(SPLINTOPTS) $(test_json_SOURCES)
635 # Report cppcheck warnings. Requires 1.40 or later.
636 cppcheck: gpsd.h packet_names.h
637 cppcheck --template gcc --all --force .
639 # Check the documentation for bogons, too
641 for xml in $(XML); do xmllint --nonet --noout --valid $$xml; done
643 # Re-indent the codebase in a uniform style for readability.
644 INDENT_FILES = $(gpsd_c_sources) $(libgpsd_c_sources) $(libgps_c_sources) \
645 $(cgps_SOURCES) $(gpsmon_SOURCES) $(gpspipe_SOURCES) \
646 $(gpxlogger_SOURCES) $(gpsdecode_SOURCES) \
647 $(test_bits_SOURCES) $(test_packet_SOURCES) \
648 $(test_mkgmtime_SOURCES) $(test_geoid_SOURCES) $(test_json_SOURCES)
649 INDENT_OPTIONS = --indent-level4 \
651 --dont-break-procedure-type \
653 --braces-on-if-line \
654 --case-brace-indentation0 \
656 --no-space-after-casts \
657 --no-space-after-function-call-names \
658 --start-left-side-of-comments \
659 --dont-format-comments
661 chmod u+w *maskdump.c
662 indent $(INDENT_OPTIONS) $(INDENT_FILES)
663 for f in $(INDENT_FILES); \
665 sed <$${f} >/tmp/reindent$$$$ -e 's/@ \*/@*/' ; \
666 mv /tmp/reindent$$$$ $${f} ; \
668 chmod u-w *maskdump.c
669 @echo "Diff lines:" `git diff | wc -l`
675 # Regression tests begin here
677 # Note that the *-makeregress targets re-create the *.log.chk source
678 # files from the *.log source files.
680 # These require gcc4; use of the math coprocessor's on-board trig functions
681 # apparently increases the accuracy of computation in a way that affects
682 # the low-order digits of the track field in the O response.
684 # Our regression tests are make targets, while automake expects
685 # programs. Thus, our approach is to construct the test
686 # infrastructure our way, with make targets, and to have one TEST from
687 # automake's viewpoint: a trivial shell script to invoke make with our
688 # top-level regression target.
690 # One might think that using TESTS_ENVIRONMENT=$(MAKE) would work
691 # around this, but because the generated rule (check-TESTS) both
692 # depends on each TEST as well as invokes it (with TESTS_ENVIRONMENT)
693 # the entire list of tests is run twice.
695 # Use make REGRESSOPTS=-u to force running with UDP rather than pty devices
697 run_regress_driver = PYTHON=$(PYTHON) $(srcdir)/regress-driver $(REGRESSOPTS)
699 # Regression-test the daemon
700 gps-regress: gpsd stamp-python
701 $(run_regress_driver) $(srcdir)/test/daemon/*.log
703 # Test that super-raw mode works. Compare each logfile against itself
704 # dumped through the daemon running in R=2 mode. (This test is not
705 # included in the normal regressions.)
706 raw-regress: stamp-python
707 $(run_regress_driver) -r $(srcdir)/test/daemon/*.log
709 # Build the regression tests for the daemon.
710 gps-makeregress: gpsd stamp-python
711 $(run_regress_driver) -b $(srcdir)/test/daemon/*.log
713 # To build an individual test for a load named foo.log, put it in
714 # test/daemon and do this:
715 # regress-driver -b test/daemon/foo.log
717 # Regression-test the RTCM decoder.
718 rtcm-regress: gpsdecode
719 @echo "Testing RTCM decoding..."
721 @for f in $(srcdir)/test/*.rtcm2; do \
722 echo "Testing $${f}..."; \
723 $(srcdir)/gpsdecode <$${f} >/tmp/test-$$$$.chk; \
724 diff -ub $${f}.chk /tmp/test-$$$$.chk; \
726 @echo "Testing idempotency of JSON dump/decode for RTCM2"
727 @$(srcdir)/gpsdecode -e -j <test/synthetic-rtcm2.json >/tmp/test-$$$$.chk; \
728 grep -v '^#' test/synthetic-rtcm2.json | diff -ub - /tmp/test-$$$$.chk; \
729 rm /tmp/test-$$$$.chk
731 # Rebuild the RTCM regression tests.
732 rtcm-makeregress: gpsdecode
733 @for f in $(srcdir)/test/*.rtcm2; do \
734 $(srcdir)/gpsdecode -j < $${f} > $${f}.chk; \
737 # Regression-test the AIVDM decoder.
738 aivdm-regress: gpsdecode
739 echo "Testing AIVDM decoding..."
740 @mkdir -p $(srcdir)/test
741 @for f in $(srcdir)/test/*.aivdm; do \
742 echo "Testing $${f}..."; \
743 $(srcdir)/gpsdecode -u -c <$${f} >/tmp/test-$$$$.chk; \
744 diff -ub $${f}.chk /tmp/test-$$$$.chk; \
746 @echo "Testing idempotency of JSON dump/decode for AIS"
747 @$(srcdir)/gpsdecode -e -j <$(srcdir)/test/synthetic-ais.json >/tmp/test-$$$$.chk; \
748 grep -v '^#' $(srcdir)/test/synthetic-ais.json | diff -ub - /tmp/test-$$$$.chk; \
749 rm /tmp/test-$$$$.chk
751 # Rebuild the AIVDM regression tests.
752 aivdm-makeregress: gpsdecode
753 @for f in $(srcdir)/test/*.aivdm; do \
754 $(srcdir)/gpsdecode -u -c <$${f} > $${f}.chk; \
757 # Regression-test the packet getter.
758 packet-regress: test_packet
759 @echo "Testing detection of invalid packets..."
760 @$(srcdir)/test_packet | diff -u $(srcdir)/test/packet.test.chk -
762 # Rebuild the packet-getter regression test
763 packet-makeregress: test_packet
764 @mkdir -p $(srcdir)/test
765 $(srcdir)/test_packet >$(srcdir)/test/packet.test.chk
767 # Regression-test the geoid tester.
768 geoid-regress: test_geoid
769 @echo "Testing the geoid model..."
770 @$(srcdir)/test_geoid 37.371192 122.014965 | diff -u $(srcdir)/test/geoid.test.chk -
772 # Rebuild the packet-getter regression test
773 geoid-makeregress: test_geoid
774 @mkdir -p $(srcdir)/test
775 $(srcdir)/test_geoid 37.371192 122.014965 >$(srcdir)/test/geoid.test.chk
777 # Regression-test the calendar functions
778 time-regress: test_mkgmtime
779 $(srcdir)/test_mkgmtime
781 # Regression test the unpacking code in libgps
782 unpack-regress: libgps
783 @echo "Testing the client-library sentence decoder..."
784 $(run_regress_driver) -c $(srcdir)/test/clientlib/*.log
786 # Build the regression test for the sentence unpacker
787 unpack-makeregress: libgps
788 @echo "Rebuilding the client sentence-unpacker tests..."
789 $(run_regress_driver) -c -b $(srcdir)/test/clientlib/*.log
791 # Unit-test the JSON parsing
792 json-regress: test_json
795 # Unit-test the bitfield extractor - not in normal tests
796 bits-regress: test_bits
799 # Do all normal regression tests.
800 testregress: gps-regress rtcm-regress aivdm-regress packet-regress time-regress unpack-regress json-regress
801 @echo "Regressions complete."
803 # do-tests is a shell script that invokes make with target testregress.
804 # This works around automake's lack of support for make targets as tests.
805 TESTS_ENVIRONMENT = MAKE=$(MAKE) PYTHON=$(PYTHON)
808 # The website directory
810 # None of these productions are fired by 'make all'.
814 $(XMLPROC) $(XMLPROCFLAGS) $(HTMLTARGET) $< >$(<:.xml=.html) ; cp $(<:.xml=.html) $@
817 $(XMLPROC) $(XMLPROCFLAGS) $(HTMLTARGET) $<; cp $(<:.xml=.html) $@
820 website: www/gpscat.html www/gpsctl.html www/gpsdecode.html \
821 www/gpsd.html www/gpsfake.html www/gpsmon.html \
822 www/gpspipe.html www/gpsprof.html www/gps.html \
823 www/libgpsd.html www/libgpsmm.html www/libgps.html \
824 www/rtcm-104.html www/srec.html \
825 www/AIVDM.html www/NMEA.html \
826 www/protocol-evolution.html www/protocol-transition.html \
827 www/client-howto.html www/writing-a-driver.html \
828 www/index.html www/hardware.html \
829 www/performance/performance.html \
832 www/AIVDM.html: www/AIVDM.txt
833 asciidoc -a toc -o www/AIVDM.html www/AIVDM.txt
835 www/NMEA.html: www/NMEA.txt
836 asciidoc -a toc -o www/NMEA.html www/NMEA.txt
838 www/protocol-evolution.html: www/protocol-evolution.txt
839 asciidoc -a toc -o www/protocol-evolution.html www/protocol-evolution.txt
841 www/protocol-transition.html: www/protocol-transition.txt
842 asciidoc -a toc -o www/protocol-transition.html www/protocol-transition.txt
844 www/client-howto.html: www/client-howto.txt
845 asciidoc -a toc -o www/client-howto.html www/client-howto.txt
847 www/writing-a-driver.html: www/writing-a-driver.xml
848 xmlto xhtml-nochunks www/writing-a-driver.xml; mv writing-a-driver.html www
850 www/index.html: www/index.html.in
851 sed -e "/@DATE@/s//`date '+%B %d, %Y'`/" <www/index.html.in >www/index.html
853 www/hardware.html: www/hardware-head.html gpscap.ini www/hardware-tail.html
854 (cat www/hardware-head.html; python gpscap.py; cat www/hardware-tail.html) >www/hardware.html
856 www/performance/performance.html: www/performance/performance.xml
857 (cd www/performance; xmlto xhtml-nochunks performance.xml)
859 www/internals.html: $(shell ls doc/*.xml)
860 cd doc; xmlto xhtml-nochunks explanation.xml; cp explanation.html ../www/internals.html
863 # Experimenting with pydoc. Not yet fired by any other productions.
865 pydoc: www/pydoc/index.html
867 # We need to run epydoc with the Python version we built the modules for.
868 # So we define our on epydoc instead of using /usr/bin/epydoc
869 EPYDOC = $(PYTHON) -c 'from epydoc.cli import cli; cli()'
871 # We have pre-compiled python scripts in the script directory, so we exclude
872 # all files ending on c here. Needs a better solution as soon as we have a
873 # script ending with c.
874 EPYDOCSCRIPTS = $(shell find $(PYTHON_DISTUTILS_SCRIPTDIR) -name '*c' -o -type f -print)
875 EPYDOCMODULES = $(PYTHON_DISTUTILS_LIBDIR)/gps
877 www/pydoc/index.html: gps gpsfake gpscat gpsprof stamp-python
879 $(EPYDOC) -v --html --graph all -n GPSD $(EPYDOCSCRIPTS) $(EPYDOCMODULES) -o www/pydoc
883 # Productions for setting up and performing udev tests.
885 # Requires root. Do "udev-install", then "tail -f /var/run/syslog" in
886 # another window, then run 'make udev-test', then plug and unplug the
887 # GPS ad libitum. All is well when you get fix reports each time a GPS
891 cp $(srcdir)/gpsd.rules /lib/udev/rules.d/025_gpsd.rules
892 cp $(srcdir)/gpsd.hotplug $(srcdir)/gpsd.hotplug.wrapper /lib/udev/
893 chmod a+x /lib/udev/gpsd.hotplug /lib/udev/gpsd.hotplug.wrapper
896 rm -f /lib/udev/{gpsd.hotplug,gpsd.hotplug.wrapper}
897 rm -f /lib/udev/rules.d/025_gpsd.rules
900 $(srcdir)/gpsd -N -F /var/run/gpsd.sock -D 4
902 # Release machinery begins here
905 # Make RPM from the specfile in packaging
907 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
908 rpmbuild -ta $(distdir).tar.gz
909 $(am__remove_distdir)
911 # This is how to ship a release to Berlios incoming.
912 # It requires developer access verified via ssh.
915 shasum gpsd-$(VERSION).tar.gz >gpsd.sum
916 lftp -c "open ftp://ftp.berlios.de/incoming; mput gpsd-$(VERSION).tar.gz gpsd.sum"
919 # This is how to tag a release.
920 # It requires developer access verified via ssh.
923 git tag -s -m "Tagged for external release $(VERSION)" release-$(VERSION)
927 # Ship a release, providing all regression tests pass.
928 # The clean is necessary so that dist will remake revision.h
929 # with the current revision level in it.
931 ship: testregress clean dist upload-ftp release-tag
934 .PHONY: print_libgps_VERSION_CURRENT \
935 print_libgps_VERSION__REVISION \
936 print_libgps_VERSION_AGE \
937 print_libgps_SONAME \
938 print_libgps_VERSION \