File: rules

package info (click to toggle)
memprof 0.5.1-9
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,352 kB
  • ctags: 558
  • sloc: sh: 8,368; ansic: 4,904; makefile: 190
file content (146 lines) | stat: -rwxr-xr-x 3,615 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
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

#export DH_VERBOSE=1

# Patches applied in this order.
debian_patches = configure

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

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

configure: configure-stamp
configure-stamp: patched-stamp
	dh_testdir
	
	chmod +x debian/my_mv
	debian/my_mv config.guess config.guess.old
	debian/my_mv config.sub   config.sub.old
	ln -s /usr/share/misc/config.sub .
	ln -s /usr/share/misc/config.guess .
	
	./configure --prefix=/usr --sysconfdir=/etc --host=$(DEB_HOST_GNU_TYPE)\
	--build=$(DEB_BUILD_GNU_TYPE)

	touch configure-stamp

build: configure-stamp build-stamp
build-stamp:
	dh_testdir

	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	
	chmod +x debian/my_mv
	debian/my_mv -f config.sub.old   config.sub
	debian/my_mv -f config.guess.old config.guess
	
	rm -f build-stamp configure-stamp
	rm -f config.log

	[ ! -f Makefile ] || $(MAKE) distclean

	debian/rules reverse-patches
	dh_clean *.1 manpage.links manpage.refs

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs usr/share/lintian/overrides

	GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
	$(MAKE) install DESTDIR=$(CURDIR)/debian/memprof

	rm debian/memprof/usr/lib/libmemintercept.a
	rm debian/memprof/usr/lib/libmemintercept.la
	docbook2man debian/memprof.sgml

	cp debian/lintian debian/memprof/usr/share/lintian/overrides/memprof

# Build architecture-independent files here.
binary-indep: build install

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs NEWS
#	dh_installmenu
	dh_installman memprof.1
	dh_installchangelogs ChangeLog
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	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

# ---------------------------------------------------------------------------
# various rules to unpack addons and (un)apply patches.
# borrowed from egcs package

patch_dir	= debian/patches

apply-patches: patched-stamp
reverse-patches:
	@for stamp in none patched-*; do \
	  case "$$stamp" in none|patched-stamp|patched-\*) continue; esac; \
	  patch=`echo $$stamp | sed -e 's/patched-//'`; \
	  echo "trying to revert patch $$patch ..."; \
	  if [ -x $(patch_dir)/$$patch.dpatch ]; then true; else \
	    chmod +x $(patch_dir)/$$patch.dpatch; fi; \
	  if $(patch_dir)/$$patch.dpatch -unpatch; then \
	    echo "reverted $$patch patch."; \
	    rm -f $$stamp; \
	  else \
	    echo "error in reverting $$patch patch."; \
	    exit 1; \
	  fi; \
	done
	@echo "Removing patched-stamp"
	@rm -f patched-stamp

patched-%: $(patch_dir)/%.dpatch
	@if [ -x $< ]; then true; else chmod +x $<; fi
	@if [ -f $@ ]; then \
	  echo "$* patches already applied."; exit 1; \
	fi
	$< -patch
	@echo "$* patches applied." > $@

patched-stamp: $(foreach p,$(debian_patches),patched-$(p))
	@echo -e "\nPatches applied:" >> pxxx
	@for i in none $(debian_patches); do \
	  if [ -r debian/patches/$$i.dpatch ]; then \
	    echo -e "\n$$i:" >> pxxx; \
	    sed -n 's/^# *DP: */  /p' debian/patches/$$i.dpatch >> pxxx; \
	  fi \
	done
	@echo "Writing patched-stamp"
	@mv -f pxxx patched-stamp