File: rules

package info (click to toggle)
sdc 1.0.8beta-8
  • links: PTS
  • area: contrib
  • in suites: slink
  • size: 1,400 kB
  • ctags: 874
  • sloc: lisp: 8,120; ansic: 967; makefile: 671; perl: 136; sh: 50
file content (216 lines) | stat: -rwxr-xr-x 6,987 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
#!/usr/bin/make -f
# rules file for sgml-data
#
# I do not use debstd, debhelper, or any of that stuff.
# I believe in stripped down rules files; nothing that is not required
# I believe in 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.
# Also used extensively was debian/rules from Manoj Srivastava's
# 'make' package.

package		:= sdc

# directory abstraction
PREFIX		:= debian/tmp
bindir		:= $(PREFIX)/usr/bin
confdir		:= $(PREFIX)/etc/$(package)
libdir		:= $(PREFIX)/usr/lib/$(package)
sgmldir		:= $(PREFIX)/usr/lib/sgml
docdir		:= $(PREFIX)/usr/doc/$(package)
infodir		:= $(PREFIX)/usr/info
mandir		:= $(PREFIX)/usr/man/man1
docbasedir	:= $(PREFIX)/usr/share/doc-base

install_file	:= install -o root -g root -m 644 -p
install_program	:= install -o root -g root -m 755 -p
make_directory	:= install -d -o root -g root -m 755
compress	:= gzip -9f

clean:
	$(checkdir)
	rm -f build binary-indep binary-arch
	$(MAKE) clobber
	find . -name '*~' | xargs rm -f
	rm -rf bin/sdc debian/tmp debian/substvars pgptemp*


build:
	$(checkdir)
	DOCPATH=/usr/lib/sgml:`pwd`/sgml			\
	SGML_CATALOG_FILES=/etc/sgml.catalog:`pwd`/sgml/CATALOG	\
	$(MAKE) SR=/usr/lib/sdc DD=`pwd`/debian/tmp/usr/lib/sdc \
		PARSEPROG=nsgmls PARSEOPT=-E0 MKDIR=install CP=cp all
	touch build

binary-indep:	checkroot build
	$(checkdir)
	touch binary-indep

