File: rules

package info (click to toggle)
troffcvt 1.04%2Brepack1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,416 kB
  • sloc: ansic: 13,110; makefile: 6,847; perl: 1,583; cpp: 333; sh: 215
file content (190 lines) | stat: -rwxr-xr-x 5,002 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
#! /usr/bin/make -f
#
# debian/rules file - for troffcvt.
#
# Copyright 1996, 1997 by Ben Pfaff.
# Copyright 2001-2022 by Colin Watson.
# Original Makefile by Ian Jackson.
#
# This Makefile 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; either version 2 of the
# License, or (at your option) any later version.
#
# This Makefile 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., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

export package=troffcvt

# It's really not a good idea to hard-code this, but we're guaranteed
# a FSSTND filesystem under Debian GNU/Linux so we might as well take
# advantage of it.  NOTE: Our utilities must come before /usr/bin,
# otherwise if the package is already installed there may be
# interference.
export PATH=$(CURDIR)/debian/build:/bin:/usr/bin:/usr/bin/X11

export TROFFCVT_LIB_DIR=$(CURDIR)/debian/troffcvt/usr/share/troffcvt

docdir=usr/share/doc/$(package)

# Most packages depend on these tools.
tools = debian/build/_x_ imboot/_b_ msub/_b_ WRPRC/_b_

include /usr/share/dpkg/buildflags.mk

#
# Main targets
#

build-indep:

build-arch:
	dh_testdir
	$(MAKE) -f debian/rules _b_
	touch $@

build: build-indep build-arch

clean:
	dh_testdir
	# Exclude several files that are part of upstream tarballs.
	dh_clean \
		-XWRPRC/config/Imake.rules~ \
		-XWRPRC/config/hp.cf.orig \
		-Xpost/rtf-fonts.orig \
		-Xtblcvt/tblcvt.pl~

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Install into debian/troffcvt.
	make install install.man \
		LIBDIR=$(CURDIR)/debian/troffcvt/usr/share/troffcvt \
		USRLIBDIR=$(CURDIR)/debian/troffcvt/usr/share/troffcvt \
		LOCALROOTDIR=$(CURDIR)/debian/troffcvt/usr \
		MANROOT=$(CURDIR)/debian/troffcvt/usr/share/man \

	# Convert documentation to HTML.
	(cd doc; \
	for d in *.ms; do \
	    soelim $$d | tblcvt | troff2html -ms tmac.wrprc -a tc.wrprc-html - \
		> ../debian/troffcvt/usr/share/doc/$(package)/`echo $$d | sed -e 's/\.ms/\.html/'`; \
	done)

binary-indep:	build
# There are no architecture-independent files.

binary-arch:	build install debian/docs
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman
	dh_installchangelogs
	dh_link
	dh_strip
	dh_compress $(docdir)/Changes-1.01 $(docdir)/Changes-1.02 \
		    $(docdir)/Changes-1.03 $(docdir)/Changes-1.04
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

#
# Miscellaneous
#

binary:		binary-indep binary-arch


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

#
# Build targets.
#
define build-link-farm
set -e; \
file_list=`find subdir -name \*.[ah] -o -perm /111 -a -type f`; \
for d in $$file_list; do \
	ln -sf ../../$$d debian/build/; \
done
endef

debian/build/_x_:
	mkdir -p debian/build
	touch $@

imboot/_b_: debian/build/_x_
	sed imboot/imboot.pl > debian/build/imboot \
		-e "s#\$$(PERLPATH)#`which perl`#" \
		-e "s#\$$(CONFIGROOTDIR)#`pwd`/config#"
	chmod a+x debian/build/imboot
	touch imboot/_b_

msub/_b_: debian/build/_x_ imboot/_b_
	gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) msub/msub.c -o debian/build/msub
	touch msub/_b_

WRPRC/_b_: debian/build/_x_ msub/_b_
	sed WRPRC/config/site.def > WRPRC/config/site.def.temp \
		-e "s%^#define ConfigRootDir .*\$$%#define ConfigRootDir \"`pwd`/config\"%"
	mv WRPRC/config/site.def.temp WRPRC/config/site.def
	(set -e; cd WRPRC; make World; make install)
	touch WRPRC/_b_

portlib/_b_: $(tools)
	make -C portlib World \
		INCLUDES="-I $(CURDIR)/debian/build" \
		CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \
		LDFLAGS="$(LDFLAGS) -L $(CURDIR)/debian/build"
	$(build-link-farm:subdir=portlib)
	touch $@

etm/_b_: $(tools)
	make -C etm World \
		INCLUDES="-I $(CURDIR)/debian/build" \
		CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \
		LDFLAGS="$(LDFLAGS) -L $(CURDIR)/debian/build"
	$(build-link-farm:subdir=etm)
	touch $@

tokenscan/_b_: $(tools)
	make -C tokenscan World \
		INCLUDES="-I $(CURDIR)/debian/build" \
		CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \
		LDFLAGS="$(LDFLAGS) -L $(CURDIR)/debian/build"
	$(build-link-farm:subdir=tokenscan)
	touch $@

memmgr/_b_: $(tools)
	make -C memmgr World \
		INCLUDES="-I $(CURDIR)/debian/build" \
		CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \
		LDFLAGS="$(LDFLAGS) -L $(CURDIR)/debian/build"
	$(build-link-farm:subdir=memmgr)
	touch $@

_b_: portlib/_b_ etm/_b_ tokenscan/_b_ memmgr/_b_
	make World \
		INCLUDES="-I $(CURDIR)/debian/build" \
		CCOPTIONS="$(CPPFLAGS) $(CFLAGS)" \
		LDFLAGS="$(LDFLAGS) -L $(CURDIR)/debian/build"
	$(build-link-farm:subdir=troffcvt)
	$(build-link-farm:subdir=tblcvt)
	$(build-link-farm:subdir=post)
	touch $@

# Local Variables:
# mode:makefile
# End: