1# $Id$
2#
3# This file is part of avahi.
4# 
5# avahi is free software; you can redistribute it and/or modify it
6# under the terms of the GNU Lesser General Public License as
7# published by the Free Software Foundation; either version 2 of the
8# License, or (at your option) any later version.
9#
10# avahi is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13# License for more details.
14#
15# You should have received a copy of the GNU Lesser General Public
16# License along with avahi; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18# USA.
19
20AM_CFLAGS=-I$(top_srcdir)
21
22# This cool debug trap works on i386/gcc only
23AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
24
25if HAVE_LIBDAEMON
26if HAVE_XML
27
28pkgsysconfdir=$(sysconfdir)/avahi
29servicedir=$(pkgsysconfdir)/services
30introspectiondir=$(pkgdatadir)/introspection
31
32AM_CFLAGS+= \
33	-DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
34	-DAVAHI_SOCKET=\"$(avahi_socket)\" \
35	-DAVAHI_SERVICE_DIR=\"/etc/avahi/services\" \
36	-DAVAHI_CONFIG_FILE=\"/etc/avahi/avahi-daemon.conf\" \
37	-DAVAHI_HOSTS_FILE=\"/etc/avahi/hosts\" \
38	-DAVAHI_DBUS_INTROSPECTION_DIR=\"$(introspectiondir)\" \
39	-DAVAHI_CONFIG_DIR=\"/etc/avahi\"
40
41sbin_PROGRAMS = \
42	avahi-daemon
43
44if ENABLE_TESTS
45noinst_PROGRAMS = \
46	ini-file-parser-test
47endif
48
49avahi_daemon_SOURCES = \
50	main.c main.h \
51	simple-protocol.c simple-protocol.h \
52	static-services.c static-services.h \
53	static-hosts.c static-hosts.h \
54	ini-file-parser.c ini-file-parser.h \
55	setproctitle.c setproctitle.h \
56	../avahi-client/check-nss.c
57
58avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS) $(XML_CFLAGS)
59avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) $(XML_LIBS)
60
61ini_file_parser_test_SOURCES = \
62	ini-file-parser.c ini-file-parser.h \
63	ini-file-parser-test.c
64
65ini_file_parser_test_CFLAGS = $(AM_CFLAGS)
66ini_file_parser_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la 
67
68pkgsysconf_DATA = \
69	avahi-daemon.conf \
70	hosts
71
72service_DATA = \
73	ssh.service \
74	sftp-ssh.service
75
76pkgdata_DATA = \
77	avahi-service.dtd
78
79if ENABLE_CHROOT
80
81avahi_daemon_SOURCES += \
82	chroot.c chroot.h \
83	caps.c caps.h
84
85avahi_daemon_LDADD += -lcap
86
87endif
88
89if HAVE_DLOPEN
90avahi_daemon_LDADD += -ldl
91endif
92
93if HAVE_DBUS
94
95dbusservicedir=$(DBUS_SYS_DIR)
96
97avahi_daemon_SOURCES += \
98	dbus-protocol.c dbus-protocol.h \
99	dbus-util.c dbus-util.h \
100	dbus-internal.h \
101	dbus-async-address-resolver.c \
102	dbus-async-host-name-resolver.c \
103	dbus-async-service-resolver.c \
104	dbus-domain-browser.c \
105	dbus-entry-group.c \
106	dbus-service-browser.c \
107	dbus-service-type-browser.c \
108	dbus-sync-address-resolver.c \
109	dbus-sync-host-name-resolver.c \
110	dbus-sync-service-resolver.c \
111	dbus-record-browser.c  \
112	../avahi-common/dbus.c ../avahi-common/dbus.h \
113	../avahi-common/dbus-watch-glue.c ../avahi-common/dbus-watch-glue.h
114
115avahi_daemon_LDADD += \
116	$(DBUS_LIBS)
117
118avahi_daemon_CFLAGS += $(DBUS_CFLAGS) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
119
120dbusservice_DATA = avahi-dbus.conf
121
122introspection_DATA = \
123	Server.introspect \
124	EntryGroup.introspect \
125	DomainBrowser.introspect \
126	ServiceTypeBrowser.introspect \
127	ServiceBrowser.introspect \
128	ServiceResolver.introspect \
129	AddressResolver.introspect \
130	HostNameResolver.introspect \
131	RecordBrowser.introspect
132
133endif
134endif
135endif
136
137EXTRA_DIST = \
138	avahi-service.dtd \
139	avahi-daemon.conf \
140	example.service \
141	avahi-dbus.conf \
142	Server.introspect \
143	EntryGroup.introspect \
144	DomainBrowser.introspect \
145	ServiceTypeBrowser.introspect \
146	ServiceBrowser.introspect \
147	ServiceResolver.introspect \
148	AddressResolver.introspect \
149	HostNameResolver.introspect \
150	RecordBrowser.introspect \
151	ssh.service \
152	sftp-ssh.service \
153	hosts \
154	example.service \
155	introspect.dtd \
156	introspect.xsl
157
158xmllint:
159	xmllint --noout --valid example.service
160	for F in $(introspection_DATA) ; do \
161		xmllint --noout --valid $$F ; \
162	done
163
164install-data-local:
165	test -z "$(localstatedir)/run" || $(mkdir_p) "$(DESTDIR)$(localstatedir)/run"
166