File: rules

package info (click to toggle)
vm 7.03-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,224 kB
  • ctags: 1,936
  • sloc: lisp: 29,095; sh: 499; makefile: 385; ansic: 275
file content (251 lines) | stat: -rwxr-xr-x 9,906 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#!/usr/bin/make -f
############################ -*- Mode: Makefile -*- ###########################
## rules ---
## Author           : Manoj Srivastava ( srivasta@tiamat.datasync.com )
## Created On       : Tue Feb 11 15:39:24 1997
## Created On Node  : tiamat.datasync.com
## Last Modified By : Manoj Srivastava
## Last Modified On : Mon Mar 19 09:43:56 2001
## Last Machine Used: glaurung.green-gryphon.com
## Update Count     : 116
## Status           : Unknown, Use with caution!
## HISTORY          :
## Description      :
##
###############################################################################
# The name of the package (for example, `emacs').
package = $(shell grep Source debian/control | sed 's/^Source: //')
version := $(shell perl -n0777e 'if ($$. == 1 && m/\(([\S]+)\)/o){print "$$1\n";}' debian/changelog)

ifdef ARCH
  ha:=-a$(ARCH)
endif

# set the dpkg-architecture vars
export DEB_BUILD_ARCH      := $(shell dpkg-architecture $(ha) \
                                        -qDEB_BUILD_ARCH)
export DEB_BUILD_GNU_CPU   := $(shell dpkg-architecture $(ha) \
                                        -qDEB_BUILD_GNU_CPU)
export DEB_BUILD_GNU_SYSTEM:= $(shell dpkg-architecture $(ha) \
                                        -qDEB_BUILD_GNU_SYSTEM)
export DEB_BUILD_GNU_TYPE  := $(shell dpkg-architecture $(ha) \
                                        -qDEB_BUILD_GNU_TYPE)
export DEB_HOST_ARCH       := $(shell dpkg-architecture $(ha) \
                                        -qDEB_HOST_ARCH)
export DEB_HOST_GNU_CPU    := $(shell dpkg-architecture $(ha) \
                                        -qDEB_HOST_GNU_CPU)
export DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture $(ha) \
                                        -qDEB_HOST_GNU_SYSTEM)
export DEB_HOST_GNU_TYPE   := $(shell dpkg-architecture $(ha) \
                                        -qDEB_HOST_GNU_TYPE)

#
# VERSION=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | \
#                          sed 's/^Version: *//')
#

FILES_TO_CLEAN  := vm.elc vm.info* debian/files debian/substvars \
                   debian/buildinfo base64-decode base64-encode \
                   qp-decode qp-encode
STAMPS_TO_CLEAN := stamp-binary stamp-build stamp-html stamp-el \
                   stamp-codec stamp-info
DIRS_TO_CLEAN   := debian/tmp debian/tmp-el debian/html debian/codec

# Location of the source dir
SRCTOP := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi;)
TMPTOP    := $(SRCTOP)/debian/tmp
INFODIR   := $(TMPTOP)/usr/share/info
DOCDIR    := $(TMPTOP)/usr/share/doc/$(package)
DOCBASE   := $(TMPTOP)/usr/share/doc-base
MENUDIR   := $(TMPTOP)/usr/lib/menu
LISPDIR   := $(TMPTOP)/usr/share/emacs/site-lisp/$(package)
PIXMAPDIR := $(LISPDIR)/etc
STARTDIRS := $(TMPTOP)/etc/emacs19/site-start.d
COMPILEDIR:= $(TMPTOP)/usr/lib/emacsen-common/packages/
STARTFILE := $(package)-init.el

MTMPTOP    := $(SRCTOP)/debian/codec
MDOCDIR    := $(MTMPTOP)/usr/share/doc/mime-codecs
MBINDIR    := $(MTMPTOP)/usr/bin
MMANDIR    := $(MTMPTOP)/usr/share/man
MMAN1DIR    := $(MMANDIR)/man1
LINTIANDIR:= $(TMPTOP)/usr/share/lintian/overrides

