File: rules

package info (click to toggle)
opensp 1.5pre5-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,860 kB
  • ctags: 8,918
  • sloc: cpp: 63,719; ansic: 10,494; sh: 7,592; makefile: 605; perl: 557; sed: 98
file content (302 lines) | stat: -rwxr-xr-x 9,514 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
#!/usr/bin/make -f
# rules file for opensp
#
# The principle of these rules files are simplicity, robustness,
# ease of maintenance, and readability through abstraction
#
# Some bytes in this file may have been touched by Ian Jackson,
# so I can never remove his name from this file.  Oh boy.
# 
# This file was modified from the jade rules file.

pkg		:= opensp
pkg-osp		:= $(pkg)
libosp-maj-ver	:= 2
pkg-libosp	:= libosp2
pkg-libosp-dev	:= libosp-dev
local-sgmldir	:= /usr/local/share/sgml

# default SGML pathing
default-catalogs	:= $(local-sgmldir)/catalog:/usr/local/lib/sgml/catalog:/usr/lib/sgml/catalog
default-sgml-path	:= $(local-sgmldir):/usr/local/lib/sgml:/usr/lib/sgml

# directory abstraction
prefix-osp	:= debian/tmp
bindir-osp	:= $(prefix-osp)/usr/bin
confdir-osp	:= $(prefix-osp)/etc
libdir-osp	:= $(prefix-osp)/usr/lib/$(pkg-osp)
sgmldir-osp	:= $(prefix-osp)/usr/share/sgml
docdir-osp	:= $(prefix-osp)/usr/share/doc/$(pkg-osp)
infodir-osp	:= $(prefix-osp)/usr/share/info
sharedir-osp	:= $(prefix-osp)/usr/share
mandir-osp	:= $(prefix-osp)/usr/share/man/man1

prefix-libosp	:= debian/$(pkg-libosp)
docdir-libosp	:= $(prefix-libosp)/usr/share/doc/$(pkg-libosp)
libdir-libosp	:= $(prefix-libosp)/usr/lib

prefix-libosp-dev	:= debian/$(pkg-libosp-dev)
incdir-libosp-dev	:= $(prefix-libosp-dev)/usr/include/OpenSP
docdir-libosp-dev	:= $(prefix-libosp-dev)/usr/share/doc/$(pkg-libosp-dev)
libdir-libosp-dev	:= $(prefix-libosp-dev)/usr/lib

# build tool abstraction
install_file	:= install -o root -g root -m 644 -p
install_script	:= install -o root -g root -m 755 -p
install_program	:= install -o root -g root -m 755 -p
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  install_program += --strip
endif
make_directory	:= install -d -o root -g root -m 755
compress	:= gzip -9f

CFLAGS		:= -O2 --pipe
CXXFLAGS	:= -O2 --pipe
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -g
  CXXFLAGS += -g
endif
export CFLAGS
export CXXFLAGS

# flags to get automake to use the above
am_inst_flags	:= INSTALL='install -o root -g root -p' INSTALL_PROGRAM='$(install_program)' INSTALL_SCRIPT='$(install_script)' INSTALL_DATA='$(install_file)'

# first version of package providing the right shlibs
SHLIBS_PKGVER	:= 1.5pre4-4

# extra docs we don't want
DOCS_TOO_MUCH	:= ABOUT-NLS COPYING ChangeLog

# determine our version numbers
SRC_VERSION	:= $(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | sed 's/^Version: *//')
UPSTREAM_VERSION:= $(shell echo $(SRC_VERSION) | sed -e 's/^\(.*\)-[^-]*$$/\1/')

# determine our top level
SRCDIR		:= $(shell pwd)

# stuff for snapshot/cvs building
root_cmd		:= sudo
deb_build		:= dpkg-buildpackage -ppgp -r$(root_cmd)
cvs_build_dir		:= $(HOME)/debian/$(pkg)
cvs_ver_build_dir	:= $(cvs_build_dir)/$(pkg)-$(UPSTREAM_VERSION)
cvs_pure_src_dir	:= ..
cvs_pure_src		:= $(pkg)


ChangeLog:
	[ ! -e OpenSP-$(UPSTREAM_VERSION) ]
	[ -f $(cvs_pure_src_dir)/$(pkg)_$(UPSTREAM_VERSION).orig.tar.gz ]
	tar -xzvf $(cvs_pure_src_dir)/$(pkg)_$(UPSTREAM_VERSION).orig.tar.gz \
		 OpenSP-$(UPSTREAM_VERSION)/ChangeLog
	mv OpenSP-$(UPSTREAM_VERSION)/ChangeLog .
	rm -r OpenSP-$(UPSTREAM_VERSION)

