dist.mk revision 97049
197049Speter# $Id: dist.mk,v 1.303 2002/05/18 19:18:04 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
1397049SpeterNCURSES_PATCH = 20020518
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
6697049Speter	# change some things to make weblint happy:
6797049Speter	@echo 's/<B>/<STRONG>/g'     >> subst.tmp
6897049Speter	@echo 's/<\/B>/<\/STRONG>/g' >> subst.tmp
6997049Speter	@echo 's/<I>/<EM>/g'         >> subst.tmp
7097049Speter	@echo 's/<\/I>/<\/EM>/g'     >> subst.tmp
7197049Speter	@echo 's/<\/TITLE>/<\/TITLE><link rev=made href="mailto:bug-ncurses@gnu.org">/' >> subst.tmp
7262449Speter	@sort < subst.tmp | uniq > subst.sed
7362449Speter	@rm -f subst.tmp
7462449Speter	@for f in man/*.[0-9]* ; do \
7562449Speter	   m=`basename $$f` ;\
7697049Speter	   T=`egrep '^.TH' $$f|sed -e 's/^.TH //' -e s'/"//g' -e 's/[ 	]\+$$//'` ; \
7762449Speter	   g=$${m}.html ;\
7862449Speter	   if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
7962449Speter	   echo "Converting $$m to HTML" ;\
8097049Speter	   echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' > doc/html/man/$$g ;\
8197049Speter	   echo '<!-- ' >> doc/html/man/$$g ;\
8297049Speter	   egrep '^.\\"[^#]' $$f | \
8397049Speter	   	sed	-e 's/\$$/@/g' \
8497049Speter			-e 's/^.../  */' \
8597049Speter			-e 's/</\&lt;/g' \
8697049Speter			-e 's/>/\&gt;/g' \
8797049Speter	   >> doc/html/man/$$g ;\
8897049Speter	   echo '-->' >> doc/html/man/$$g ;\
8997049Speter	   man/edit_man.sh editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \
9062449Speter	   sed -f subst.sed |\
9162449Speter	   sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
9297049Speter	   >> doc/html/man/$$g ;\
9362449Speter	done
9462449Speter	@rm -f subst.sed
9562449Speter	@sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp
9662449Speter	@find ./doc/html/man -type f -print >> MANIFEST.tmp
9762449Speter	@chmod u+w MANIFEST
9862449Speter	@sort -u < MANIFEST.tmp > MANIFEST
9962449Speter	@rm -f MANIFEST.tmp
10062449Speter
10162449Speter#
10262449Speter# Please note that this target can only be properly built if the build of the
10362449Speter# Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
10462449Speter# .ali files generated by the Ada95 compiler during the build process.  These
10562449Speter# .ali files contain cross referencing information required by gnathtml.
10662449Speteradahtml: MANIFEST
10762449Speter	if [ ! -z "$(GNATHTML)" ]; then \
10862449Speter	  (cd ./Ada95/gen ; make html) ;\
10962449Speter	  sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\
11062449Speter	  find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\
11162449Speter	  sort -u < MANIFEST.tmp > MANIFEST ;\
11262449Speter	  rm -f MANIFEST.tmp ;\
11362449Speter	fi
11462449Speter
11550276Speter# Prepare distribution for version control
11650276Spetervcprepare:
11750276Speter	find . -type d -exec mkdir {}/RCS \;
11850276Speter
11950276Speter# Write-lock almost all files not under version control.
12050276SpeterADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done')
12150276SpeterEXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS)
12250276Speterwritelock:
12350276Speter	for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done
12450276Speter
12550276Speter# This only works on a clean source tree, of course.
12650276SpeterMANIFEST:
12750276Speter	-rm -f $@
12850276Speter	touch $@
12950276Speter	find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@
13050276Speter
13150276SpeterTAGS:
13250276Speter	etags */*.[ch]
13350276Speter
13450276Speter# Makefile ends here
135