File: rules

package info (click to toggle)
smartmontools 6.5%2Bsvn4324-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,772 kB
  • ctags: 7,352
  • sloc: cpp: 41,134; ansic: 9,556; sh: 1,339; makefile: 894
file content (140 lines) | stat: -rwxr-xr-x 4,298 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

ifeq ($(DEB_HOST_ARCH_OS),linux)
	CONFIGURE_ARGS += --with-selinux
endif

ifeq ($(DEB_HOST_ARCH_OS),kfreebsd)
	CFLAGS += -I/usr/include/freebsd
endif

CFLAGS += -fsigned-char -Wall
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
else
        CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM = install -s
else
        INSTALL_PROGRAM = install
endif

PACKAGE = smartmontools
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p'| cut -d':' -f2)
SVN_REVISION := $(shell echo $(SRC_VERSION) | awk -F"+" '{ print $$2 }' | sed 's/svn//' )
TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.xz
SVN_ROOT := 'https://svn.code.sf.net/p/smartmontools/code/trunk/smartmontools'

get-orig-source:
		rm -rf get-orig-source $(TARBALL)
		mkdir get-orig-source
		svn export -r $(SVN_REVISION) $(SVN_ROOT) \
			get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig
		rm -rf get-orig-source/$(PACKAGE)-$(SRC_VERSION).orig/os_solaris_ata.s
		tar cJf $(TARBALL) -C get-orig-source $(PACKAGE)-$(SRC_VERSION).orig
		rm -rf get-orig-source
		echo "  "$(TARBALL)" created; move it to the right destination to build the package"

configure: configure-stamp
configure-stamp: 
	dh_testdir
	./autogen.sh
	CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" ./configure --prefix=/usr		 \
				--build=$(DEB_BUILD_GNU_TYPE) \
				--host=$(DEB_HOST_GNU_TYPE) \
				--sysconfdir=/etc		 \
				--mandir=/usr/share/man		 \
				--with-initscriptdir=no \
				--docdir=/usr/share/doc/smartmontools \
				--with-savestates=/var/lib/smartmontools/smartd. \
				--with-attributelog=/var/lib/smartmontools/attrlog. \
				--with-exampledir=/usr/share/doc/smartmontools/examples/ \
				--with-drivedbdir=/var/lib/smartmontools/drivedb \
				--with-systemdsystemunitdir=/lib/systemd/system \
				--with-smartdscriptdir=/usr/share/smartmontools \
				--with-smartdplugindir=/etc/smartmontools/smartd_warning.d \
				--with-systemdenvfile=/etc/default/smartmontools \
				${CONFIGURE_ARGS}
	touch configure-stamp

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: configure-stamp
	dh_testdir
	# Add here commands to compile the package.
	$(MAKE)
	touch build-stamp

clean: 
	dh_testdir
	dh_testroot
	# rm -f debian/logcheck.logcheck.ignore.*
	# Add here commands to clean up after the build process.
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f build-stamp configure-stamp \
	      Makefile.in examplescripts/Makefile.in aclocal.m4 configure \
	      config.guess config.h.in config.sub depcomp install-sh \
	      m4/pkg.m4 missing
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	$(MAKE) DESTDIR=$(CURDIR)/debian/smartmontools install
	rm -f debian/smartmontools/usr/sbin/update-smart-drivedb

# Build architecture-independent files here.
binary-indep:
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	rm -f debian/smartmontools/usr/share/doc/smartmontools/INSTALL \
          debian/smartmontools/usr/share/doc/smartmontools/COPYING \
          debian/smartmontools/usr/share/doc/smartmontools/ChangeLog
	dh_installdocs
	dh_installexamples
	dh_installmenu
	dh_installlogrotate
	dh_install
	dh_link
	dh_systemd_enable
	dh_installinit
	dh_systemd_start
	dh_installcron
	dh_installinfo
	dh_lintian
	dh_installchangelogs ChangeLog
	dh_strip
	dh_compress
	dh_fixperms
	chmod 755 $(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10mail \
		$(CURDIR)/debian/smartmontools/etc/smartmontools/run.d/10powersave-notify \
		$(CURDIR)/debian/smartmontools/usr/share/smartmontools/smartd-runner
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure get-orig-source