File: rules

package info (click to toggle)
smail 3.2.0.102-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 4,228 kB
  • ctags: 3,924
  • sloc: ansic: 41,366; sh: 3,434; makefile: 2,349; awk: 689; perl: 598; yacc: 427; sed: 2
file content (156 lines) | stat: -rwxr-xr-x 6,267 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
#!/usr/bin/make -f

# 	Copyright 97/98 Soenke Lange <soenke@escher.north.de>
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 dated June, 1991.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program;  if not, write to the Free Software
#   Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.

# The name and version of the source
#
source = $(shell grep "^Source: " debian/control|head -1|sed 's/Source: \(.*\)/\1/g')
package = $(shell grep "^Package: " debian/control|head -1|sed 's/Package: \(.*\)/\1/g')
version = $(shell grep "^$(source) " debian/changelog|head -1 |sed 's/.*(\(.*\)\-[^\-]*).*/\1/g')
revision = $(shell grep "^$(source) " debian/changelog|head -1 |sed 's/.*([^\-]*\-\(.*\)).*/\1/g')

installbin = install -g root -o root -m 755
installdoc = install -g root -o root -m 644
installdir = install -g root -o root -m 755 -d


DIR:=$(shell pwd)
arch=$(shell dpkg --print-architecture)

build:
	$(checkdir)
	umask 022
	(cd src && $(MAKE)  iobpeek.h)
	$(MAKE) $(FLAGS)  depend
	$(MAKE) $(FLAGS) 
	@set -e; for f in `find . -name defs.sh`; do \
		echo munging "$$f" ... ; \
		d=`dirname $$f`/debian-defs.sh ; \
		perl -pe 's,(['"'"' ])/(usr|var|etc),$$1$(DIR)/debian/tmp/$$2,g' \
			$$f > $$d ; \
		touch -m -r $$f $$d ; \
	done
	(cd contrib/striphdrs&& make striphdrs)
	(cat debian/README; echo -e '\n\n'; cat COPYING) >debian/tmp.copyright
	touch build

clean:
	$(checkdir)
	-rm -f build
	-$(MAKE) $(FLAGS) clobber
	set -e; \
	for f in `find . -name AUX-support -prune -false -o -name Makefile` ; do \
		perl -i.dep~ -ne 'print || die $$! \
				  if 1 .. /^# DO NOT REMOVE THIS LINE/' \
			$$f ; \
	done
	-rm -rf debian/files* debian/substvars* debian/tmp debian/tmp.deb debian/tmp.copyright
	-rm -f man/man?/.Makefile pd/pathalias/.Makefile mkdep.out
	-rm -f contrib/striphdrs/striphdrs
	find . -name debian-defs.sh -o -name '*~' -o -name '*.orig' -o -name '*.rej' \
	    -o -name '#*#' | xargs rm -f -

debclean:
# Cleans debian binary directories to allow binary creation
	rm -rf debian/tmp
	rm -f debian/{files,substvars}

binary-indep:
# Nothing to be done here


binary-arch: checkroot 
	-rm -rf debian/tmp
	$(installdir) debian/tmp/DEBIAN \
	 debian/tmp/etc/{smail,cron.daily} debian/tmp/var/log{,/smail} \
	 debian/tmp/usr/{bin,sbin,lib,man} debian/tmp/var/{lib,spool}/smail \
	 debian/tmp/usr/doc/smail/{guide,examples} \
	 debian/tmp/var/spool/smail/{input,msglog,retry,error} \
	 debian/tmp/etc/init.d
	$(MAKE) $(FLAGS) install MAKEFILES=$(DIR)/debian/overrides
	$(MAKE) $(FLAGS) installman MAKEFILES=$(DIR)/debian/overrides
	strip debian/tmp/usr/sbin/smail
	find debian/tmp -type l -ls | perl -n debian/mungelinks
	rm -f debian/tmp/usr/sbin/{mailq,runq}
	mv debian/tmp/usr/sbin/{smtpd,in.smtpd}
	mv debian/tmp/usr/man/man8/{smtpd,in.smtpd}.8
	(cd debian/tmp/usr/man/man5 && \
	 ln -s smailconf.5.gz smail-config.5.gz; \
	 ln -s smaildrct.5.gz smail-directors.5.gz; \
	 ln -s smailmeth.5.gz smail-methods.5.gz; \
	 ln -s smailqual.5.gz smail-qualify.5.gz; \
	 ln -s smailrtrs.5.gz smail-routers.5.gz; \
	 ln -s smailrtry.5.gz smail-retry.5.gz; \
	 ln -s smailtrns.5.gz smail-transports.5.gz )
	rm debian/tmp/usr/lib/smail/{savelog,getopt}
	rm debian/tmp/usr/man/man8/savelog.8
	touch debian/tmp/etc/aliases debian/tmp/etc/smail/transports debian/tmp/etc/smail/directors debian/tmp/etc/smail/routers debian/tmp/etc/smail/config
	$(installbin) debian/smail debian/tmp/etc/init.d/smail
	$(installdoc) debian/crontab debian/tmp/etc/smail/crontab
	$(installdoc) debian/New-Config-Features \
		debian/crontab debian/changelog CHANGES \
		debian/README.multihomed debian/README.hosts.allow \
		debian/README.xinetd debian/tmp/usr/doc/smail/
	$(installdoc) debian/changelog \
		debian/tmp/usr/doc/smail/changelog.debian
	$(installdoc) debian/aliases debian/tmp/etc/aliases
	$(installbin) debian/cronroot debian/tmp/etc/cron.daily/smail
	rm -f debian/tmp/etc/smail/COPYING
	cp -r samples/{bigsite,bsmtp,generic,queryprog} \
		debian/tmp/usr/doc/smail/examples/.
	$(installdoc) debian/README.sample debian/tmp/usr/doc/smail/examples/README
	cp guide/admin/[a-z]* debian/tmp/usr/doc/smail/guide
	$(installdoc) debian/guidemakefile debian/tmp/usr/doc/smail/guide/Makefile
	$(installdoc) debian/README.guide debian/tmp/usr/doc/smail/guide/README.guide
	$(installbin) debian/config debian/tmp/usr/sbin/smailconfig
	$(installbin) debian/stalelog debian/tmp/usr/lib/smail/stalelog
	$(installbin) contrib/striphdrs/striphdrs debian/tmp/usr/sbin/striphdrs
	sed -e 's/==VERSION==/$(version)/' debian/testmsg > debian/tmp/usr/sbin/smailtest 
	chmod 755 debian/tmp/usr/sbin/smailtest
	chown root.root debian/tmp/usr/sbin/smailtest
	find debian/tmp/usr/{sbin,lib} \! -type l -perm +111 -type f | \
	xargs file | grep executable| grep -v stripped|awk -F\: '{print $$1}'|xargs -r  strip 
	$(installbin) debian/preinst debian/tmp/DEBIAN/preinst
	$(installbin) debian/postinst debian/tmp/DEBIAN/postinst
	$(installbin) debian/prerm debian/tmp/DEBIAN/prerm
	$(installbin) debian/postrm debian/tmp/DEBIAN/postrm
	$(installdoc) debian/conffiles debian/tmp/DEBIAN/conffiles
	find debian/tmp -type d | xargs chmod g-s
	(cd debian/tmp/usr/man/ && gzip -9v `find -type f`)
	(cd debian/tmp/usr/doc/smail && gzip -9v `find -type f`)  
	$(installdoc) debian/tmp.copyright debian/tmp/usr/doc/smail/copyright
	chmod -R u+w,g-w debian/tmp/usr/{man,doc,sbin}
	chown -R root.root debian/tmp/usr/{man,doc,sbin}
	chown -R mail.root debian/tmp/var/spool/uumaps \
	         debian/tmp/{etc,usr/lib,var/lib,var/spool}/smail
	chmod  -R u+w,g-w debian/tmp/var/spool/uumaps \
		debian/tmp/{etc,usr/lib,var/lib,var/spool}/smail
	dpkg-shlibdeps debian/tmp/usr/sbin/smail
	dpkg-gencontrol
	dpkg --build debian/tmp ..


binary:	binary-indep binary-arch


define checkdir
	test -f src/smail.h
endef


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