dist.mk revision 62449
1139749Simp# $Id: dist.mk,v 1.207 2000/06/29 23:08:38 tom Exp $
299440Sbenno# Makefile for creating ncurses distributions.
399440Sbenno#
499440Sbenno# This only needs to be used directly as a makefile by developers, but
599440Sbenno# configure mines the current version number out of here.  To move
699440Sbenno# to a new version number, just edit this file and run configure.
799440Sbenno#
899440SbennoSHELL = /bin/sh
999440Sbenno
1099440Sbenno# These define the major/minor/patch versions of ncurses.
1199440SbennoNCURSES_MAJOR = 5
1299440SbennoNCURSES_MINOR = 1
1399440SbennoNCURSES_PATCH = 20000701
1499440Sbenno
1599440Sbenno# We don't append the patch to the version, since this only applies to releases
1699440SbennoVERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
1799440Sbenno
1899440SbennoDUMP	= lynx -dump
1999440SbennoDUMP2	= $(DUMP) -nolist
2099440Sbenno
2199440SbennoGNATHTML= `type -p gnathtml || type -p gnathtml.pl`
2299440Sbenno
2399440Sbenno# man2html 3.0.1 is a Perl script which assumes that pages are fixed size.
2499440Sbenno# Not all man programs agree with this assumption; some use half-spacing, which
2599440Sbenno# has the effect of lengthening the text portion of the page -- so man2html
2699440Sbenno# would remove some text.  The man program on Redhat 6.1 appears to work with
2799440Sbenno# man2html if we set the top/bottom margins to 6 (the default is 7).
2899440SbennoMAN2HTML= man2html -botm=6 -topm=6 -cgiurl '$$title.$$section$$subsection.html'
2999440Sbenno
3099440SbennoALL	= ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
3199440Sbenno
3299440Sbennoall :	$(ALL)
3399440Sbenno
3499440Sbennodist:	$(ALL)
3599440Sbenno	(cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
3699440Sbenno
3799440Sbennodistclean:
3899440Sbenno	rm -f $(ALL) subst.tmp subst.sed MANIFEST.tmp
3999440Sbenno
4099440Sbenno# Don't mess with announce.html.in unless you have lynx available!
4199440Sbennodoc/html/announce.html: announce.html.in
4299440Sbenno	sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
4399440Sbenno
4499440SbennoANNOUNCE : doc/html/announce.html
4599440Sbenno	$(DUMP) doc/html/announce.html > $@
4699440Sbenno
4799440Sbennodoc/ncurses-intro.doc: doc/html/ncurses-intro.html
4899440Sbenno	$(DUMP2) doc/html/ncurses-intro.html > $@
4999440Sbennodoc/hackguide.doc: doc/html/hackguide.html
5099440Sbenno	$(DUMP2) doc/html/hackguide.html > $@
5199440Sbenno
5299440Sbenno# Note that this rule assumes the manpages were installed - it does not use
5399440Sbenno# the copies in the build tree except to get the list of names.
5499440Sbennomanhtml: MANIFEST
5599440Sbenno	@rm -f doc/html/man/*.html
5699440Sbenno	@mkdir -p doc/html/man
5799440Sbenno	@rm -f subst.tmp ;
58129844Smarius	@for f in man/*.[0-9]*; do \
59129844Smarius	   m=`basename $$f` ;\
60129844Smarius	   x=`echo $$m | awk -F. '{print $$2;}'` ;\
6199440Sbenno	   xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
6299440Sbenno	   if [ "$${x}" != "$${xu}" ]; then \
6399440Sbenno	     echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
6499440Sbenno	   fi ;\
6599440Sbenno	done
6699440Sbenno	@sort < subst.tmp | uniq > subst.sed
6799440Sbenno	@rm -f subst.tmp
6899440Sbenno	@for f in man/*.[0-9]* ; do \
6999440Sbenno	   m=`basename $$f` ;\
70129876Sphk	   g=$${m}.html ;\
7199440Sbenno	   if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
7299440Sbenno	   echo "Converting $$m to HTML" ;\
7399440Sbenno	   man $$f | tr '\255' '-' | $(MAN2HTML) | \
7499440Sbenno	   sed -f subst.sed |\
7599440Sbenno	   sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
7699440Sbenno	   > doc/html/man/$$g ;\
7799440Sbenno	done
7899440Sbenno	@rm -f subst.sed
79109514Sobrien	@sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp
8099440Sbenno	@find ./doc/html/man -type f -print >> MANIFEST.tmp
8199440Sbenno	@chmod u+w MANIFEST
8299440Sbenno	@sort -u < MANIFEST.tmp > MANIFEST
8399440Sbenno	@rm -f MANIFEST.tmp
8499440Sbenno
8599440Sbenno#
8699440Sbenno# Please note that this target can only be properly built if the build of the
8799440Sbenno# Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
8899440Sbenno# .ali files generated by the Ada95 compiler during the build process.  These
8999440Sbenno# .ali files contain cross referencing information required by gnathtml.
9099440Sbennoadahtml: MANIFEST
9199440Sbenno	if [ ! -z "$(GNATHTML)" ]; then \
9299440Sbenno	  (cd ./Ada95/gen ; make html) ;\
9399440Sbenno	  sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\
94227908Smarius	  find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\
9599440Sbenno	  sort -u < MANIFEST.tmp > MANIFEST ;\
9699440Sbenno	  rm -f MANIFEST.tmp ;\
9799440Sbenno	fi
9899440Sbenno
9999440Sbenno# Prepare distribution for version control
10099440Sbennovcprepare:
10199440Sbenno	find . -type d -exec mkdir {}/RCS \;
102221407Smarius
10399440Sbenno# Write-lock almost all files not under version control.
10499440SbennoADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done')
10599440SbennoEXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS)
10699440Sbennowritelock:
10799440Sbenno	for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done
10899440Sbenno
109215720Smarius# This only works on a clean source tree, of course.
11099440SbennoMANIFEST:
111164827Smarius	-rm -f $@
112221407Smarius	touch $@
113221407Smarius	find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@
114221407Smarius
115221407SmariusTAGS:
116221407Smarius	etags */*.[ch]
117164827Smarius
118164827Smarius# Makefile ends here
119164827Smarius