File: rules

package info (click to toggle)
net-snmp 5.1.2-6.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,340 kB
  • ctags: 12,062
  • sloc: ansic: 134,798; perl: 10,855; sh: 10,237; makefile: 5,003
file content (196 lines) | stat: -rwxr-xr-x 6,077 bytes parent folder | download
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# This version is for a hypothetical package that builds an
# architecture-dependant package, as well as an architecture-independent
# package.

# Uncomment this to turn on verbose mode. 
#export DH_VERBOSE=1

# This is the debhelper compatability version to use.
export DH_COMPAT=4

v = 5

tmp=$(shell pwd)/debian/tmp

ifndef PERL
PERL=/usr/bin/perl
endif

ARCH = $(shell dpkg --print-architecture)

CFLAGS = -O2 -D_REENTRANT
ifneq "$(findstring debug,$(DEB_BUILD_OPTIONS))" ""
CFLAGS += -g
endif

MIB_MODULES = host smux ucd-snmp/dlmod

ifeq "$(ARCH)" "i386"
MIB_MODULES +=  ucd-snmp/lmSensors
LIBSENSORS = -lsensors
endif

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
	libtoolize --force --copy
	aclocal
	autoconf
	LC_COLLATE=C autoheader
	echo timestamp >stamp-h.in
	./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man \
	  --with-persistent-directory=/var/lib/snmp \
	  --enable-ucd-snmp-compatibility \
	  --enable-shared --with-cflags="$(CFLAGS)" \
	  --with-perl-modules="INSTALLDIRS=vendor" \
	  --enable-ipv6 --with-logfile=none \
	  --without-rpm --with-libwrap --with-openssl \
	  --without-dmalloc --without-efence --without-rsaref \
	  --with-sys-contact="root" --with-sys-location="Unknown" \
	  --with-mib-modules="$(MIB_MODULES)" \
	  --with-defaults
	$(MAKE) LIBSENSORS=$(LIBSENSORS) LD_RUN_PATH=

	# Relink libs to resolve dependencies
	# Make sure NOT to include circular dependencies or
	# relinking during install will fail
	rm -f agent/libnetsnmpmibs.la
	$(MAKE) -C agent MIBS_RELINK_LIBS="../snmplib/libnetsnmp.la libnetsnmpagent.la -lwrap" AGENT_RELINK_LIBS="../snmplib/libnetsnmp.la" LIBSENSORS=$(LIBSENSORS) LD_RUN_PATH=
	rm -f agent/helpers/libnetsnmphelpers.la
	$(MAKE) -C agent/helpers HELPERS_RELINK_LIBS="../../snmplib/libnetsnmp.la ../libnetsnmpagent.la ../libnetsnmpmibs.la -lwrap" LD_RUN_PATH=
	rm -f apps/libnetsnmptrapd.la
	$(MAKE) -C apps TRAPD_RELINK_LIBS="../snmplib/libnetsnmp.la ../agent/libnetsnmpagent.la ../agent/libnetsnmpmibs.la ../agent/helpers/libnetsnmphelpers.la -lwrap" LD_RUN_PATH=
	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp install-stamp

	# Add here commands to clean up after the build process.
	-$(MAKE) perlrealclean distclean

	dh_clean EXAMPLE.conf configure net-snmp-config sedscript \
	  stamp-h stamp-h.in include/net-snmp/net-snmp-config.h.in \
	  include/net-snmp/library/snmpv3-security-includes.h \
	  perl/SNMP/t/snmptest.cmd perl/blib/lib/.exists \
	  perl/blib/lib/NetSNMP/.exists perl/blib/lib/NetSNMP/agent/.exists \
	  perl/SNMP/SNMP.pod aclocal.m4 config.guess config.sub ltmain.sh \
	  $(shell find -type f -name '*.o')

install: install-stamp
install-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/tmp.
	$(MAKE) prefix=`pwd`/debian/tmp/usr exec_prefix=`pwd`/debian/tmp/usr \
	  mandir=`pwd`/debian/tmp/usr/share/man \
	  persistentdir=`pwd`/debian/tmp/var/lib/snmp \
	  PREFIX=`pwd`/debian/tmp/usr install
	# Install the "broke" headers
	cp agent/mibgroup/struct.h debian/tmp/usr/include/net-snmp/agent
	cp agent/mibgroup/util_funcs.h debian/tmp/usr/include/net-snmp
	cp agent/mibgroup/mibincl.h debian/tmp/usr/include/net-snmp/library
	cp agent/mibgroup/header_complex.h debian/tmp/usr/include/net-snmp/agent
	# Remove the snmpcheck program since we don't support it (yet).
	rm debian/tmp/usr/bin/snmpcheck
	# Copy the .conf files.
	mkdir -p debian/tmp/etc/snmp
	cp EXAMPLE.conf debian/tmp/etc/snmp/snmpd.conf
	cp EXAMPLE-trap.conf debian/tmp/etc/snmp/snmptrapd.conf
	mv debian/tmp/usr/share/snmp/mib2c*.conf debian/tmp/etc/snmp
	mkdir -p debian/tmp/etc/default
	cp debian/snmpd.default debian/tmp/etc/default/snmpd
	# Perform other man pages fixups.
	bash ./debian/fixman
	## Copy the autoconf files.
	#mkdir -p debian/tmp/usr/share/aclocal
	#cp net-snmp.m4 debian/tmp/usr/share/aclocal

	# Fix all .la files
	(cd $(CURDIR)/debian/tmp/usr/lib; \
	for i in *.la ; do \
		sed -e "s#libdir=.*#libdir='/usr/lib'#" < $$i >$$i.new && \
			mv $$i.new $$i ; \
	done )

	dh_movefiles
	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installdocs -i
	dh_installexamples -i
	#dh_installmenu -i
	#dh_installemacsen -i
	#dh_installpam -i
	#dh_installinit -i
	#dh_installcron -i
	dh_installman -i
	#dh_installinfo -i
	dh_installchangelogs -i -k ChangeLog
	#dh_link -i
	dh_compress -i
	dh_fixperms -i
	# You may want to make some executables suid here.
	#dh_suidregister -i
	dh_installdeb -i
	dh_perl -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installdocs -a
	for f in libsnmp$(v)-dev ; do \
	  rm -rf debian/$$f/usr/share/doc/$$f ; \
	  ln -sf libsnmp$(v) debian/$$f/usr/share/doc/$$f ; \
	done
	#dh_installexamples -a
	dh_installexamples -plibsnmp-perl $(shell ls -d perl/SNMP/examples/* | grep -v SCCS)
	#dh_installmenu -a
	#dh_installemacsen -a
	#dh_installpam -a
	dh_installinit -a
	#dh_installcron -a
	dh_installman -a
	#dh_installinfo -a
	#dh_installchangelogs -a
	dh_installchangelogs -plibsnmp$(v) -k ChangeLog
	dh_installchangelogs -plibsnmp-perl -k ChangeLog
	dh_installchangelogs -psnmp -k ChangeLog
	dh_installchangelogs -psnmpd -k ChangeLog
	dh_strip -a
	#dh_link -a
	dh_compress -a
	dh_fixperms -a
	chmod 600 debian/snmpd/etc/snmp/snmp*d.conf
	# You may want to make some executables suid here.
	#dh_suidregister -a
	dh_installdeb -a
	#dh_makeshlibs -a
	dh_makeshlibs -plibsnmp$(v) -V "libsnmp$(v) (>= 5.1)"
	dh_makeshlibs -plibsnmp-perl
	dh_perl -a
	dh_shlibdeps -a -ldebian/libsnmp$(v)/usr/lib -Llibsnmp$(v)
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

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