File: rules

package info (click to toggle)
make 3.79.1-1.potato.1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,216 kB
  • ctags: 1,831
  • sloc: ansic: 23,189; sh: 2,896; perl: 966; makefile: 315
file content (215 lines) | stat: -rwxr-xr-x 7,624 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
#! /usr/bin/make -f
############################ -*- Mode: Makefile -*- ###########################
## rules ---
## Author           : Manoj Srivastava ( srivasta@tiamat.datasync.com )
## Created On       : Tue Mar  4 10:49:39 1997
## Created On Node  : tiamat.datasync.com
## Last Modified By : Manoj Srivastava
## Last Modified On : Mon Sep 11 14:42:14 2000
## Last Machine Used: glaurung.green-gryphon.com
## Update Count     : 53
## Status           : Unknown, Use with caution!
## HISTORY          :
## Description      :
##
###############################################################################

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: *//')
#

# The name of the package (for example, `emacs').
package   := make
d_package := make-doc

# Configuration variables (these should be pretty generic)
CC = cc
CFLAGS = -O2
PREFIX = /usr
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
MAN1DIR = $(MANDIR)/man1
DOCDIR = $(PREFIX)/share/doc/$(package)
INFODIR=$(PREFIX)/share/info

#  Package specific stuff.  The idea is to try to make the rules
#  generic (gradually).

FILES_TO_CLEAN  = TAGS tags make.aux make.cp make.cps make.fn \
                  make.fns make.toc debian/files config.cache \
                  make.dvi make.ps
DIRS_TO_CLEAN   = debian/tmp debian/tmp-doc debian/html
STAMPS_TO_CLEAN =  stamp-configure stamp-build stamp-binary stamp-doc \
                   stamp-html
SRCTOP := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
DOC_TOP=$(SRCTOP)/debian/tmp-doc
DOC_DOC=$(DOC_TOP)/usr/share/doc/$(d_package)
DOC_MENU=$(DOC_TOP)/usr/lib/menu
DOC_DBASE=$(DOC_TOP)/usr/share/doc-base

PKG_TOP=$(SRCTOP)/debian/tmp
PKG_DOC=$(PKG_TOP)/usr/share/doc/$(package)
PKG_MENU=$(PKG_TOP)/usr/lib/menu
PKG_DBASE=$(PKG_TOP)/usr/share/doc-base
PKG_INFO=$(PKG_TOP)/usr/share/info
PKG_MANDIR=$(PKG_TOP)/usr/share/man/
PKG_MAN=$(PKG_MANDIR)/man1
PKG_BIN=$(PKG_TOP)/usr/bin

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



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

all build: stamp-build
# Builds the binary package.

configure: stamp-configure

stamp-configure:
	./configure --verbose --prefix=$(PREFIX) --mandir=$(MANDIR) \
                    --infodir=$(INFODIR) --sysconfdir=/etc          \
                     && touch stamp-configure


stamp-build:
# Builds the binary package.
	$(checkdir)
	-test -f stamp-configure || $(MAKE) -f debian/rules configure
	$(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
	touch stamp-build

clean:
# Undoes the effect of `$(MAKE) -f debian/rules build'.
	$(checkdir)
	-test -f Makefile && $(MAKE) distclean
	-rm -f  $(FILES_TO_CLEAN) $(STAMPS_TO_CLEAN)
	-rm -rf $(DIRS_TO_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

binary: binary-indep binary-arch

binary-indep: html stamp-doc

stamp-doc: html
	@test 0 = $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || (echo need root priviledges; exit 1)
	$(checkdir)
	test -f stamp-configure|| $(MAKE) -f debian/rules configure
	rm -rf               $(DOC_TOP) $(DOC_TOP).deb
	$(make_directory)    $(DOC_TOP)/DEBIAN
	$(make_directory)    $(DOC_DOC)
	$(make_directory)    $(DOC_MENU)
	$(make_directory)    $(DOC_DBASE)
	$(MAKE)              make.ps
	$(install_file)      make.ps          	     $(DOC_DOC)
	$(install_file)      ChangeLog        	     $(DOC_DOC)/changelog
	$(install_file)      NEWS             	     $(DOC_DOC)/NEWS
	$(install_file)      debian/changelog 	     $(DOC_DOC)/changelog.Debian
	gzip -9fqr           $(DOC_DOC)/
# Make sure the copyright file is not compressed
	$(install_file)      debian/copyright        $(DOC_DOC)/copyright
	$(install_file)      debian/html/make_*.html $(DOC_DOC)/
	$(install_file)      debian/menuentry        $(DOC_MENU)/$(d_package)
	$(install_file)      debian/docentry         $(DOC_DBASE)/$(d_package)
	$(install_program)   debian/doc.postinst     $(DOC_TOP)/DEBIAN/postinst
	$(install_program)   debian/doc.postrm       $(DOC_TOP)/DEBIAN/postrm
	$(install_program)   debian/doc.prerm        $(DOC_TOP)/DEBIAN/prerm
	dpkg-gencontrol      -pmake-doc -isp         -P$(DOC_TOP)
	chown -R root.root   $(DOC_TOP)
	dpkg --build         $(DOC_TOP) ..
	touch                stamp-doc

binary-arch: build stamp-binary

stamp-binary:
# Makes a binary package.
	@test root = "`whoami`" || \
		(echo need root priviledges; exit 1)
	$(checkdir)
	test -f stamp-build  || $(MAKE) -f debian/rules build
	rm -rf               $(PKG_TOP) $(PKG_TOP).deb
	rm -f                $(PKG_INFO)/$(package).info*.gz
	$(make_directory)    $(PKG_TOP)
	$(make_directory)    $(PKG_TOP)/DEBIAN
	$(make_directory)    $(PKG_BIN)
	$(make_directory)    $(PKG_INFO)
	$(make_directory)    $(PKG_MAN)
	$(make_directory)    $(PKG_DOC)
	$(MAKE)              install           prefix=$(PKG_TOP)/usr \
	      infodir=$(PKG_INFO) mandir=$(PKG_MANDIR)
	$(install_file)      ChangeLog 	       $(PKG_DOC)/changelog
	$(install_file)      README 	       $(PKG_DOC)/README
	$(install_file)      NEWS 	       $(PKG_DOC)/NEWS
	$(install_file)      debian/changelog  $(PKG_DOC)/changelog.Debian
	gzip -9frq           $(PKG_DOC)/
# Make sure the copyright file is not compressed
	$(install_file)      debian/copyright  $(PKG_DOC)/copyright
	gzip -9fqr           $(PKG_MAN)/
	gzip -9fq            $(PKG_INFO)/$(package).info*
	$(install_program)   debian/postinst  $(PKG_TOP)/DEBIAN/postinst
	$(install_program)   debian/prerm $(PKG_TOP)/DEBIAN/prerm
	dpkg-shlibdeps       $(PKG_BIN)/make
	dpkg-gencontrol      -pmake -isp -P$(PKG_TOP)
	chown -R root.root   $(PKG_TOP)
	dpkg --build         $(PKG_TOP) ..
	touch                stamp-binary

html: stamp-html

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

checkroot:
	@test 0 = $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \
		(echo need root priviledges; exit 1)

define checkdir
	test -f  make.h -a -f debian/rules
endef

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


.PHONY: binary binary-arch binary-indep clean