summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 4cdc79800d79ca19487aa454ff3f2a0af3660103 (plain)
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# Automake description for gpsd
# $Id$

#SUBDIRS = contrib

#
# Build stuff depending on Motif
#
if HAVE_MOTIF
MOTIF_PROGS = xgps xgpsspeed
endif

XMLTO = xmlto

if HAVE_DBUS
INCLUDES = $(DBUS_CFLAGS) $(DBUS_GLIB_CFLAGS) -DDBUS_API_SUBJECT_TO_CHANGE=1
DBUSPROGS = gpxlogger
gpxlogger_LDADD = $(DBUS_GLIB_LIBS) libgps.la  -lm
endif

if HAVE_RTCM104
RTCM104PROGS = rtcmdecode
RTCM104PAGES = rtcmdecode.1
endif


if HAVE_NCURSES
CURSESPROGS = cgps sirfmon
endif
bin_PROGRAMS = $(DBUSPROGS) $(MOTIF_PROGS) $(RTCM104PROGS) $(CURSESPROGS) gpsctl gpspipe gpsflash cgpxlogger 
sbin_PROGRAMS = gpsd
check_PROGRAMS = bits_test gpsmm_test packet_test
if HAVE_PYTHON
dist_bin_SCRIPTS = gpsprof gpsfake gpscat
python_PYTHON = gps.py gpsfake.py
nodist_python_PYTHON = gpspacket.so
PYTHONPAGES = gpsprof.1 gpsfake.1 gpscat.1
endif

#
# Build xgps
#
xgps_SOURCES = display.c display.h xgps.c
xgps_LDADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(XM_LIBS) $(XT_LIBS) $(X_LIBS) $(X_PRE_LIBS) libgps.la -lm $(LIBPTHREAD)

#
# Build xgpsspeed
#
xgpsspeed_c_sources = \
	xgpsspeed.c \
	Tachometer.c \
	TachometerP.h \
	Tachometer.h
xgpsspeed_SOURCES = \
	$(xgpsspeed_c_sources) \
	xgpsspeed.icon
xgpsspeed_LDADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(XAW_LIBS) $(XM_LIBS) $(X_LIBS) $(X_PRE_LIBS) libgps.la -lm $(LIBPTHREAD)

#
# Build cgps
#
cgps_SOURCES = cgps.c
cgps_LDADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) -lncurses libgps.la -lm $(LIBPTHREAD)

#
# Build cgpxlogger
#
cgpxlogger_SOURCES = cgpxlogger.c
cgpxlogger_LDADD = $(LIBC) $(LIBNSL) $(LIBSOCKET) libgps.la -lm $(LIBPTHREAD)

#
# Build gpsd
#
gpsd_c_sources = gpsd_dbus.c gpsd.c
gpsd_SOURCES = $(gpsd_c_sources) gpsd_dbus.h
gpsd_LDADD = $(DBUS_LIBS) $(LIBM) libgps.la -lm $(LIBPTHREAD)

#
# Build gpsctl
#
gpsctl_SOURCES = gpsctl.c
gpsctl_LDADD = $(LIBM) libgps.la -lm $(LIBPTHREAD)

#
# Build gpspipe
#
gpspipe_SOURCES = gpspipe.c
gpspipe_LDADD = $(DBUS_LIBS) $(LIBM) libgps.la -lm

#
# Build sirfmon
#
sirfmon_SOURCES = sirfmon.c
sirfmon_LDADD = $(LIBM) -lncurses libgps.la -lm $(LIBPTHREAD)

#
# Build rtcmdecode
#
rtcmdecode_SOURCES = rtcmdecode.c
rtcmdecode_LDADD = $(LIBM) libgps.la -lm $(LIBPTHREAD)

#
# Build gpsflash
#
gpsflash_SOURCES = gpsflash.c gpsflash.h sirfflash.c
gpsflash_LDADD = $(LIBM) libgps.la -lm

#
# Build shared libraries
#
libgps_la_LDFLAGS = -version-number 17:0:0
lib_LTLIBRARIES = libgps.la

libgpsd_c_sources = \
	netlib.c \
	nmea_parse.c \
	serial.c \
	libgpsd_core.c \
	subframe.c \
	ntpshm.c \
	libgps.c \
	packet.c \
	gpsutils.c \
	geoid.c \
	dgnss.c \
	dgpsip.c \
	ntrip.c \
	sirf.c \
	report.c \
	isgps.c \
	rtcm.c \
	rtcm.h \
	srecord.c \
	bsd-base64.c \
	strl.c \
	hex.c \
	drivers.c \
	zodiac.c \
	ubx.c \
	garmin.c \
	tsip.c \
	evermore.c \
	italk.c \
	navcom.c

libgpsd_h_sources = \
	italk.h \
	bsd-base64.h \
	timebase.h \
	bits.h \
	packet_names.h \
	gpsd.h 

BUILT_SOURCES = packet_names.h gpsd.h
packet_names.h: packet_states.h
	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

