dist.mk revision 174993
1##############################################################################
2# Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.                #
3#                                                                            #
4# Permission is hereby granted, free of charge, to any person obtaining a    #
5# copy of this software and associated documentation files (the "Software"), #
6# to deal in the Software without restriction, including without limitation  #
7# the rights to use, copy, modify, merge, publish, distribute, distribute    #
8# with modifications, sublicense, and/or sell copies of the Software, and to #
9# permit persons to whom the Software is furnished to do so, subject to the  #
10# following conditions:                                                      #
11#                                                                            #
12# The above copyright notice and this permission notice shall be included in #
13# all copies or substantial portions of the Software.                        #
14#                                                                            #
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
18# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
21# DEALINGS IN THE SOFTWARE.                                                  #
22#                                                                            #
23# Except as contained in this notice, the name(s) of the above copyright     #
24# holders shall not be used in advertising or otherwise to promote the sale, #
25# use or other dealings in this Software without prior written               #
26# authorization.                                                             #
27##############################################################################
28# $Id: dist.mk,v 1.620 2007/12/22 20:41:31 tom Exp $
29# Makefile for creating ncurses distributions.
30#
31# This only needs to be used directly as a makefile by developers, but
32# configure mines the current version number out of here.  To move
33# to a new version number, just edit this file and run configure.
34#
35SHELL = /bin/sh
36
37# These define the major/minor/patch versions of ncurses.
38NCURSES_MAJOR = 5
39NCURSES_MINOR = 6
40NCURSES_PATCH = 20071222
41
42# We don't append the patch to the version, since this only applies to releases
43VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
44
45# The most recent html files were generated with lynx 2.8.6, using ncurses
46# configured with
47#	--without-manpage-renames
48# on Debian/testing.  The -scrollbar and -width options are used to make lynx
49# use 79 columns as it did in 2.8.5 and before.
50DUMP	= lynx -dump -scrollbar=0 -width=79
51DUMP2	= $(DUMP) -nolist
52
53GNATHTML= `type -p gnathtml || type -p gnathtml.pl`
54
55# man2html 3.0.1 is a Perl script which assumes that pages are fixed size.
56# Not all man programs agree with this assumption; some use half-spacing, which
57# has the effect of lengthening the text portion of the page -- so man2html
58# would remove some text.  The man program on Redhat 6.1 appears to work with
59# man2html if we set the top/bottom margins to 6 (the default is 7).  Newer
60# versions of 'man' on Linux leave no margin (and make it harder to sync with
61# pages).
62MAN2HTML= man2html -botm=0 -topm=0 -cgiurl '$$title.$$section$$subsection.html'
63
64ALL	= ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
65
66all :	$(ALL)
67
68dist:	$(ALL)
69	(cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
70
71distclean:
72	rm -f $(ALL) subst.tmp subst.sed
73
74# Don't mess with announce.html.in unless you have lynx available!
75doc/html/announce.html: announce.html.in
76	sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
77
78ANNOUNCE : doc/html/announce.html
79	$(DUMP) doc/html/announce.html > $@
80
81doc/ncurses-intro.doc: doc/html/ncurses-intro.html
82	$(DUMP2) doc/html/ncurses-intro.html > $@
83doc/hackguide.doc: doc/html/hackguide.html
84	$(DUMP2) doc/html/hackguide.html > $@
85
86# This is the original command:
87#	MANPROG	= tbl | nroff -man
88#
89# This happens to work for groff 1.18.1 on Debian.  At some point groff's
90# maintainer changed the line-length (we do not want/need that here).
91#
92# The distributed html files are formatted using
93#	configure --without-manpage-renames
94MANPROG	= tbl | nroff -mandoc -rLL=65n -rLT=71n -Tascii
95
96manhtml:
97	@rm -f doc/html/man/*.html
98	@mkdir -p doc/html/man
99	@rm -f subst.tmp ;
100	@for f in man/*.[0-9]*; do \
101	   m=`basename $$f` ;\
102	   x=`echo $$m | awk -F. '{print $$2;}'` ;\
103	   xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
104	   if [ "$${x}" != "$${xu}" ]; then \
105	     echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
106	   fi ;\
107	done
108	# change some things to make weblint happy:
109	@cat man_alias.sed           >> subst.tmp
110	@echo 's/<B>/<STRONG>/g'     >> subst.tmp
111	@echo 's/<\/B>/<\/STRONG>/g' >> subst.tmp
112	@echo 's/<I>/<EM>/g'         >> subst.tmp
113	@echo 's/<\/I>/<\/EM>/g'     >> subst.tmp
114	@misc/csort < subst.tmp | uniq > subst.sed
115	@echo '/<\/TITLE>/a\' >> subst.sed
116	@echo '<link rev=made href="mailto:bug-ncurses@gnu.org">\' >> subst.sed
117	@echo '<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1">' >> subst.sed
118	@rm -f subst.tmp
119	@for f in man/*.[0-9]* ; do \
120	   m=`basename $$f` ;\
121	   T=`egrep '^.TH' $$f|sed -e 's/^.TH //' -e s'/"//g' -e 's/[ 	]\+$$//'` ; \
122	   g=$${m}.html ;\
123	   if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
124	   echo "Converting $$m to HTML" ;\
125	   echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' > doc/html/man/$$g ;\
126	   echo '<!-- ' >> doc/html/man/$$g ;\
127	   egrep '^.\\"[^#]' $$f | \
128	   	sed	-e 's/\$$/@/g' \
129			-e 's/^.../  */' \
130			-e 's/</\&lt;/g' \
131			-e 's/>/\&gt;/g' \
132	   >> doc/html/man/$$g ;\
133	   echo '-->' >> doc/html/man/$$g ;\
134	   ./edit_man.sh normal editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \
135	   sed -f subst.sed |\
136	   sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
137	   >> doc/html/man/$$g ;\
138	done
139	@rm -f subst.sed
140
141#
142# Please note that this target can only be properly built if the build of the
143# Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
144# .ali files generated by the Ada95 compiler during the build process.  These
145# .ali files contain cross referencing information required by gnathtml.
146adahtml:
147	if [ ! -z "$(GNATHTML)" ]; then \
148	  (cd ./Ada95/gen ; make html) ;\
149	fi
150
151# This only works on a clean source tree, of course.
152MANIFEST:
153	-rm -f $@
154	touch $@
155	find . -type f -print |misc/csort | fgrep -v .lsm |fgrep -v .spec >$@
156
157TAGS:
158	etags */*.[ch]
159
160# Makefile ends here
161