CC          := gcc
CFLAGS      := -O2 -Wall

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -g
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  STRIP = -s
endif

# install commands
install_file    := install -p    -o root -g root -m 644
install_program := install -p    -o root -g root -m 755
make_directory  := install -p -d -o root -g root -m 755

all build: stamp-build
stamp-build:
	$(checkdir)
# This used to be needed for older dpkg-sources
#-test ! -d debian/examples && $(MAKE) -f debian/rules explode
#$(MAKE) INFODIR=$(INFODIR) LISPDIR=$(LISPDIR) PIXMAPDIR=$(PIXMAPDIR);
	$(CC) $(CFLAGS) base64-decode.c -o base64-decode
	$(CC) $(CFLAGS) base64-encode.c -o base64-encode
	$(CC) $(CFLAGS) qp-decode.c     -o qp-decode
	$(CC) $(CFLAGS) qp-encode.c     -o qp-encode
	dpkg -l gcc perl dpkg 'libc*' binutils ldso make dpkg-dev |\
         awk '$$1 == "ii" { printf("%s-%s\n", $$2, $$3) }' > \
          debian/buildinfo
	touch stamp-build

clean:
	$(checkdir)
	-rm -f $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
	-rm -rf $(DIRS_TO_CLEAN)
	-$(MAKE) clean
	-rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
                -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS

implode:
	$(checkdir)
	-test -d debian/examples && (cd debian && \
	   tar zfc debian.tar.gz examples && \
             uuencode debian.tar.gz debian.tar.gz > debian.uue \
	       && rm -f debian.tar.gz )
explode:
	$(checkdir)
	-test ! -d debian/examples && (cd debian && uudecode debian.uue \
	   && tar zfx debian.tar.gz && rm -f debian.tar.gz )

binary: binary-arch binary-indep
binary-arch: build stamp-codecs


# builds the architecture dependent part
stamp-codecs: build
	@test 0 = $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
                   (echo need root priviledges; exit 1)
	$(checkdir)
	rm -rf $(MTMPTOP) debian/codec.deb
	$(make_directory)  $(MTMPTOP)/DEBIAN
	$(make_directory)  $(MMAN1DIR)
	$(make_directory)  $(MBINDIR)
	$(make_directory)  $(MDOCDIR)
	$(make_directory)  $(LINTIANDIR)
	echo               'mime-codecs: postinst-does-not-set-usr-doc-link' \
                             >> $(LINTIANDIR)/mime-codecs
	$(install_program) debian/postinst.codec $(MTMPTOP)/DEBIAN/postinst
	$(install_program) debian/prerm.codec    $(MTMPTOP)/DEBIAN/prerm
	$(install_program) $(STRIP)              base64-decode $(MBINDIR)
	$(install_program) $(STRIP)              base64-encode $(MBINDIR)
	$(install_program) $(STRIP)              qp-decode     $(MBINDIR)
	$(install_program) $(STRIP)              qp-encode     $(MBINDIR)
	$(install_file)    base64-decode.1       $(MMAN1DIR)
	$(install_file)    base64-encode.1       $(MMAN1DIR)
	$(install_file)    qp-decode.1           $(MMAN1DIR)
	$(install_file)    qp-encode.1           $(MMAN1DIR)
	$(install_file)    debian/README.debian  $(MDOCDIR)
	$(install_file)    debian/changelog      $(MDOCDIR)/changelog.Debian
	$(install_file)    debian/buildinfo      $(MDOCDIR)/buildinfo.Debian
	gzip -9fqr	   $(MMANDIR)
	gzip -9fqr	   $(MDOCDIR)
	$(install_file)    debian/copyright      $(MDOCDIR)
	dpkg-shlibdeps     base64-decode base64-encode qp-decode qp-encode
	dpkg-gencontrol    -pmime-codecs -isp -P$(MTMPTOP)
	chown -R root.root $(MTMPTOP)
	chmod -R go=rX     $(MTMPTOP)
	dpkg --build       $(MTMPTOP) ..
	touch              stamp-codecs

binary-indep: build html info stamp-binary

