Merge from vendor branch NTPD:
[dragonfly.git] / contrib / ncurses-5.4 / dist.mk
1 # $Id: dist.mk,v 1.402 2004/02/08 20:56:43 tom Exp $
2 # Makefile for creating ncurses distributions.
3 #
4 # This only needs to be used directly as a makefile by developers, but
5 # configure mines the current version number out of here.  To move
6 # to a new version number, just edit this file and run configure.
7 #
8 SHELL = /bin/sh
9
10 # These define the major/minor/patch versions of ncurses.
11 NCURSES_MAJOR = 5
12 NCURSES_MINOR = 4
13 NCURSES_PATCH = 20040208
14
15 # We don't append the patch to the version, since this only applies to releases
16 VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
17
18 DUMP    = lynx -dump
19 DUMP2   = $(DUMP) -nolist
20
21 GNATHTML= `type -p gnathtml || type -p gnathtml.pl`
22
23 # man2html 3.0.1 is a Perl script which assumes that pages are fixed size.
24 # Not all man programs agree with this assumption; some use half-spacing, which
25 # has the effect of lengthening the text portion of the page -- so man2html
26 # would remove some text.  The man program on Redhat 6.1 appears to work with
27 # man2html if we set the top/bottom margins to 6 (the default is 7).  Newer
28 # versions of 'man' on Linux leave no margin (and make it harder to sync with
29 # pages).
30 MAN2HTML= man2html -botm=0 -topm=0 -cgiurl '$$title.$$section$$subsection.html'
31
32 ALL     = ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
33
34 all :   $(ALL)
35
36 dist:   $(ALL)
37         (cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
38
39 distclean:
40         rm -f $(ALL) subst.tmp subst.sed MANIFEST.tmp
41
42 # Don't mess with announce.html.in unless you have lynx available!
43 doc/html/announce.html: announce.html.in
44         sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
45
46 ANNOUNCE : doc/html/announce.html
47         $(DUMP) doc/html/announce.html > $@
48
49 doc/ncurses-intro.doc: doc/html/ncurses-intro.html
50         $(DUMP2) doc/html/ncurses-intro.html > $@
51 doc/hackguide.doc: doc/html/hackguide.html
52         $(DUMP2) doc/html/hackguide.html > $@
53
54 MANPROG = tbl | nroff -man
55
56 manhtml: MANIFEST
57         @rm -f doc/html/man/*.html
58         @mkdir -p doc/html/man
59         @rm -f subst.tmp ;
60         @for f in man/*.[0-9]*; do \
61            m=`basename $$f` ;\
62            x=`echo $$m | awk -F. '{print $$2;}'` ;\
63            xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
64            if [ "$${x}" != "$${xu}" ]; then \
65              echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
66            fi ;\
67         done
68         # change some things to make weblint happy:
69         @echo 's/<B>/<STRONG>/g'     >> subst.tmp
70         @echo 's/<\/B>/<\/STRONG>/g' >> subst.tmp
71         @echo 's/<I>/<EM>/g'         >> subst.tmp
72         @echo 's/<\/I>/<\/EM>/g'     >> subst.tmp
73         @misc/csort < subst.tmp | uniq > subst.sed
74         @echo '/<\/TITLE>/a\' >> subst.sed
75         @echo '<link rev=made href="mailto:bug-ncurses@gnu.org">\' >> subst.sed
76         @echo '<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1">' >> subst.sed
77         @rm -f subst.tmp
78         @for f in man/*.[0-9]* ; do \
79            m=`basename $$f` ;\
80            T=`egrep '^.TH' $$f|sed -e 's/^.TH //' -e s'/"//g' -e 's/[   ]\+$$//'` ; \
81            g=$${m}.html ;\
82            if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
83            echo "Converting $$m to HTML" ;\
84            echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' > doc/html/man/$$g ;\
85            echo '<!-- ' >> doc/html/man/$$g ;\
86            egrep '^.\\"[^#]' $$f | \
87                 sed     -e 's/\$$/@/g' \
88                         -e 's/^.../  */' \
89                         -e 's/</\&lt;/g' \
90                         -e 's/>/\&gt;/g' \
91            >> doc/html/man/$$g ;\
92            echo '-->' >> doc/html/man/$$g ;\
93            man/edit_man.sh normal editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \
94            sed -f subst.sed |\
95            sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
96            >> doc/html/man/$$g ;\
97         done
98         @rm -f subst.sed
99         @sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp
100         @find ./doc/html/man -type f -print >> MANIFEST.tmp
101         @chmod u+w MANIFEST
102         @misc/csort -u < MANIFEST.tmp > MANIFEST
103         @rm -f MANIFEST.tmp
104
105 #
106 # Please note that this target can only be properly built if the build of the
107 # Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
108 # .ali files generated by the Ada95 compiler during the build process.  These
109 # .ali files contain cross referencing information required by gnathtml.
110 adahtml: MANIFEST
111         if [ ! -z "$(GNATHTML)" ]; then \
112           (cd ./Ada95/gen ; make html) ;\
113           sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\
114           find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\
115           misc/csort -u < MANIFEST.tmp > MANIFEST ;\
116           rm -f MANIFEST.tmp ;\
117         fi
118
119 # Prepare distribution for version control
120 vcprepare:
121         find . -type d -exec mkdir {}/RCS \;
122
123 # Write-lock almost all files not under version control.
124 ADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done')
125 EXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS)
126 writelock:
127         for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done
128
129 # This only works on a clean source tree, of course.
130 MANIFEST:
131         -rm -f $@
132         touch $@
133         find . -type f -print |misc/csort | fgrep -v .lsm |fgrep -v .spec >$@
134
135 TAGS:
136         etags */*.[ch]
137
138 # Makefile ends here