File: rules

package info (click to toggle)
mac-fdisk 0.1-15
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 368 kB
  • ctags: 874
  • sloc: ansic: 5,880; makefile: 181; sh: 35
file content (192 lines) | stat: -rwxr-xr-x 6,490 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
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
#!/usr/bin/make -f
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

export DH_VERBOSE=1

#BUILDARCH = $(shell dpkg --print-gnu-build-architecture)
BUILDARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
POWERPC = $(findstring $(BUILDARCH),powerpc ppc64)

packmn  = mac-fdisk
packmc  = mac-fdisk-cross
packpmn = pmac-fdisk
packpmc = pmac-fdisk-cross
packudeb = mac-fdisk-udeb
packpudeb = pmac-fdisk-udeb
tmpmn   = debian/tmp
tmpmc   = debian/$(packmc)
tmppmn  = debian/$(packpmn)
tmppmc  = debian/$(packpmc)
tmpudeb = debian/$(packudeb)
tmppudeb = debian/$(packpudeb)
docmn   = $(tmpmn)/usr/share/doc/$(packmn)
docmc   = $(tmpmc)/usr/share/doc/$(packmc)
docpmn  = $(tmppmn)/usr/share/doc/$(packpmn)
docpmc  = $(tmppmc)/usr/share/doc/$(packpmc)

ifeq "$(BUILDARCH)" "powerpc"
mac_subarches=powermac_oldworld powermac_newworld
pmac_subarches=chrp chrp_pegasos prep iseries
else
mac_subarches=mac
endif

build:
	$(checkdir)
	make CFLAGS="-O2 -g -Wall"
	touch build

clean:
	$(checkdir)
	-rm -f build
	-make clean
	-rm -f `find . -name "*~"`
	-rm -rf $(tmpmn) $(tmpmc) $(tmppmn) $(tmppmc) $(tmpudeb) $(tmppudeb) debian/files* core debian/*substvars

binary-indep: build
	$(checkdir)
# There are no architecture-independent files to be uploaded
# generated by this package.  If there were any they would be
# made here.

binary-arch: build
	dh_testdir pdisk.h
	dh_testroot
	dh_clean -k
	#dh_installdirs
	# we don't want to package the pdisk man page
	mv pdisk.8 pdisk.8.in
	set -e; if [ "$(BUILDARCH)" = "m68k" ] || [ -n "$(POWERPC)" ]; then \
		install -d $(tmpmn)/sbin; \
		install -m 755 pdisk $(tmpmn)/sbin/mac-fdisk; \
		install -d $(tmpmn)/usr/share/man/man8; \
		install -m 644 mac-fdisk.8.in $(tmpmn)/usr/share/man/man8/mac-fdisk.8; \
		dh_installdocs README -p$(packmn); \
		dh_installmanpages -p$(packmn); \
		dh_installchangelogs HISTORY -p$(packmn); \
	else \
		install -d $(tmpmc)/usr/sbin; \
		install -m 755 pdisk $(tmpmc)/usr/sbin/mac-fdisk; \
		install -d $(tmpmn)/usr/share/man/man8; \
		install -m 644 mac-fdisk.8.in $(tmpmn)/usr/share/man/man8/mac-fdisk.8; \
		dh_installdocs README -p$(packmc); \
		dh_installmanpages  -p$(packmc); \
		dh_installchangelogs HISTORY -p$(packmc); \
	fi
	set -e; if [ -n "$(POWERPC)" ]; then \
		install -d $(tmppmn)/sbin; \
		install -m 755 fdisk $(tmppmn)/sbin/pmac-fdisk; \
		install -d $(tmppmn)/usr/share/man/man8; \
		install -m 644 pmac-fdisk.8.in $(tmppmn)/usr/share/man/man8/pmac-fdisk.8; \
		dh_installdocs README -p$(packpmn); \
		dh_installmanpages  -p$(packpmn); \
		dh_installchangelogs HISTORY -p$(packpmn); \
	else \
		install -d $(tmppmc)/usr/sbin; \
		install -m 755 fdisk $(tmppmc)/usr/sbin/pmac-fdisk; \
		install -d $(tmppmc)/usr/share/man/man8; \
		install -m 644 pmac-fdisk.8.in $(tmppmc)/usr/share/man/man8/pmac-fdisk.8; \
		dh_installdocs README -p$(packpmc); \
		dh_installmanpages  -p$(packpmc); \
		dh_installchangelogs HISTORY -p$(packpmc); \
	fi
	# install README.Debian also in cross package (not done by dh_installdocs)
	set -e; if [ "$(BUILDARCH)" != "m68k" ] && ! [ -n "$(POWERPC)" ]; then \
		install -m 644 debian/README.debian $(docmc)/README.Debian; \
	fi
	# and move the pdisk man page back again ...
	mv pdisk.8.in pdisk.8

	# install mac-fdisk-udeb files
	set -e; if [ "$(BUILDARCH)" = "m68k" ] || [ -n "$(POWERPC)" ]; then \
		install -d $(tmpudeb)/sbin; \
		install -d $(tmpudeb)/DEBIAN; \
		install -m 755 pdisk $(tmpudeb)/sbin/mac-fdisk; \
	fi

	# install pmac-fdisk-udeb files
	set -e; if [ -n "$(POWERPC)" ]; then \
		install -d $(tmppudeb)/usr/sbin; \
		install -d $(tmppudeb)/DEBIAN; \
		install -m 755 fdisk $(tmppudeb)/usr/sbin/pmac-fdisk; \
	fi

	# build native pdisk only for m68k, cross package only for others
	set -e; if [ "$(BUILDARCH)" = "m68k" ] || [ -n "$(POWERPC)" ]; then \
		dh_strip -p$(packmn) -P$(tmpmn); \
		dh_compress -p$(packmn) -P$(tmpmn); \
		dh_fixperms -p$(packmn) -P$(tmpmn); \
		dh_installdeb -p$(packmn) -P$(tmpmn); \
		dh_shlibdeps -p$(packmn) -P$(tmpmn); \
		dh_gencontrol -p$(packmn) -P$(tmpmn); \
		dh_md5sums -p$(packmn) -P$(tmpmn); \
	else \
		dh_strip -p$(packmc); \
		dh_compress -p$(packmc); \
		dh_fixperms -p$(packmc); \
		dh_installdeb -p$(packmc); \
		dh_shlibdeps -p$(packmc); \
		dh_gencontrol -p$(packmc); \
		dh_md5sums -p$(packmc); \
	fi
	# build native fdisk only for powerpc, cross package only for others
	set -e; if [ -n "$(POWERPC)" ]; then \
		dh_strip -p$(packpmn); \
		dh_compress -p$(packpmn); \
		dh_fixperms -p$(packpmn); \
		dh_installdeb -p$(packpmn); \
		dh_shlibdeps -p$(packpmn); \
		dh_gencontrol -p$(packpmn); \
		dh_md5sums -p$(packpmn); \
	else \
		dh_strip -p$(packpmc); \
		dh_compress -p$(packpmc); \
		dh_fixperms -p$(packpmc); \
		dh_installdeb -p$(packpmc); \
		dh_shlibdeps -p$(packpmc); \
		dh_gencontrol -p$(packpmc); \
		dh_md5sums -p$(packpmc); \
	fi
	set -e; if [ "$(BUILDARCH)" = "m68k" ] || [ -n "$(POWERPC)" ]; then \
		dh_builddeb -p$(packmn) -P$(tmpmn); \
	else \
		dh_builddeb -p$(packmc); \
	fi
	set -e; if [ -n "$(POWERPC)" ]; then \
		dh_builddeb -p$(packpmn); \
	else \
		dh_builddeb -p$(packpmc); \
	fi

	# build mac-fdisk-udeb on powerpc and m68k
	set -e; if [ "$(BUILDARCH)" = "m68k" ] || [ -n "$(POWERPC)" ]; then \
		dh_strip -p$(packudeb); \
		dh_installdeb -p$(packudeb); \
		dh_shlibdeps -p$(packudeb); \
		dh_gencontrol -p$(packudeb) -- -isp "-DSubarchitecture=$(mac_subarches)" -fdebian/files~; \
		dpkg-distaddfile $(packudeb)_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(BUILDARCH).udeb debian-installer standard; \
		dh_builddeb -p$(packudeb) --filename=$(packudeb)_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(BUILDARCH).udeb; \
	fi

	# build pmac-fdisk-udeb on powerpc
	set -e; if [ -n "$(POWERPC)" ]; then \
		dh_strip -p$(packpudeb); \
		dh_installdeb -p$(packpudeb); \
		dh_shlibdeps -p$(packpudeb); \
		dh_gencontrol -p$(packpudeb) -- -isp "-DSubarchitecture=$(pmac_subarches)" -fdebian/files~; \
		dpkg-distaddfile $(packpudeb)_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(BUILDARCH).udeb debian-installer standard; \
		dh_builddeb -p$(packpudeb) --filename=$(packpudeb)_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(BUILDARCH).udeb; \
	fi

define checkdir
	test -f debian/rules
endef

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

.PHONY: binary binary-arch binary-indep clean checkroot