1# This file is part of avahi.
2#
3# avahi is free software; you can redistribute it and/or modify it
4# under the terms of the GNU Lesser General Public License as
5# published by the Free Software Foundation; either version 2 of the
6# License, or (at your option) any later version.
7#
8# avahi is distributed in the hope that it will be useful, but WITHOUT
9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
11# License for more details.
12#
13# You should have received a copy of the GNU Lesser General Public
14# License along with avahi; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
16# USA.
17
18AM_CFLAGS=-I$(top_srcdir)
19
20# This cool debug trap works on i386/gcc only
21AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
22
23if HAVE_LIBDAEMON
24if HAVE_XML
25
26pkgsysconfdir=$(sysconfdir)/avahi
27servicedir=$(pkgsysconfdir)/services
28introspectiondir=$(datadir)/dbus-1/interfaces
29dbussystemservicesdir=$(datadir)/dbus-1/system-services
30
31AM_CFLAGS+= \
32	-DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
33	-DAVAHI_SOCKET=\"$(avahi_socket)\" \
34	-DAVAHI_SERVICE_DIR=\"$(servicedir)\" \
35	-DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi-daemon.conf\" \
36	-DAVAHI_HOSTS_FILE=\"$(pkgsysconfdir)/hosts\" \
37	-DAVAHI_DBUS_INTROSPECTION_DIR=\"$(introspectiondir)\" \
38	-DAVAHI_CONFIG_DIR=\"$(pkgsysconfdir)\"
39
40sbin_PROGRAMS = \
41	avahi-daemon
42
43if ENABLE_TESTS
44noinst_PROGRAMS = \
45	ini-file-parser-test
46endif
47
48avahi_daemon_SOURCES = \
49	main.c main.h \
50	simple-protocol.c simple-protocol.h \
51	static-services.c static-services.h \
52	static-hosts.c static-hosts.h \
53	ini-file-parser.c ini-file-parser.h \
54	setproctitle.c setproctitle.h \
55	sd-daemon.h sd-daemon.c \
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
72dist_service_DATA = \
73	ssh.service \
74	sftp-ssh.service
75
76dist_pkgdata_DATA = \
77	avahi-service.dtd
78
79%.service: %.service.in
80	$(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@
81
82%.socket: %.socket.in
83	$(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' \
84		-e 's,@avahi_runtime_dir\@,$(avahi_runtime_dir),g' $< > $@
85
86if HAVE_SYSTEMD
87systemdsystemunit_DATA = \
88	avahi-daemon.service \
89	avahi-daemon.socket
90
91dist_dbussystemservices_DATA = \
92	org.freedesktop.Avahi.service
93endif
94
95CLEANFILES = $(systemdsystemunit_DATA)
96
97if ENABLE_CHROOT
98
99avahi_daemon_SOURCES += \
100	chroot.c chroot.h \
101	caps.c caps.h
102
103avahi_daemon_LDADD += -lcap
104
105endif
106
107if HAVE_DLOPEN
108avahi_daemon_LDADD += -ldl
109endif
110
111if HAVE_DBUS
112
113dbusservicedir=$(DBUS_SYS_DIR)
114
115avahi_daemon_SOURCES += \
116	dbus-protocol.c dbus-protocol.h \
117	dbus-util.c dbus-util.h \
118	dbus-internal.h \
119	dbus-async-address-resolver.c \
120	dbus-async-host-name-resolver.c \
121	dbus-async-service-resolver.c \
122	dbus-domain-browser.c \
123	dbus-entry-group.c \
124	dbus-service-browser.c \
125	dbus-service-type-browser.c \
126	dbus-sync-address-resolver.c \
127	dbus-sync-host-name-resolver.c \
128	dbus-sync-service-resolver.c \
129	dbus-record-browser.c  \
130	../avahi-common/dbus.c ../avahi-common/dbus.h \
131	../avahi-common/dbus-watch-glue.c ../avahi-common/dbus-watch-glue.h
132
133avahi_daemon_LDADD += \
134	$(DBUS_LIBS)
135
136avahi_daemon_CFLAGS += $(DBUS_CFLAGS) -DDBUS_SYSTEM_BUS_DEFAULT_ADDRESS=\"$(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)\"
137
138dist_dbusservice_DATA = avahi-dbus.conf
139
140dist_introspection_DATA = \
141	org.freedesktop.Avahi.Server.xml \
142	org.freedesktop.Avahi.EntryGroup.xml \
143	org.freedesktop.Avahi.DomainBrowser.xml \
144	org.freedesktop.Avahi.ServiceTypeBrowser.xml \
145	org.freedesktop.Avahi.ServiceBrowser.xml \
146	org.freedesktop.Avahi.ServiceResolver.xml \
147	org.freedesktop.Avahi.AddressResolver.xml \
148	org.freedesktop.Avahi.HostNameResolver.xml \
149	org.freedesktop.Avahi.RecordBrowser.xml
150
151endif
152endif
153endif
154
155Android.mk: Makefile.am
156	androgenizer -:PROJECT avahi -:SHARED avahi-daemon -:TAGS eng debug \
157	 -:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
158	 -:SOURCES $(avahi_daemon_SOURCES) \
159	 -:CFLAGS $(DEFS) $(CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) \
160	  $(AM_CFLAGS) $(avahi_daemon_CFLAGS) -DBUILD_AS_ANDROID_SERVICE \
161	 -:CPPFLAGS $(CPPFLAGS) $(AM_CPPFLAGS) $(avahi_daemon_CPPFLAGS) \
162	 -:LDFLAGS $(avahi_daemon_LDADD) \
163	> $@
164
165EXTRA_DIST = \
166	avahi-daemon.conf \
167	example.service \
168	hosts \
169	example.service \
170	introspect.dtd \
171	introspect.xsl \
172	avahi-daemon.service.in \
173	avahi-daemon.socket.in
174
175xmllint:
176	xmllint --noout --valid example.service
177	for F in $(introspection_DATA) ; do \
178		xmllint --noout --valid $$F ; \
179	done
180
181install-data-local:
182	test -z "$(localstatedir)/run" || $(MKDIR_P) "$(DESTDIR)$(localstatedir)/run"
183
184update-systemd:
185	curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c
186	curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h > sd-daemon.h
187