1# BEGIN LICENSE BLOCK
2# Version: CMPL 1.1
3#
4# The contents of this file are subject to the Cisco-style Mozilla Public
5# License Version 1.1 (the "License"); you may not use this file except
6# in compliance with the License.  You may obtain a copy of the License
7# at www.eclipse-clp.org/license.
8# 
9# Software distributed under the License is distributed on an "AS IS"
10# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11# the License for the specific language governing rights and limitations
12# under the License. 
13# 
14# The Original Code is  The ECLiPSe Constraint Logic Programming System. 
15# The Initial Developer of the Original Code is  Cisco Systems, Inc. 
16# Portions created by the Initial Developer are
17# Copyright (C) 2006 Cisco Systems, Inc.  All Rights Reserved.
18# 
19# Contributor(s): 
20# 
21# END LICENSE BLOCK
22
23DESTFILE = userman
24
25ROOTFILE = umsroot
26
27CHAPTERS = $(ROOTFILE).tex umsintro.tex umsterm.tex umsusing.tex umscompiler.tex \
28	umssyntax.tex umsmodules.tex umsarith.tex umsio.tex umsexcept.tex \
29	umsarrays.tex umsdebug.tex umsdeveltools.tex umsmemory.tex \
30	umsopsys.tex umssocket.tex \
31	umsmacros.tex extmeta.tex exthsusp.tex extsuspend.tex \
32	umslanguage.tex \
33	umsopers.tex umsstyle.tex \
34	umserrors.tex umsbugs.tex
35
36EPSFILES = boxmodel.eps resolv.eps dismat.eps dismat2.eps reexport.eps \
37	tktop.eps xrefDavinci.eps
38
39
40GENFILES = err1.tex err2.tex err3.tex err4.tex err5.tex err6.tex \
41	err7.tex err8.tex err9.tex err10.tex
42
43# the files that are touched by latex as a side effect
44CHAPAUX = $(CHAPTERS:%.tex=%.aux) $(ROOTFILE).toc $(ROOTFILE).idx
45
46
47all:	$(ROOTFILE).dvi $(ROOTFILE)/$(ROOTFILE).html
48	@echo Do make install to install
49
50install:	../../doc/$(DESTFILE).pdf $(ROOTFILE)/$(ROOTFILE).html
51	rm -rf ../../doc/$(DESTFILE)
52	mv $(ROOTFILE) ../../doc/$(DESTFILE)
53
54../../doc/$(DESTFILE).pdf:	$(ROOTFILE).pdf
55	cp $(ROOTFILE).pdf ../../doc/$(DESTFILE).pdf
56	chmod 644 ../../doc/$(DESTFILE).pdf
57
58
59$(ROOTFILE).dvi:	$(CHAPAUX) $(ROOTFILE).bbl $(ROOTFILE).ind 
60	@echo ======== UPDATE-PASS =========
61	@for f in $(CHAPAUX); do \
62		mv $$f $$f.old; cp $$f.old $$f; \
63	    done
64	latex $(ROOTFILE).tex
65	# The touches below are supposed to work around nfs clock skew problems:
66	# The latex run may leave the dvi file with a modification time in the
67	# future. Touch it to make sure the time is right relative to the
68	# subsequent touches of the aux files. Sleep in between to make sure
69	# the dvi is strictly older than the touched aux files.
70	touch $(ROOTFILE).dvi 
71	sleep 1
72	@for f in $(CHAPAUX); do \
73		if cmp -s $$f $$f.old; then mv $$f.old $$f; \
74		else rm $$f.old; echo ==== $$f was modified ====; touch $$f; \
75		fi \
76	    done
77	$(MAKE) $(ROOTFILE).dvi
78
79$(CHAPTERS:%.tex=%.aux):	$(CHAPTERS) $(EPSFILES)
80	@echo ======== PASS 1 =========
81	latex $(ROOTFILE)
82
83$(ROOTFILE).idx:	$(ROOTFILE).aux
84	touch $(ROOTFILE).idx
85
86$(ROOTFILE).bbl:	$(ROOTFILE).aux
87	bibtex $(ROOTFILE)
88
89$(ROOTFILE).ind:	$(ROOTFILE).idx
90	-makeindex $(ROOTFILE)
91
92$(ROOTFILE).pdf:	$(ROOTFILE).ps
93	ps2pdf $(ROOTFILE).ps
94
95$(ROOTFILE).ps:	$(ROOTFILE).dvi
96	dvips -Ppdf -t a4 -o $(ROOTFILE).ps $(ROOTFILE)
97
98$(ROOTFILE).ps.Z:	$(ROOTFILE).ps
99	compress -f $(ROOTFILE).ps
100
101genfiles:
102	eclipse -e "[gen_error],gen_errors"
103
104# This preprocesses all *.tex files
105# to insert/update the hyperlinks to the bip pages
106biprefs:
107	eclipse -e "[makerefs],do" -- *.tex
108
109$(ROOTFILE)/$(ROOTFILE).html:	$(CHAPTERS)
110	mkdir -p $(ROOTFILE)
111	hevea -fix underscore.hva url.hva $(ROOTFILE)
112	# replace the hard link index.html -> $(ROOTFILE).html by a soft link
113	# because of problems with tar on Windows
114	hacha -tocbis $(ROOTFILE).html
115        # copy the files needed for the html to $(ROOTFILE) directory
116	cp $(ROOTFILE)[0-9]??.* $(ROOTFILE)/
117	cp $(ROOTFILE).css $(ROOTFILE)/
118	cp contents_motif.gif next_motif.gif previous_motif.gif $(ROOTFILE)
119	cp index.html $(ROOTFILE)/$(ROOTFILE).html
120	ln -s $(ROOTFILE).html $(ROOTFILE)/index.html
121
122clean:
123	rm -f *.bak *.idx *.ind *.bbl *.aux *.dvi *.toc *.log *.ilg *.blg
124	rm -f *.hind *.haux *.hind *.htoc $(ROOTFILE).image.*
125	rm -f $(ROOTFILE)[0-9]??.*
126	rm -f $(ROOTFILE).ps $(ROOTFILE).ps.Z $(ROOTFILE).pdf $(ROOTFILE).html
127	rm -rf $(ROOTFILE)
128