dist.mk revision 62449
1139804Simp# $Id: dist.mk,v 1.207 2000/06/29 23:08:38 tom Exp $
2139013Sdavidxu# Makefile for creating ncurses distributions.
3112904Sjeff#
4112904Sjeff# This only needs to be used directly as a makefile by developers, but
5112904Sjeff# configure mines the current version number out of here.  To move
6112904Sjeff# to a new version number, just edit this file and run configure.
7112904Sjeff#
8112904SjeffSHELL = /bin/sh
9112904Sjeff
10112904Sjeff# These define the major/minor/patch versions of ncurses.
11112904SjeffNCURSES_MAJOR = 5
12112904SjeffNCURSES_MINOR = 1
13112904SjeffNCURSES_PATCH = 20000701
14112904Sjeff
15112904Sjeff# We don't append the patch to the version, since this only applies to releases
16112904SjeffVERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
17112904Sjeff
18112904SjeffDUMP	= lynx -dump
19112904SjeffDUMP2	= $(DUMP) -nolist
20112904Sjeff
21112904SjeffGNATHTML= `type -p gnathtml || type -p gnathtml.pl`
22112904Sjeff
23112904Sjeff# man2html 3.0.1 is a Perl script which assumes that pages are fixed size.
24112904Sjeff# Not all man programs agree with this assumption; some use half-spacing, which
25112904Sjeff# has the effect of lengthening the text portion of the page -- so man2html
26112904Sjeff# would remove some text.  The man program on Redhat 6.1 appears to work with
27112904Sjeff# man2html if we set the top/bottom margins to 6 (the default is 7).
28116182SobrienMAN2HTML= man2html -botm=6 -topm=6 -cgiurl '$$title.$$section$$subsection.html'
29116182Sobrien
30116182SobrienALL	= ANNOUNCE doc/html/announce.html doc/ncurses-intro.doc doc/hackguide.doc manhtml adahtml
31162536Sdavidxu
32112904Sjeffall :	$(ALL)
33112904Sjeff
34131431Smarceldist:	$(ALL)
35112904Sjeff	(cd ..;  tar cvf ncurses-$(VERSION).tar `sed <ncurses-$(VERSION)/MANIFEST 's/^./ncurses-$(VERSION)/'`;  gzip ncurses-$(VERSION).tar)
36115765Sjeff
37112904Sjeffdistclean:
38164033Srwatson	rm -f $(ALL) subst.tmp subst.sed MANIFEST.tmp
39112904Sjeff
40161678Sdavidxu# Don't mess with announce.html.in unless you have lynx available!
41165369Sdavidxudoc/html/announce.html: announce.html.in
42161678Sdavidxu	sed 's,@VERSION@,$(VERSION),' <announce.html.in > $@
43112904Sjeff
44112904SjeffANNOUNCE : doc/html/announce.html
45112904Sjeff	$(DUMP) doc/html/announce.html > $@
46139013Sdavidxu
47112904Sjeffdoc/ncurses-intro.doc: doc/html/ncurses-intro.html
48112904Sjeff	$(DUMP2) doc/html/ncurses-intro.html > $@
49139013Sdavidxudoc/hackguide.doc: doc/html/hackguide.html
50139013Sdavidxu	$(DUMP2) doc/html/hackguide.html > $@
51139013Sdavidxu
52139013Sdavidxu# Note that this rule assumes the manpages were installed - it does not use
53139013Sdavidxu# the copies in the build tree except to get the list of names.
54139013Sdavidxumanhtml: MANIFEST
55165369Sdavidxu	@rm -f doc/html/man/*.html
56165369Sdavidxu	@mkdir -p doc/html/man
57205014Snwhitehorn	@rm -f subst.tmp ;
58162536Sdavidxu	@for f in man/*.[0-9]*; do \
59162536Sdavidxu	   m=`basename $$f` ;\
60162536Sdavidxu	   x=`echo $$m | awk -F. '{print $$2;}'` ;\
61201887Sdavidxu	   xu=`echo $$x | dd conv=ucase 2>/dev/null` ;\
62201887Sdavidxu	   if [ "$${x}" != "$${xu}" ]; then \
63201887Sdavidxu	     echo "s/$${xu}/$${x}/g" >> subst.tmp ;\
64201887Sdavidxu	   fi ;\
65201887Sdavidxu	done
66201887Sdavidxu	@sort < subst.tmp | uniq > subst.sed
67201887Sdavidxu	@rm -f subst.tmp
68201887Sdavidxu	@for f in man/*.[0-9]* ; do \
69201887Sdavidxu	   m=`basename $$f` ;\
70201887Sdavidxu	   g=$${m}.html ;\
71139013Sdavidxu	   if [ -f doc/html/$$g ]; then chmod +w doc/html/$$g; fi;\
72179970Sdavidxu	   echo "Converting $$m to HTML" ;\
73179970Sdavidxu	   man $$f | tr '\255' '-' | $(MAN2HTML) | \
74179970Sdavidxu	   sed -f subst.sed |\
75161678Sdavidxu	   sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \
76139013Sdavidxu	   > doc/html/man/$$g ;\
77161678Sdavidxu	done
78139013Sdavidxu	@rm -f subst.sed
79161678Sdavidxu	@sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp
80139013Sdavidxu	@find ./doc/html/man -type f -print >> MANIFEST.tmp
81139013Sdavidxu	@chmod u+w MANIFEST
82139013Sdavidxu	@sort -u < MANIFEST.tmp > MANIFEST
83161678Sdavidxu	@rm -f MANIFEST.tmp
84139013Sdavidxu
85139013Sdavidxu#
86161678Sdavidxu# Please note that this target can only be properly built if the build of the
87161678Sdavidxu# Ada95 subdir has been done.  The reason is, that the gnathtml tool uses the
88139013Sdavidxu# .ali files generated by the Ada95 compiler during the build process.  These
89139013Sdavidxu# .ali files contain cross referencing information required by gnathtml.
90161678Sdavidxuadahtml: MANIFEST
91161678Sdavidxu	if [ ! -z "$(GNATHTML)" ]; then \
92139013Sdavidxu	  (cd ./Ada95/gen ; make html) ;\
93139013Sdavidxu	  sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\
94139013Sdavidxu	  find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\
95139013Sdavidxu	  sort -u < MANIFEST.tmp > MANIFEST ;\
96161678Sdavidxu	  rm -f MANIFEST.tmp ;\
97161678Sdavidxu	fi
98161678Sdavidxu
99161678Sdavidxu# Prepare distribution for version control
100161678Sdavidxuvcprepare:
101161678Sdavidxu	find . -type d -exec mkdir {}/RCS \;
102161678Sdavidxu
103161678Sdavidxu# Write-lock almost all files not under version control.
104161678SdavidxuADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done')
105161678SdavidxuEXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS)
106161678Sdavidxuwritelock:
107161678Sdavidxu	for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done
108161678Sdavidxu
109161678Sdavidxu# This only works on a clean source tree, of course.
110161678SdavidxuMANIFEST:
111161678Sdavidxu	-rm -f $@
112161678Sdavidxu	touch $@
113161678Sdavidxu	find . -type f -print |sort | fgrep -v .lsm |fgrep -v .spec >$@
114161678Sdavidxu
115161678SdavidxuTAGS:
116161678Sdavidxu	etags */*.[ch]
117161678Sdavidxu
118115765Sjeff# Makefile ends here
119161678Sdavidxu