]> ncurses.scripts.mit.edu Git - ncurses.git/blob - dist.mk
ad6743f8c8e0667f4935a81f03564eedc957724c
[ncurses.git] / dist.mk
1 # $Id: dist.mk,v 1.327 2002/10/12 23:27:36 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 = 3
13 NCURSES_PATCH = 20021012
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).
28 MAN2HTML= man2html -botm=6 -topm=6 -cgiurl '$$title.$$section$$subsection.html'
29
30 ALL     = ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
31
32 all :   $(ALL)
33
34 dist:   $(ALL)
35         (cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
36
37 distclean:
38         rm -f $(ALL) subst.tmp subst.sed MANIFEST.tmp
39
40 # Don't mess with announce.html.in unless you have lynx available!
41 doc/html/announce.html: announce.html.in
42         sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
43
44 ANNOUNCE : doc/html/announce.html
45         $(DUMP) doc/html/announce.html > $@
46
47 doc/ncurses-intro.doc: doc/html/ncurses-intro.html
48         $(DUMP2) doc/html/ncurses-intro.html > $@
49 doc/hackguide.doc: doc/html/hackguide.html
50         $(DUMP2) doc/html/hackguide.html > $@
51
52 MANPROG = tbl | nroff -man
53
54 manhtml: MANIFEST
55         @rm -f doc/html/man/*.html
56         @mkdir -p doc/html/man
57         @rm -f subst.tmp ;
58         @for f in man/*.[0-9]*; do \
59            m=`basename $$f` ;\
60            x=`echo $$m | awk -F. '{print $$2;}'` ;\
61            xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
62            if [ "$${x}" != "$${xu}" ]; then \
63              echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
64            fi ;\
65         done
66         # change some things to make weblint happy:
67         @echo 's/<B>/<STRONG>/g'     >> subst.tmp
68         @echo 's/<\/B>/<\/STRONG>/g' >> subst.tmp
69         @echo 's/<I>/<EM>/g'         >> subst.tmp
70         @echo 's/<\/I>/<\/EM>/g'     >> subst.tmp
71         @sort < subst.tmp | uniq > subst.sed
72         @echo '/<\/TITLE>/a\' >> subst.sed
73         @echo '<link rev=made href="mailto:bug-ncurses@gnu.org">\' >> subst.sed
74         @echo '<meta http-equiv="Content-Type" content="text\/html; charset=iso-8859-1">' >> subst.sed
75         @rm -f subst.tmp
76         @for f in man/*.[0-9]* ; do \
77            m=`basename $$f` ;\
78            T=`egrep '^.TH' $$f|sed -e 's/^.TH //' -e s'/"//g' -e 's/[   ]\+$$//'` ; \
79            g=$${m}.html ;\
80            if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
81            echo "Converting $$m to HTML" ;\
82            echo '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' > doc/html/man/$$g ;\
83            echo '<!-- ' >> doc/html/man/$$g ;\
84            egrep '^.\\"[^#]' $$f | \
85                 sed     -e 's/\$$/@/g' \
86                         -e 's/^.../  */' \
87                         -e 's/</\&lt;/g' \
88                         -e 's/>/\&gt;/g' \
89            >> doc/html/man/$$g ;\
90            echo '-->' >> doc/html/man/$$g ;\
91            man/edit_man.sh editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \
92            sed -f subst.sed |\
93            sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
94            >> doc/html/man/$$g ;\
95         done
96         @rm -f subst.sed
97         @sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp
98         @find ./doc/html/man -type f -print >> MANIFEST.tmp
99         @chmod u+w MANIFEST
100         @sort -u < MANIFEST.tmp > MANIFEST
101         @rm -f MANIFEST.tmp
102
103 #
104 # Please note that this target can only be properly built if the build of the
105 # Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
106 # .ali files generated by the Ada95 compiler during the build process.  These
107 # .ali files contain cross referencing information required by gnathtml.
108 adahtml: MANIFEST
109         if [ ! -z "$(GNATHTML)" ]; then \
110           (cd ./Ada95/gen ; make html) ;\
111           sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\
112           find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\
113           sort -u < MANIFEST.tmp > MANIFEST ;\
114           rm -f MANIFEST.tmp ;\
115         fi
116
117 # Prepare distribution for version control
118 vcprepare:
119         find . -type d -exec mkdir {}/RCS \;
120
121 # Write-lock almost all files not under version control.
122 ADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done')
123 EXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS)
124 writelock:
125         for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done
126
127 # This only works on a clean source tree, of course.
128 MANIFEST:
129         -rm -f $@
130         touch $@
131         find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@
132
133 TAGS:
134         etags */*.[ch]
135
136 # Makefile ends here