config.status Makefile:	ChangeLog
	aclocal
	autoheader
	libtoolize --force
	automake --add-missing
	autoconf
	./configure --prefix=/usr --sysconfdir=/etc			\
	   --mandir='$${prefix}/share/man'				\
	   --enable-http --enable-shared --enable-static		\
	   --enable-default-catalog=$(default-catalogs)			\
	   --enable-default-search-path=$(default-sgml-path)


build:	config.status Makefile
	$(checkdir)
	$(MAKE) SUBDIRS=lib CXXFLAGS="-O2 --pipe -D_REENTRANT"
	$(MAKE)
	touch build

clean:
	$(checkdir)
	[ ! -f Makefile ] || $(MAKE) clean
	[ ! -f Makefile ] || $(MAKE) maintainer-clean || true
	dh_clean build binary-arch debian/copyright	\
	    debian/$(pkg-libosp).shlibs debian/$(pkg-libosp-dev).substvars \
	    debian/README.Debian debian/$(pkg-libosp).README.Debian

binary-indep:	build
# There are no architecture-independent files to be uploaded
# generated by this package.

debian/copyright:	COPYING debian/copyright.Debian
#	 to ensure we have a verbatim copy of the upstream copyright, 
#	 cat the Debian-specific stuff to the end of the upstream file
	cat $^ > $@

debian/$(pkg-libosp-dev).substvars:
#	 indicate our providing version of shlibs; this must be
#	 sync'd with debian/control
	: > $@
	echo "opensp:Version=$(pkg-osp) (= $(SRC_VERSION))"            >> $@
	echo "libosp:Version=$(pkg-libosp) (= $(SRC_VERSION))"         >> $@
	echo "libosp:ShlibVersion=$(pkg-libosp) (>= $(SHLIBS_PKGVER))" >> $@

debian/$(pkg-libosp).shlibs:
#	 std shlibs file, with the first version that supplied the version
#	  that applications should build with
	echo "libosp      $(libosp-maj-ver) $(pkg-libosp) (>= $(SHLIBS_PKGVER))" > $@

debian/README.Debian:	debian/README.Debian.in
#	 substitute the catalog paths
	sed -e 's|%{default-catalogs}|$(default-catalogs)|;		\
		s|%{default-sgml-path}|$(default-sgml-path)|' $^ > $@

debian/$(pkg-libosp).README.Debian:	debian/$(pkg-libosp).README.Debian.in
#	 substitute the catalog paths
	sed -e 's|%{default-catalogs}|$(default-catalogs)|;		\
		s|%{default-sgml-path}|$(default-sgml-path)|' $^ > $@

install-common	:= build debian/copyright debian/$(pkg-libosp-dev).substvars \
		   debian/$(pkg-libosp).shlibs

install-opensp:	$(install-common) debian/README.Debian
	$(checkdir)
	$(checkroot)
	rm -rf $(prefix-osp)

	$(make_directory) $(bindir-osp) $(sgmldir-osp) $(libdir-osp)	\
	    $(mandir-osp)

	$(MAKE) install SUBDIRS="doc nsgmls sgmlnorm spam spcat spent sx" \
	    prefix=$(SRCDIR)/$(prefix-osp)/usr $(am_inst_flags)		\
	    pkgdocdir=$(docdir-osp)
#	 it insists on installing config.h
	rm -rf $(prefix-osp)/usr/include
#	 remove the extra docs installed from top-level Makefile
	cd $(docdir-osp) && rm -f $(DOCS_TOO_MUCH)

#	 install declarations
	$(make_directory) $(sgmldir-osp)/declaration
	$(install_file) pubtext/opensp-implied.dcl $(sgmldir-osp)/declaration/

#	 install unicode stuff
	$(make_directory) $(libdir-osp)/unicode
	$(install_file) unicode/catalog unicode/demo.sgm unicode/unicode.syn \
	    $(libdir-osp)/unicode
	$(install_file) unicode/unicode.sd $(libdir-osp)/unicode/unicode.decl
	$(install_script) unicode/gensyntax.pl $(libdir-osp)/unicode

#	 doc-base etc
	dh_installdocs -p$(pkg) doc/*.htm
#	 optionally, install upstream ChangeLog
	[ ! -f ChangeLog ] || dh_installchangelogs -p$(pkg) ChangeLog
	[ -f ChangeLog ] || dh_installchangelogs -p$(pkg)

#	 install man pages
	dh_undocumented -p$(pkg) onsgmls.1 osgmlnorm.1 ospam.1 ospcat.1	\
	    ospent.1 osx.1

#	 install control files
	dh_installdeb -p$(pkg)


install-libosp:	$(install-common) debian/$(pkg-libosp).README.Debian
	$(checkdir)
	$(checkroot)
	rm -rf $(prefix-libosp)

	$(make_directory) $(libdir-libosp)

	$(MAKE) install SUBDIRS="lib po"				\
	    prefix=$(SRCDIR)/$(prefix-libosp)/usr $(am_inst_flags)	\
	    pkgdocdir=$(docdir-libosp)
#	 it insists on installing config.h
	rm -rf $(prefix-libosp)/usr/include
#	 remove the extra docs installed from top-level Makefile
	cd $(docdir-libosp) && rm -f $(DOCS_TOO_MUCH)

	rm -f $(libdir-libosp)/*.so					\
	    $(libdir-libosp)/*.a $(libdir-libosp)/*.la

#	 install Debian-std docs
	dh_installdocs -p$(pkg-libosp)
#	 optionally, install upstream ChangeLog
	[ ! -f ChangeLog ] || dh_installchangelogs -p$(pkg-libosp) ChangeLog
	[ -f ChangeLog ] || dh_installchangelogs -p$(pkg-libosp)

#	 make sure maintainer scripts are good
	sh -n debian/$(pkg-libosp).postinst

#	 install control files
	dh_installdeb -p$(pkg-libosp)


install-libosp-dev:	$(install-common) debian/$(pkg-libosp).README.Debian
	$(checkdir)
	$(checkroot)
	rm -rf $(prefix-libosp-dev)

	$(make_directory) $(incdir-libosp-dev) $(libdir-libosp-dev)	\
	    $(docdir-libosp-dev)

	$(MAKE) install SUBDIRS="lib generic include"			\
	    prefix=$(SRCDIR)/$(prefix-libosp-dev)/usr $(am_inst_flags)	\
	    pkgdocdir=$(docdir-libosp-dev)
#	 remove the extra docs installed from top-level Makefile
	cd $(docdir-libosp-dev) && rm -f $(DOCS_TOO_MUCH)

	rm -f $(libdir-libosp-dev)/*.so.*

#	 install Debian-std docs
	dh_installdocs -p$(pkg-libosp-dev)
#	 optionally, install upstream ChangeLog
	[ ! -f ChangeLog ] || dh_installchangelogs -p$(pkg-libosp-dev) ChangeLog
	[ -f ChangeLog ] || dh_installchangelogs -p$(pkg-libosp-dev)

#	 install control files
	dh_installdeb -p$(pkg-libosp-dev)


binary-arch:	$(install-common) install-opensp install-libosp		\
		install-libosp-dev
	$(checkdir)
	$(checkroot)

	dh_strip -a
	dh_compress -a
	dh_fixperms -a

	dh_shlibdeps -l $(prefix-libosp)/usr/lib
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

	touch binary-arch

# cvs snapshot building
cvs-build:
	[ -d $(cvs_pure_src_dir)/$(cvs_pure_src)/CVS ] || exit 1
	$(root_cmd) rm -rf $(cvs_ver_build_dir)
#	rm -f $(cvs_build_dir)/$(pkg)_$(UPSTREAM_VERSION).orig.tar.gz
#	 don't do cvs up or make the changelog
	install -d -m 755 $(cvs_ver_build_dir)
#	GZIP=-9 tar czf $(cvs_build_dir)/$(pkg)_$(UPSTREAM_VERSION).orig.tar.gz \
#		-C $(cvs_pure_src_dir) --exclude CVS $(cvs_pure_src)
	tar cf - --exclude CVS . | tar xf - -C $(cvs_ver_build_dir)
	[ -f ChangeLog ] || cvs2cl -r -t -b
	cp ChangeLog $(cvs_ver_build_dir)/
	cd $(cvs_ver_build_dir) && $(deb_build)

define checkdir
	test -f debian/rules && test -d nsgmls
endef

# Below here is fairly generic really

define checkroot
	test `id -u` = 0
endef

binary:		binary-indep binary-arch

.PHONY: binary binary-indep clean

# vim: set syntax=makefile:
#Local variables:
#mode: makefile
#End: