File: rules

package info (click to toggle)
troffcvt 1.04-21
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 2,232 kB
  • ctags: 27
  • sloc: makefile: 158
file content (262 lines) | stat: -rwxr-xr-x 6,701 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
252
253
254
255
256
257
258
259
260
261
262
#! /usr/bin/make -f
#
# debian/rules file - for troffcvt.
#
# Copyright 1996, 1997 by Ben Pfaff.
# Copyright 2001 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.
#
# The author may be contacted at <pfaffben@pilot.msu.edu> on the
# Internet, or as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA
# through more mundane means.

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)/lib:/bin:/usr/bin:/usr/bin/X11

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

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

# troffcvt version.
troffcvt_version = 1.04

# Checker with version.
export troffcvt = troffcvt-$(troffcvt_version)

packages = $(wrprc) $(etm) $(imboot) $(memmgr) $(msub) $(portlib) \
	$(tokenscan) $(troffcvt)

# Most packages depend on these tools.
tools = lib/_x_ $(imboot)/_b_ $(msub)/_b_ $(wrprc)/_b_

# Dependent library versions
wrprc_version = 2.11
etm_version = 1.09
imboot_version = 1.03
memmgr_version = 1.04
msub_version = 1.13
portlib_version = 1.01
tokenscan_version = 1.08

# Package directory names
wrprc = WRPRC-$(wrprc_version)
etm = etm
imboot = imboot-$(imboot_version)
memmgr = memmgr-$(memmgr_version)
msub = msub-$(msub_version)
portlib = portlib-$(portlib_version)
tokenscan = tokenscan

CCOPTIONS := $(shell dpkg-buildflags --get CPPFLAGS)
CCOPTIONS += $(shell dpkg-buildflags --get CFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

#
# Main targets
#

build-indep:

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

build: build-indep build-arch

wrprc: $(wrprc)/_b_
etm: $(etm)/_b_
imboot: $(imboot)/_b_
memmgr: $(memmgr)/_b_
msub: $(msub)/_b_
portlib: $(portlib)/_b_
tokenscan: $(tokenscan)/_b_

unpack: lib/_x_ config/_x_ $(wrprc)/_x_ $(imboot)/_x_ $(msub)/_x_	\
	$(portlib)/_x_ $(troffcvt)/_x_ memmgr-$(memmgr_version)/_x_	\
	etm/_x_ tokenscan/_x_

patch: unpack

clean:
	dh_testdir
	dh_clean
	-rm -rf $(packages)
	-rm -rf config lib

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# Install into debian/troffcvt.
	make install install.man -C $(troffcvt) \
		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 $(troffcvt)/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)

debian/docs: debian/docs.in
	sed -e 's,@troffcvt@,$(troffcvt),g' $< > $@

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`; \
cd lib; \
for d in $$file_list; do \
	ln -sf ../$$d .; \
done
endef

define build-easy-library
set -e; \
cd subdir ; \
make World \
	INCLUDES="-I `pwd`/../lib" \
	CCOPTIONS="$(CCOPTIONS)" \
	LDFLAGS="$(LDFLAGS) -L `pwd`/../lib"
$(build-link-farm)
cd subdir ; \
touch _b_
endef

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

$(msub)/_b_: lib/_x_ $(imboot)/_b_ $(msub)/_x_
	gcc $(CCOPTIONS) $(LDFLAGS) $(msub)/msub.c -o lib/msub
	touch $(msub)/_b_

$(wrprc)/_b_: lib/_x_ config/_x_ $(msub)/_b_ $(wrprc)/_x_
	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) $(portlib)/_x_
	$(build-easy-library:subdir=$(portlib))

$(etm)/_b_: $(tools) $(etm)/_x_
	$(build-easy-library:subdir=$(etm))

$(tokenscan)/_b_: $(tools) $(tokenscan)/_x_
	$(build-easy-library:subdir=$(tokenscan))

$(memmgr)/_b_: $(tools) $(memmgr)/_x_
	$(build-easy-library:subdir=$(memmgr))

$(troffcvt)/_b_: $(portlib)/_b_ $(etm)/_b_ $(tokenscan)/_b_ $(memmgr)/_b_ $(troffcvt)/_x_
	$(build-easy-library:subdir=$(troffcvt))

#
# Extract (_x_) targets
#
# The troffcvt libraries have the nasty property of changing form
# after being compiled.  Instead of dealing with this 
#

lib/_x_:
	rm -rf lib
	mkdir lib
	touch lib/_x_

config/_x_:
	rm -rf config
	mkdir config
	touch config/_x_

$(wrprc)/_x_ $(imboot)/_x_ $(msub)/_x_ \
	$(portlib)/_x_ $(troffcvt)/_x_: \
	%/_x_: tarballs/%.tar
	! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%)
	tar xf tarballs/$(@:%/_x_=%).tar
	test -f patches/$(@:%/_x_=%).diff	\
	  && (set -e; cd $(@:%/_x_=%); \
	      patch -s -p1 < ../patches/$(@:%/_x_=%).diff) \
	  || true
	touch $@

memmgr-$(memmgr_version)/_x_: tarballs/MemMgr-$(memmgr_version).tar
	! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%)
	tar xf tarballs/MemMgr-$(memmgr_version).tar
	touch $@

etm/_x_: tarballs/ETM-$(etm_version).tar
	! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%)
	tar xf tarballs/ETM-$(etm_version).tar
	touch $@

tokenscan/_x_: tarballs/TS-$(tokenscan_version).tar
	! test -e $(@:%/_x_=%) || rm -rf $(@:%/_x_=%)
	tar xf tarballs/TS-$(tokenscan_version).tar
	touch $@

# Local Variables:
# mode:makefile
# End: