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
18if ENABLE_AUTOIPD
19if HAVE_LIBDAEMON
20
21pkgsysconfdir=$(sysconfdir)/avahi
22
23AM_CFLAGS= \
24	-I$(top_srcdir)
25
26# This cool debug trap works on i386/gcc only
27AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")' \
28	-DAVAHI_RUNTIME_DIR=\"$(avahi_runtime_dir)/\" \
29	-DAVAHI_IPCONF_SCRIPT=\"$(pkgsysconfdir)/avahi-autoipd.action\" \
30	-DAVAHI_IPDATA_DIR=\"$(localstatedir)/lib/avahi-autoipd\"
31
32sbin_PROGRAMS = avahi-autoipd
33
34avahi_autoipd_SOURCES = \
35	main.c main.h \
36	 ../avahi-daemon/setproctitle.c  ../avahi-daemon/setproctitle.h \
37	iface.h	\
38	../avahi-common/malloc.h ../avahi-common/malloc.c \
39	../avahi-common/timeval.h ../avahi-common/timeval.c
40
41avahi_autoipd_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
42avahi_autoipd_LDADD = $(AM_LDADD) $(LIBDAEMON_LIBS)
43
44if TARGET_FREEBSD
45avahi_autoipd_SOURCES += iface-bsd.c
46avahi_autoipd_LDADD += -lpcap
47else
48avahi_autoipd_SOURCES += iface-linux.c
49endif
50
51nodist_pkgsysconf_SCRIPTS = avahi-autoipd.action
52
53if TARGET_FREEBSD
54avahi-autoipd.action: avahi-autoipd.action.bsd
55	$(AM_V_GEN)cp $< $@
56else
57avahi-autoipd.action: avahi-autoipd.action.linux
58	$(AM_V_GEN)cp $< $@
59endif
60
61if TARGET_DEBIAN
62
63noinst_SCRIPTS = dhclient-enter-hook dhclient-exit-hook
64
65dhclient-enter-hook: dhclient-enter-hook.in
66	$(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ && \
67	chmod +x $@
68
69dhclient-exit-hook: dhclient-exit-hook.in
70	$(AM_V_GEN)sed -e 's,@sbindir\@,$(sbindir),g' $< > $@ && \
71	chmod +x $@
72
73BUILD = dhclient-exit-hook dhclient-enter-hook
74
75dhcliententerdir = $(sysconfdir)/dhcp/dhclient-enter-hooks.d
76dhclientexitdir = $(sysconfdir)/dhcp/dhclient-exit-hooks.d
77
78install-exec-hook: dhclient-exit-hook dhclient-enter-hook
79	$(MKDIR_P) $(DESTDIR)$(dhcliententerdir) $(DESTDIR)$(dhclientexitdir)
80	$(INSTALL) dhclient-enter-hook $(DESTDIR)$(dhcliententerdir)/avahi-autoipd
81	$(INSTALL) dhclient-exit-hook $(DESTDIR)$(dhclientexitdir)/avahi-autoipd
82
83uninstall-hook:
84	rm -f $(DESTDIR)$(dhcliententerdir)/avahi-autoipd $(DESTDIR)$(dhclientexitdir)/avahi-autoipd
85
86endif
87
88
89endif
90endif
91
92EXTRA_DIST = dhclient-enter-hook.in dhclient-exit-hook.in avahi-autoipd.action.linux avahi-autoipd.action.bsd
93
94CLEANFILES = dhclient-enter-hook dhclient-exit-hook avahi-autoipd.action
95