1166124Srafan##############################################################################
2176187Srafan# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.                #
3166124Srafan#                                                                            #
4166124Srafan# Permission is hereby granted, free of charge, to any person obtaining a    #
5166124Srafan# copy of this software and associated documentation files (the "Software"), #
6166124Srafan# to deal in the Software without restriction, including without limitation  #
7166124Srafan# the rights to use, copy, modify, merge, publish, distribute, distribute    #
8166124Srafan# with modifications, sublicense, and/or sell copies of the Software, and to #
9166124Srafan# permit persons to whom the Software is furnished to do so, subject to the  #
10166124Srafan# following conditions:                                                      #
11166124Srafan#                                                                            #
12166124Srafan# The above copyright notice and this permission notice shall be included in #
13166124Srafan# all copies or substantial portions of the Software.                        #
14166124Srafan#                                                                            #
15166124Srafan# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
16166124Srafan# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
17166124Srafan# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
18166124Srafan# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
19166124Srafan# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
20166124Srafan# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
21166124Srafan# DEALINGS IN THE SOFTWARE.                                                  #
22166124Srafan#                                                                            #
23166124Srafan# Except as contained in this notice, the name(s) of the above copyright     #
24166124Srafan# holders shall not be used in advertising or otherwise to promote the sale, #
25166124Srafan# use or other dealings in this Software without prior written               #
26166124Srafan# authorization.                                                             #
27166124Srafan##############################################################################
28184989Srafan# $Id: dist.mk,v 1.671 2008/11/02 00:58:38 tom Exp $
2950276Speter# Makefile for creating ncurses distributions.
3050276Speter#
3150276Speter# This only needs to be used directly as a makefile by developers, but
3250276Speter# configure mines the current version number out of here.  To move
3350276Speter# to a new version number, just edit this file and run configure.
3450276Speter#
3550276SpeterSHELL = /bin/sh
3650276Speter
3750276Speter# These define the major/minor/patch versions of ncurses.
3850276SpeterNCURSES_MAJOR = 5
39184989SrafanNCURSES_MINOR = 7
40184989SrafanNCURSES_PATCH = 20081102
4150276Speter
4250276Speter# We don't append the patch to the version, since this only applies to releases
4350276SpeterVERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
4450276Speter
45166124Srafan# The most recent html files were generated with lynx 2.8.6, using ncurses
46166124Srafan# configured with
47166124Srafan#	--without-manpage-renames
48166124Srafan# on Debian/testing.  The -scrollbar and -width options are used to make lynx
49166124Srafan# use 79 columns as it did in 2.8.5 and before.
50166124SrafanDUMP	= lynx -dump -scrollbar=0 -width=79
5150276SpeterDUMP2	= $(DUMP) -nolist
5250276Speter
5362449SpeterGNATHTML= `type -p gnathtml || type -p gnathtml.pl`
5450276Speter
5562449Speter# man2html 3.0.1 is a Perl script which assumes that pages are fixed size.
5662449Speter# Not all man programs agree with this assumption; some use half-spacing, which
5762449Speter# has the effect of lengthening the text portion of the page -- so man2html
5862449Speter# would remove some text.  The man program on Redhat 6.1 appears to work with
59166124Srafan# man2html if we set the top/bottom margins to 6 (the default is 7).  Newer
60166124Srafan# versions of 'man' on Linux leave no margin (and make it harder to sync with
61166124Srafan# pages).
62166124SrafanMAN2HTML= man2html -botm=0 -topm=0 -cgiurl '$$title.$$section$$subsection.html'
6362449Speter
6462449SpeterALL	= ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
6562449Speter
6650276Speterall :	$(ALL)
6750276Speter
6850276Speterdist:	$(ALL)
6950276Speter	(cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
7050276Speter
7150276Speterdistclean:
72166124Srafan	rm -f $(ALL) subst.tmp subst.sed
7350276Speter
7450276Speter# Don't mess with announce.html.in unless you have lynx available!
7562449Speterdoc/html/announce.html: announce.html.in
7662449Speter	sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
7750276Speter
7862449SpeterANNOUNCE : doc/html/announce.html
7962449Speter	$(DUMP) doc/html/announce.html > $@
8050276Speter
8162449Speterdoc/ncurses-intro.doc: doc/html/ncurses-intro.html
8262449Speter	$(DUMP2) doc/html/ncurses-intro.html > $@
8362449Speterdoc/hackguide.doc: doc/html/hackguide.html
8462449Speter	$(DUMP2) doc/html/hackguide.html > $@
8550276Speter
86166124Srafan# This is the original command:
87166124Srafan#	MANPROG	= tbl | nroff -man
88166124Srafan#
89166124Srafan# This happens to work for groff 1.18.1 on Debian.  At some point groff's
90166124Srafan# maintainer changed the line-length (we do not want/need that here).
91166124Srafan#
92166124Srafan# The distributed html files are formatted using
93166124Srafan#	configure --without-manpage-renames
94184989Srafan#
95184989Srafan# The edit_man.sed script is built as a side-effect of installing the manpages.
96184989Srafan# If that conflicts with the --without-manpage-renames, you can install those
97184989Srafan# in a different location using the --with-install-prefix option of the
98184989Srafan# configure script.
99166124SrafanMANPROG	= tbl | nroff -mandoc -rLL=65n -rLT=71n -Tascii
10076726Speter
101166124Srafanmanhtml:
10262449Speter	@rm -f doc/html/man/*.html
10362449Speter	@mkdir -p doc/html/man
10462449Speter	@rm -f subst.tmp ;
10562449Speter	@for f in man/*.[0-9]*; do \
10662449Speter	   m=`basename $$f` ;\
10762449Speter	   x=`echo $$m | awk -F. '{print $$2;}'` ;\
10862449Speter	   xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
10962449Speter	   if [ "$${x}" != "$${xu}" ]; then \
11062449Speter	     echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
11162449Speter	   fi ;\
11262449Speter	done
11397049Speter	# change some things to make weblint happy:
114174993Srafan	@cat man_alias.sed           >> subst.tmp
11597049Speter	@echo 's/<B>/<STRONG>/g'     >> subst.tmp
11697049Speter	@echo 's/<\/B>/<\/STRONG>/g' >> subst.tmp
11797049Speter	@echo 's/<I>/<EM>/g'         >> subst.tmp
11897049Speter	@echo 's/<\/I>/<\/EM>/g'     >> subst.tmp
119166124Srafan	@misc/csort < subst.tmp | uniq > subst.sed
120166124Srafan	@echo '/<\/TITLE>/a\' >> subst.sed
121166124Srafan	@echo '<link rev=made href="mailto:bug-ncurses@gnu.org">\' >> subst.sed
122166124Srafan	@echo '<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1">' >> subst.sed
12362449Speter	@rm -f subst.tmp
12462449Speter	@for f in man/*.[0-9]* ; do \
12562449Speter	   m=`basename $$f` ;\
12697049Speter	   T=`egrep '^.TH' $$f|sed -e 's/^.TH //' -e s'/"//g' -e 's/[ 	]\+$$//'` ; \
12762449Speter	   g=$${m}.html ;\
12862449Speter	   if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
12962449Speter	   echo "Converting $$m to HTML" ;\
13097049Speter	   echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' > doc/html/man/$$g ;\
13197049Speter	   echo '<!-- ' >> doc/html/man/$$g ;\
13297049Speter	   egrep '^.\\"[^#]' $$f | \
13397049Speter	   	sed	-e 's/\$$/@/g' \
13497049Speter			-e 's/^.../  */' \
13597049Speter			-e 's/</\&lt;/g' \
13697049Speter			-e 's/>/\&gt;/g' \
13797049Speter	   >> doc/html/man/$$g ;\
13897049Speter	   echo '-->' >> doc/html/man/$$g ;\
139166124Srafan	   ./edit_man.sh normal editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \
14062449Speter	   sed -f subst.sed |\
14162449Speter	   sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
14297049Speter	   >> doc/html/man/$$g ;\
14362449Speter	done
14462449Speter	@rm -f subst.sed
14562449Speter
14662449Speter#
14762449Speter# Please note that this target can only be properly built if the build of the
14862449Speter# Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
14962449Speter# .ali files generated by the Ada95 compiler during the build process.  These
15062449Speter# .ali files contain cross referencing information required by gnathtml.
151166124Srafanadahtml:
15262449Speter	if [ ! -z "$(GNATHTML)" ]; then \
15362449Speter	  (cd ./Ada95/gen ; make html) ;\
15462449Speter	fi
15562449Speter
15650276Speter# This only works on a clean source tree, of course.
15750276SpeterMANIFEST:
15850276Speter	-rm -f $@
15950276Speter	touch $@
160166124Srafan	find . -type f -print |misc/csort | fgrep -v .lsm |fgrep -v .spec >$@
16150276Speter
16250276SpeterTAGS:
16350276Speter	etags */*.[ch]
16450276Speter
16550276Speter# Makefile ends here
166