dist.mk revision 76726
176726Speter# $Id: dist.mk,v 1.247 2001/05/12 18:18:37 tom Exp $
250276Speter# Makefile for creating ncurses distributions.
350276Speter#
450276Speter# This only needs to be used directly as a makefile by developers, but
550276Speter# configure mines the current version number out of here.  To move
650276Speter# to a new version number, just edit this file and run configure.
750276Speter#
850276SpeterSHELL = /bin/sh
950276Speter
1050276Speter# These define the major/minor/patch versions of ncurses.
1150276SpeterNCURSES_MAJOR = 5
1276726SpeterNCURSES_MINOR = 2
1376726SpeterNCURSES_PATCH = 20010512
1450276Speter
1550276Speter# We don't append the patch to the version, since this only applies to releases
1650276SpeterVERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
1750276Speter
1850276SpeterDUMP	= lynx -dump
1950276SpeterDUMP2	= $(DUMP) -nolist
2050276Speter
2162449SpeterGNATHTML= `type -p gnathtml || type -p gnathtml.pl`
2250276Speter
2362449Speter# man2html 3.0.1 is a Perl script which assumes that pages are fixed size.
2462449Speter# Not all man programs agree with this assumption; some use half-spacing, which
2562449Speter# has the effect of lengthening the text portion of the page -- so man2html
2662449Speter# would remove some text.  The man program on Redhat 6.1 appears to work with
2762449Speter# man2html if we set the top/bottom margins to 6 (the default is 7).
2862449SpeterMAN2HTML= man2html -botm=6 -topm=6 -cgiurl '$$title.$$section$$subsection.html'
2962449Speter
3062449SpeterALL	= ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
3162449Speter
3250276Speterall :	$(ALL)
3350276Speter
3450276Speterdist:	$(ALL)
3550276Speter	(cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
3650276Speter
3750276Speterdistclean:
3862449Speter	rm -f $(ALL) subst.tmp subst.sed MANIFEST.tmp
3950276Speter
4050276Speter# Don't mess with announce.html.in unless you have lynx available!
4162449Speterdoc/html/announce.html: announce.html.in
4262449Speter	sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
4350276Speter
4462449SpeterANNOUNCE : doc/html/announce.html
4562449Speter	$(DUMP) doc/html/announce.html > $@
4650276Speter
4762449Speterdoc/ncurses-intro.doc: doc/html/ncurses-intro.html
4862449Speter	$(DUMP2) doc/html/ncurses-intro.html > $@
4962449Speterdoc/hackguide.doc: doc/html/hackguide.html
5062449Speter	$(DUMP2) doc/html/hackguide.html > $@
5150276Speter
5276726SpeterMANPROG	= tbl | nroff -man
5376726Speter
5462449Spetermanhtml: MANIFEST
5562449Speter	@rm -f doc/html/man/*.html
5662449Speter	@mkdir -p doc/html/man
5762449Speter	@rm -f subst.tmp ;
5862449Speter	@for f in man/*.[0-9]*; do \
5962449Speter	   m=`basename $$f` ;\
6062449Speter	   x=`echo $$m | awk -F. '{print $$2;}'` ;\
6162449Speter	   xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
6262449Speter	   if [ "$${x}" != "$${xu}" ]; then \
6362449Speter	     echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
6462449Speter	   fi ;\
6562449Speter	done
6662449Speter	@sort < subst.tmp | uniq > subst.sed
6762449Speter	@rm -f subst.tmp
6862449Speter	@for f in man/*.[0-9]* ; do \
6962449Speter	   m=`basename $$f` ;\
7062449Speter	   g=$${m}.html ;\
7162449Speter	   if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
7262449Speter	   echo "Converting $$m to HTML" ;\
7376726Speter	   man/edit_man.sh editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) | \
7462449Speter	   sed -f subst.sed |\
7562449Speter	   sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
7662449Speter	   > doc/html/man/$$g ;\
7762449Speter	done
7862449Speter	@rm -f subst.sed
7962449Speter	@sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp
8062449Speter	@find ./doc/html/man -type f -print >> MANIFEST.tmp
8162449Speter	@chmod u+w MANIFEST
8262449Speter	@sort -u < MANIFEST.tmp > MANIFEST
8362449Speter	@rm -f MANIFEST.tmp
8462449Speter
8562449Speter#
8662449Speter# Please note that this target can only be properly built if the build of the
8762449Speter# Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
8862449Speter# .ali files generated by the Ada95 compiler during the build process.  These
8962449Speter# .ali files contain cross referencing information required by gnathtml.
9062449Speteradahtml: MANIFEST
9162449Speter	if [ ! -z "$(GNATHTML)" ]; then \
9262449Speter	  (cd ./Ada95/gen ; make html) ;\
9362449Speter	  sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\
9462449Speter	  find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\
9562449Speter	  sort -u < MANIFEST.tmp > MANIFEST ;\
9662449Speter	  rm -f MANIFEST.tmp ;\
9762449Speter	fi
9862449Speter
9950276Speter# Prepare distribution for version control
10050276Spetervcprepare:
10150276Speter	find . -type d -exec mkdir {}/RCS \;
10250276Speter
10350276Speter# Write-lock almost all files not under version control.
10450276SpeterADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done')
10550276SpeterEXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS)
10650276Speterwritelock:
10750276Speter	for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done
10850276Speter
10950276Speter# This only works on a clean source tree, of course.
11050276SpeterMANIFEST:
11150276Speter	-rm -f $@
11250276Speter	touch $@
11350276Speter	find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@
11450276Speter
11550276SpeterTAGS:
11650276Speter	etags */*.[ch]
11750276Speter
11850276Speter# Makefile ends here
119