stamp-binary: html info
	@test 0 = $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
                   (echo need root priviledges; exit 1)
	$(checkdir)
	rm -rf $(TMPTOP)  debian/tmp.deb
	$(make_directory)  $(TMPTOP)/DEBIAN
	$(make_directory)  $(INFODIR)
	$(make_directory)  $(LISPDIR)
	$(make_directory)  $(PIXMAPDIR)
	$(make_directory)  $(STARTDIRS)
	$(make_directory)  $(DOCDIR)/examples
	$(make_directory)  $(PIXMAPDIR)
	$(make_directory)  $(DOCBASE)
	$(make_directory)  $(MENUDIR)
	$(make_directory)  $(COMPILEDIR)/install
	$(make_directory)  $(COMPILEDIR)/remove
	$(make_directory)  $(LINTIANDIR)
	echo               "vm: postinst-does-not-set-usr-doc-link" \
                             >> $(LINTIANDIR)/vm
	$(install_file)    make-autoloads        $(LISPDIR)
	$(install_file)    Makefile *.el         $(LISPDIR)
	$(install_file)    debian/$(STARTFILE)   $(LISPDIR)
	$(install_file)    pixmaps/*.xbm         $(PIXMAPDIR)
	$(install_file)    pixmaps/*.xpm         $(PIXMAPDIR)
	$(install_file)    vm.info*              $(INFODIR)/
	$(install_file)    debian/changelog      $(DOCDIR)/changelog.Debian
	$(install_file)    debian/README.debian  $(DOCDIR)
	$(install_file)    debian/README.hilit19 $(DOCDIR)
	$(install_file)    vm-vars.el            $(DOCDIR)
	$(install_file)    README                $(DOCDIR)
	$(install_file)    debian/buildinfo      $(DOCDIR)/buildinfo.Debian
	(cd debian/examples;  tar cf - * | (cd $(DOCDIR)/examples;tar xf -))
	(cd pixmaps;          tar cf - * | (cd $(PIXMAPDIR);      tar xf -))
	rm -rf             $(DOCDIR)/examples/CVS
	gzip -9fqr	   $(INFODIR)/
	gzip -9frq         $(DOCDIR)/
# Make sure the copyright file is not compressed
	$(install_file)    debian/copyright      $(DOCDIR)/copyright
	$(install_file)    debian/html/vm_*.html $(DOCDIR)/
	$(install_file)    debian/menuentry      $(MENUDIR)/$(package)
	$(install_file)    debian/docentry       $(DOCBASE)/$(package)
	$(install_program) debian/postinst       $(TMPTOP)/DEBIAN/postinst
	$(install_program) debian/prerm          $(TMPTOP)/DEBIAN/prerm
	$(install_program) debian/postrm         $(TMPTOP)/DEBIAN/postrm
	sed                -e 's/=P/$(package)/g' -e 's/=V/$(version)/g' \
                              debian/emacsen.install > \
			   $(COMPILEDIR)/install/$(package)
	sed                -e 's/=P/$(package)/g' -e 's/=V/$(version)/g' \
                              debian/emacsen.remove  > \
			   $(COMPILEDIR)/remove/$(package)
	chmod 0755         $(COMPILEDIR)/install/$(package) \
                           $(COMPILEDIR)/remove/$(package)
	dpkg-gencontrol    -pvm -isp -P$(TMPTOP)
	chown -R root.root $(TMPTOP)
	chmod -R go=rX     $(TMPTOP)
	dpkg --build       $(TMPTOP) ..
	touch              stamp-binary

html: stamp-html

stamp-html:
	$(checkdir)
	$(make_directory) debian/html
	(cd debian/html; \
	 texi2html -doctype html2 -expandinfo -menu \
		   -split_chapter -verbose  ../../vm.texinfo)
	touch stamp-html

info: stamp-info

stamp-info:
	$(checkdir)
	$(MAKE) vm.info
	touch stamp-info

define checkdir
	@test -f debian/rules -a -f vm-license.el || \
          (echo Not in correct source directpry; exit 1)
endef

# Below here is fairly generic really

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

.PHONY: binary binary-arch binary-indep clean implode explode