gpsd.h: gpsd.h-head gpsd.h-tail gpsd_config.h
	cp gpsd.h-head gpsd.h
	grep VERSION  gpsd_config.h >>gpsd.h
	grep ENABLE gpsd_config.h >>gpsd.h
	cat gpsd.h-tail >>gpsd.h

libgps_la_SOURCES = $(libgpsd_c_sources) $(libgpsd_h_sources) \
				rtcm.h libgpsmm.cpp packet_states.h
nodist_libgps_la_SOURCES = packet_names.h
libgps_la_LIBADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(LIBPTHREAD)

#
# Build Python binding
#
if HAVE_PYTHON
PYEXTENSIONS = gpspacket.so

noinst_SCRIPTS = gpspacket.so setup.py

gpspacket.so: gpspacket.c libgps.la
	(pwd="`pwd`"; cd $(srcdir) && $(PYTHON) setup.py build_ext --build-lib "$$pwd" --build-temp "$$pwd/build" --include-dirs "$$pwd")
endif
# Clean up after Python
clean-local:
	rm -rf build

#
# Build gpsmm_test
#
gpsmm_test_SOURCES = gpsmm_test.cpp
gpsmm_test_LDADD = $(LIBC) libgps.la -lm

#
# Build bits_test tester
#
bits_test_SOURCES = bits_test.c
bits_test_LDADD = $(LIBC) libgps.la

#
# Build packets tester
#
packet_test_SOURCES = packet_test.c
packet_test_LDADD = $(LIBC) libgps.la -lm

if HAVE_XSLT_PROCESSOR
#
# Create Manpages
#
man_MANS = \
	gpsd.8 \
	gps.1 \
	xgps.1 \
	xgpsspeed.1 \
	cgps.1 \
	cgpxlogger.1 \
	libgps.3 \
	libgpsmm.3 \
	libgpsd.3 \
	sirfmon.1 \
	$(RTCM104PAGES) \
	$(PYTHONPAGES) \
	gpsctl.1 \
	gpspipe.1 \
	gpsflash.1 \
	rtcm-104.5 \
	srec.5

.xml.1:
	$(MANGENERATOR) $(MANFLAGS) $(MANTARGET) $<

.xml.3:
	$(MANGENERATOR) $(MANFLAGS) $(MANTARGET) $<

.xml.5:
	$(MANGENERATOR) $(MANFLAGS) $(MANTARGET) $<

.xml.8:
	$(MANGENERATOR) $(MANFLAGS) $(MANTARGET) $<

gpsd.8: gpsd.xml

gps.1 xgps.1 xgpsspeed.1 cgps.1 cgpxlogger.1: gps.xml

libgps.3: libgps.xml

libgpsmm.3: libgpsmm.xml

libgpsd.3: libgpsd.xml

gpsctl.1: gpsctl.xml

gpscat.1: gpsctl.xml

gpsprof.1: gpsprof.xml

gpsfake.1: gpsfake.xml

sirfmon.1: sirfmon.xml

gpspipe.1: gpspipe.xml

rtcmdecode.1: rtcmdecode.xml

rtcm-104.5: rtcm-104.xml

srec.5: srec.xml

gpsflash.1: gpsflash.xml

endif

noinst_HEADERS = ubx.h
nodist_include_HEADERS = gpsd.h
include_HEADERS = gps.h libgpsmm.h

EXTRA_DIST = \
	autogen.sh \
	README \
	INSTALL \
	COPYING \
	TODO \
	AUTHORS \
	dgpsip-servers \
	floattest.c \
	gpsd.php \
	gpsd.xml \
	gps.xml \
	libgpsd.xml \
	libgps.xml \
	libgpsmm.xml \
	gpsprof.xml \
	gpsfake.xml \
	gpsctl.xml \
	sirfmon.xml \
	gpspipe.xml \
	rtcmdecode.xml \
	rtcm-104.xml \
	srec.xml \
	gpsflash.xml \
	$(man_MANS) \
	xgps.ad \
	xgpsspeed.ad \
	gpsd.spec.in \
	gpsd.spec \
	gpsd.hotplug \
	gpsd.usermap \
	valgrind-audit \
	valgrind-suppressions \
	gpspacket.c \
	driver_proto.c \
	logextract \
	striplog \
	setup.py \
	packet_states.h \
	libgps.pc.in \
	libgpsd.pc.in

CLEANFILES = $(BUILT_SOURCES) floattest *.core $(PYEXTENSIONS)

pkgconfig_DATA = libgps.pc libgpsd.pc
pkgconfigdir = $(libdir)/pkgconfig

# This is not distributed
libgps: libgps.c .libs/libgps.a
	$(CC) $(CFLAGS) -o libgps -lm -DTESTMAIN $(LIBPTHREAD) -g libgps.c .libs/libgps.a