binary-arch:	checkroot build
	$(checkdir)
	rm -rf debian/tmp
	$(make_directory) $(PREFIX)/DEBIAN
	$(make_directory) $(bindir)
	$(make_directory) $(libdir)
	@echo
	@echo "*** Installing into debian/tmp"
	DOCPATH=/usr/lib/sgml:`pwd`/sgml			\
	SGML_CATALOG_FILES=/etc/sgml.catalog:`pwd`/sgml/CATALOG	\
	$(MAKE) SR=/usr/lib/sdc DD=`pwd`/$(libdir)		\
		WWW=`pwd`/$(docdir)				\
		INFO=`pwd`/$(infodir)				\
		MAN=`pwd`/$(mandir)				\
		prefix=`pwd`/$(PREFIX)/usr			\
		PARSEPROG=nsgmls MKDIR=install CP=cp install

	$(make_directory) $(docdir)
	$(make_directory) $(mandir)
	$(make_directory) $(infodir)
	$(make_directory) $(confdir)
	@echo
	@echo "*** Making documentation"
	@# note that there's a chicken/egg problem here, you have to
	@# have a working sdc installed to build this
	@# there is some sort of problem where gifs are not being created
	@# however, I'm making an attempt with these env vars
	DOCPATH=/usr/lib/sgml:`pwd`/sgml			\
	SGML_CATALOG_FILES=/etc/sgml.catalog:`pwd`/sgml/CATALOG	\
	$(MAKE) SR=/usr/lib/sdc DD=`pwd`/debian/tmp/usr/lib/sdc \
		WWW=`pwd`/$(docdir)				\
		INFO=`pwd`/$(infodir)				\
		MAN=`pwd`/$(mandir)				\
		prefix=`pwd`/$(PREFIX)/usr			\
		PARSEPROG=nsgmls MKDIR=install CP=cp		\
		installdoc
	ln -sf ../lib/sdc/bin/sdc $(bindir)/sdc

	# fix the perms
	chmod -R go=rX $(PREFIX)
	# move DTDs into std location
	$(make_directory) $(sgmldir)/dtd
	mv $(libdir)/sgml/*.dtd $(sgmldir)/dtd
	# make the nice links
	$(make_directory) $(sgmldir)/JFW/dtd
	set -e; for i in $(sgmldir)/dtd/* ; do				\
		ibase=`basename $$i`					;\
		ln -sf ../../dtd/$$ibase $(sgmldir)/JFW/dtd/$$ibase	;\
	done
	
	# move the local entities to $(confdir)
	mv $(libdir)/sgml/personal.data \
	   $(libdir)/sgml/target.ent \
	   $(libdir)/sgml/notation.ent \
	   $(libdir)/sgml/local.ent \
	   $(confdir)
	# move the remaining entities into std location, renaming them
	$(make_directory) $(sgmldir)/entities
	# rename the remaining entities
	for i in $(libdir)/sgml/*.ent ; do				\
		ibase=`basename $$i .ent`				;\
		mv $$i $(sgmldir)/entities/JFW$$ibase			;\
	done
	# make the nice links
	$(make_directory) $(sgmldir)/JFW/entities
	set -e; for i in $(sgmldir)/entities/JFW* ; do			\
		ibase=`basename $$i`					;\
		ln -sf ../../entities/$$ibase				\
		  $(sgmldir)/JFW/entities/$$ibase			;\
	done
	# hack up the catalog file to deal with std locations
	# and remove the DOCTYPE line
	perl -pi -e							\
		's|^DOCTYPE.*$$|| or					\
		 s|"([^"]+\.dtd)"|dtd/$$1| or				\
		 s^"(personal\.data|target\.ent|notation\.ent|local\.ent)"^/etc/sdc/$$1^ or \
		 s|"([^"]+)\.ent"|entities/JFW$$1|;			\
		 ' $(libdir)/sgml/CATALOG
	# move the CATALOG file into document dir
	mv $(libdir)/sgml/CATALOG $(docdir)
	# cleanup stuff
	rm -f $(libdir)/sgml/*.dst 
	rm -f $(libdir)/sgml/instdir

	# deal with config files
	# relocate $(libdir)/rc to $(confdir)/rc
	$(make_directory) $(confdir)/rc
	mv $(libdir)/rc/* $(confdir)/rc
	rmdir $(libdir)/rc
	ln -s /etc/$(package)/rc $(libdir)/rc
	# relocate from $(libdir)/include
	set -e; for i in layout.scm language.scm; do		\
		mv $(libdir)/include/$$i $(confdir)		;\
		ln -s /etc/$(package)/$$i $(libdir)/include/$$i	;\
	done

	# move our documentation files into place
	mv $(libdir)/doc/* $(docdir)
	# clean up the cruft, some of shouldn't exist in the first place
	rmdir $(libdir)/doc
	rm $(libdir)/Makefile
	rm -f $(docdir)/*-[012] $(docdir)/*.1 
	rm -f $(docdir)/*.aux $(docdir)/*.log
	rm -f $(docdir)/*.tmplout
	rm -f $(docdir)/nottest2*
	cd $(docdir) &&	uudecode *.uu
	rm -f $(docdir)/*.uu
	@echo
	@echo "*** Installing required Debian docs"
	mv $(docdir)/copyright.text $(docdir)/copyright
	echo "\
On Debian GNU/Linux systems, the complete text of the GNU General	\
Public License can be found in \`/usr/doc/copyright/GPL\'.		\
" >> $(docdir)/copyright
	$(install_file) debian/changelog $(docdir)/changelog.Debian
	$(install_file) debian/README.Debian debian/TODO.Debian $(docdir)
	# doc-base
	$(make_directory) $(docbasedir)
	$(install_file) debian/sdc.desc $(docbasedir)/sdc
	$(install_file) debian/sdc-man.desc $(docbasedir)/sdc-man
	#$(install_file) debian/sdc-targets.desc $(docbasedir)/sdc-targets
	DOCPATH=/usr/lib/sgml:`pwd`/sgml			\
	SGML_CATALOG_FILES=/etc/sgml.catalog:`pwd`/sgml/CATALOG	\
	$(bindir)/sdc -O ascii -o $(docdir)/changelog $(docdir)/Changes.sgml
	chmod go=rX $(docdir)/changelog

	# move example into place
	$(make_directory) $(docdir)/examples
	mv $(libdir)/example-personal.data $(docdir)/examples/personal.data

	# compress docdir (policy)	
	find $(infodir) $(mandir) -type f | xargs $(compress)
	find $(docdir) -type f \( -size +4k -or -iname "change*" \) \
            ! -name "*.html" ! -name "*.gif" \
            ! -name "copyright" | xargs $(compress)

	# move in our control files
	$(make_directory) $(PREFIX)/DEBIAN
	$(install_program) debian/postinst debian/prerm debian/postrm \
	   $(PREFIX)/DEBIAN
	$(install_file) debian/conffiles $(PREFIX)/DEBIAN
	$(make_directory) $(PREFIX)/usr/lib/menu
	$(install_file) debian/menu $(PREFIX)/usr/lib/menu/$(package)

	@# put it all together
	dpkg-shlibdeps $(bindir)/sdc
	dpkg-gencontrol -isp
	dpkg --build $(PREFIX) ..
	touch binary-arch

define checkdir
	test -f bin/typeset.scm -a -f debian/rules
endef

binary:	binary-indep binary-arch

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

checkroot:
	test root = "`whoami`" || (echo need root priviledges; exit 1)

.PHONY: binary clean checkroot

# these targets should be redone when this Makefile has changed
binary-indep binary-arch: debian/rules