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 = 
24
25ROOTFILE = internal
26
27CHAPTERS = $(ROOTFILE).tex organisation.tex kernel.tex builtins.tex \
28		globalstate.tex io.tex debugger.tex
29
30EPSFIGURES = eccomp.eps ecvars.eps ecatomic.eps localframes.eps \
31	controlframes.eps stacks.eps callinstr.eps trailframes.eps
32
33#-------------------  generic part -------------------
34
35# the files that are touched by latex as a side effect
36#CHAPAUX = $(CHAPTERS:%.tex=%.aux) $(ROOTFILE).toc $(ROOTFILE).idx
37CHAPAUX = $(ROOTFILE).aux $(ROOTFILE).toc $(ROOTFILE).idx
38
39
40all:	$(ROOTFILE).dvi $(ROOTFILE)/$(ROOTFILE).html
41	echo Do make install to install
42
43install:	../../doc/$(ROOTFILE).pdf $(ROOTFILE)/$(ROOTFILE).html
44	rm -rf ../../doc/$(DESTFILE)
45	mv $(ROOTFILE) ../../doc/$(DESTFILE)
46
47../../doc/$(DESTFILE).pdf:	$(ROOTFILE).pdf
48	cp $(ROOTFILE).pdf ../../doc/$(DESTFILE).pdf
49	chmod 644 ../../doc/$(DESTFILE).pdf
50
51# tex -> dvi -> pdf
52
53$(ROOTFILE).dvi:	indexfile.tex $(CHAPAUX) $(ROOTFILE).bbl
54	@echo ======== UPDATE-PASS =========
55	@for f in $(CHAPAUX); do \
56		mv $$f $$f.old; cp $$f.old $$f; \
57	    done
58	latex $(ROOTFILE)
59	# The touches below are supposed to work around nfs clock skew problems:
60	# The latex run may leave the dvi file with a modification time in the
61	# future. Touch it to make sure the time is right relative to the
62	# subsequent touches of the aux files. Sleep in between to make sure
63	# the dvi is strictly older than the touched aux files.
64	touch $(ROOTFILE).dvi 
65	sleep 1
66	@for f in $(CHAPAUX); do \
67		if cmp -s $$f $$f.old; then mv $$f.old $$f; \
68		else rm $$f.old; echo ==== $$f was modified ====; touch $$f; \
69		fi \
70	    done
71	$(MAKE) $(ROOTFILE).dvi
72
73$(ROOTFILE).aux:	$(CHAPTERS)
74	@echo ======== PASS 1 =========
75	latex $(ROOTFILE)
76
77$(ROOTFILE).idx:	$(ROOTFILE).aux
78	touch $(ROOTFILE).idx
79
80$(ROOTFILE).bbl:	$(ROOTFILE).aux
81	-bibtex $(ROOTFILE)
82
83indexfile.tex:	$(ROOTFILE).idx
84	-makeindex -o indexfile.tex $(ROOTFILE).idx
85
86$(ROOTFILE).pdf:	$(ROOTFILE).ps $(EPSFIGURES)
87	ps2pdf $(ROOTFILE).ps
88
89$(ROOTFILE).ps:	$(ROOTFILE).dvi $(EPSFIGURES)
90	dvips -Ppdf -t a4 -o $(ROOTFILE).ps $(ROOTFILE)
91
92$(ROOTFILE).ps.Z:	$(ROOTFILE).ps
93	compress -f $(ROOTFILE).ps
94
95# This preprocesses all *.tex files
96# to insert links to the bip pages
97biprefs:
98	eclipse -e "[makerefs],do" -- *.tex
99
100
101# HTML version
102
103#$(ROOTFILE)/$(ROOTFILE).html:	$(CHAPTERS)
104#	latex2html $(ROOTFILE)
105
106$(ROOTFILE)/$(ROOTFILE).html:	$(CHAPTERS)
107	mkdir -p $(ROOTFILE)
108	hevea -fix underscore.hva hyperref.hva url.hva $(ROOTFILE)
109	hacha -tocbis $(ROOTFILE).html
110        # copy the files needed for the html to $(ROOTFILE) directory
111	cp $(ROOTFILE)[0-9]??.* $(ROOTFILE)/
112	cp $(ROOTFILE).css $(ROOTFILE)/
113	cp contents_motif.gif next_motif.gif previous_motif.gif $(ROOTFILE)
114	cp index.html $(ROOTFILE)/$(ROOTFILE).html
115	ln -s $(ROOTFILE).html $(ROOTFILE)/index.html
116
117
118clean:
119	rm -f *.bak *.idx *.ind *.bbl *.aux *.dvi *.toc *.log *.ilg *.blg
120	rm -f indexfile.tex
121	rm -f $(ROOTFILE).ps $(ROOTFILE).ps.Z $(ROOTFILE).pdf
122	rm -rf $(ROOTFILE)
123