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