# Report splint warnings
splint:
	@echo "Running splint on daemon and libraries..."
	-splint -redef $(gpsd_c_sources) $(libgpsd_c_sources)
	@echo "Running splint on xgps..."
	-splint -exportlocal $(xgps_SOURCES)
	@echo "Running splint on cgps..."
	-splint -exportlocal $(cgps_SOURCES)
	@echo "Running splint on xgpsspeed..."
	-splint -exportlocal $(xgpsspeed_c_sources)
	@echo "Running splint on gpsctl..."
	-splint $(gpsctl_SOURCES)
	@echo "Running splint on sirfmon..."
	-splint $(sirfmon_SOURCES)
	@echo "Running splint on gpspipe..."
	-splint $(gpspipe_SOURCES)
	@echo "Running splint on rtcmdecode..."
	-splint -exportlocal rtcmdecode.c
	@echo "Running splint on gpsflash..."
	-splint $(gpsflash_SOURCES)
	@echo "Running splint on bits_test test harness..."
	-splint $(bits_test_SOURCES)
	@echo "Running splint on packet_test test harness..."
	-splint $(packet_test_SOURCES)

version:
	@echo $(VERSION)
#
# This is how to tag a release for the SVN repository.
# It requires developer access verified via ssh.
#
REPO=http://svn.berlios.de/svnroot/repos/gpsd
svn-tag:
	svn copy $(REPO)/trunk $(REPO)/tags/release-$(VERSION) \
		-m "Tagged for external release $(VERSION)"

#
# Regression tests begin here
#
# Note that the *-makeregress targets re-create the *.log.chk source
# files from the *.log source files.

# Regression-test the daemon
# This requires gcc4; use of the math coprocessor's on-board trig functions
# apparently increases the accuracy of computation in a way that affects
# the low-order digits of the track field in the O response.  Alas, it looks
# like moving between 32- and 64-bit FPUs can also break regressions.
#
# When we have figured out the basic problem of these tests failing, we
# can "exit 1" in the error case.
gps-regress: gpsd 
	@echo "Testing the daemon..."
	@mkdir -p test
	@errors=0; total=0; \
	for f in $(srcdir)/test/*.log; do \
		env PATH=".:${PATH}" $(PYTHON) \
		$(srcdir)/gpsfake -s 38400 -1 -b -p $${f} \
		| grep -v "^GPSD,X" > test/test.chk; \
		if diff -ub $${f}.chk test/test.chk; then :; else \
			errors=`expr $$errors + 1`; \
		fi; \
		total=`expr $$total + 1`; \
	done; rm test/test.chk; \
	if test $$errors -gt 0; then \
		echo "Regression test FAILED: $$errors errors in $$total tests total."; \
		exit 0; \
	else \
		echo "Regression test successful: $$errors errors in $$total tests total."; \
		exit 0; \
	fi

# Test that super-raw mode works. Compare each logfile against itself 
# dumped through the daemon running in R=2 mode.  (This test is not
# included in the normal regressions.)
raw-regress:
	@echo "Testing super-raw mode..."
	@mkdir -p test
	@for f in test/*.log; do \
		env PATH=".:${PATH}" $(PYTHON) \
		$(srcdir)/gpsfake -s 38400 -1 -b -p -r "r=2" $${f} \
		| ./striplog -1 >test/test1.chk; \
		./striplog <$${f} >test/test2.chk; \
		cmp test/test[12].chk; \
	done; rm test/test[12].chk

# Build the regression tests for the daemon.
gps-makeregress: gpsd
	@for f in $(srcdir)/test/*.log; do \
		env PATH=".:${PATH}" $(PYTHON) \
		$(srcdir)/gpsfake -s 38400 -1 -b -p $${f} \
		| grep -v "^GPSD,X" >$${f}.chk; \
	done

# Regression-test the RTCM decoder.
rtcm-regress: rtcmdecode
	@echo "Testing RTCM decoding..."
	@mkdir -p test
	@for f in $(srcdir)/test/*.rtcm; do \
		echo "Testing $${f}..."; \
		./rtcmdecode <$${f} >test/test.chk; \
		diff -ub $${f}.chk test/test.chk; \
	done; \
	rm test/test.chk

# Rebuild the RTCM regression tests.
rtcm-makeregress: rtcmdecode
	@for f in $(srcdir)/test/*.rtcm; do \
		./rtcmdecode < $${f} > $${f}.chk; \
	done

# Regression-test the packet getter.
packet-regress: packet_test
	@echo "Testing detection of invalid packets..."
	@./packet_test | diff -u $(srcdir)/test/packet.test.chk -

# Rebuild the packet-getter regression test
packet-makeregress: packet_test
	@mkdir -p test
	./packet_test > test/packet.test.chk

# Test RTCM encoding using passthrough mode.
undump-regress: rtcmdecode
	@echo "Testing RTCM encoding..."
	@mkdir -p test
	@./rtcmdecode -p < $(srcdir)/test/undump.sample > test/undump.test
	@diff -u $(srcdir)/test/undump.sample test/undump.test
	@rm test/undump.test

# Do all normal regression tests
testregress: gps-regress rtcm-regress packet-regress undump-regress
	@echo "Regressions complete."