summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 8f4cd32897a4494f369afe7c612320bea9fbebee (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
#!/usr/bin/make -f

# hacks to avoid running these things during the build
export ACLOCAL    = : aclocal
export AUTOCONF   = : autoconf
export AUTOMAKE   = : automake
export AUTOHEADER = : autoheader

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS) -D_GNU_SOURCE
CFLAGS   = $(shell dpkg-buildflags --get CFLAGS) -fno-strict-aliasing
LDFLAGS  = $(shell dpkg-buildflags --get LDFLAGS) -Wl,--as-needed

config.status:
	dh_testdir
ifeq (hurd, $(DEB_HOST_ARCH_OS))
	# hurd does not provided the system calls needed for ntpd to work.
	exit 1
endif
	cp /usr/share/misc/config.guess /usr/share/misc/config.sub .
	./configure CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \
		--prefix=/usr \
		--enable-all-clocks --enable-parse-clocks --enable-SHM \
		--disable-debugging --sysconfdir=/var/lib/ntp \
		--with-sntp=no \
		--with-lineeditlibs=edit \
		--disable-local-libopts \
		--enable-ntp-signd \
		--disable-dependency-tracking

build: build-stamp
build-stamp: config.status
	dh_testdir
	$(MAKE)
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp 
	[ ! -f Makefile ] || $(MAKE) -k distclean
	rm -f config.guess config.sub
	dh_clean

install: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	$(MAKE) install DESTDIR=$(CURDIR)/debian/ntp

	# move the administrator programs from /usr/bin to /usr/sbin
	for file in ntpdate ntp-wait ntpd ntptime ntp-keygen; do \
		mv debian/ntp/usr/bin/$$file debian/ntp/usr/sbin/$$file || exit; \
	done

	# don't install tickadj
	rm debian/ntp/usr/bin/tickadj

	install -D -m 0755 scripts/ntpsweep debian/ntp/usr/bin/ntpsweep
	install -D -m 0644 debian/ntp.dhcp debian/ntp/etc/dhcp/dhclient-exit-hooks.d/ntp
	install -D -m 0644 debian/ntpdate.dhcp debian/ntpdate/etc/dhcp/dhclient-exit-hooks.d/ntpdate
	install -D -m 0755 debian/ntpdate-debian debian/ntpdate/usr/sbin/ntpdate-debian

	install -D -m 0644 debian/ntp.conf debian/ntp/etc/ntp.conf

	# remove upstream man pages, which are currently not as nice as ours
	rm $(addprefix debian/ntp/usr/share/man/man1/,ntpd.1 ntpdc.1 ntp-keygen.1 ntpq.1)

	dh_movefiles --sourcedir=debian/ntp

binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i html
	rm -f debian/ntp-doc/usr/share/doc/ntp-doc/html/hints/solaris*
	dh_installexamples -i
	dh_installman -i
	dh_installcron -i
	dh_installlogcheck -i
	dh_installchangelogs -i
	dh_installifupdown -i
	dh_perl -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	dh_installexamples -a
	dh_installman -a
	dh_installinit -pntp --update-rcd-params="start 23 2 3 4 5 ." --error-handler=installinit_error
	dh_installinit -pntpdate
	dh_installcron -a
	dh_installlogcheck -a
	dh_installchangelogs -a
	dh_installifupdown -a
	dh_perl -a
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install