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=knowledgebase
24
25ROOTFILE=manual
26
27CHAPTERS = $(ROOTFILE).tex intro-sec.tex database-sec.tex knowbase-sec.tex \
28	multiuser-sec.tex backwards-sec.tex
29#	kernel-lst.tex database-lst.tex knowbase-lst.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:	$(ROOTFILE).ps.Z
41	cp $(ROOTFILE).ps.Z ../../doc/$(DESTFILE).ps.Z
42	chmod 644 ../../doc/$(DESTFILE).ps.Z
43
44
45$(ROOTFILE).dvi:	$(ROOTFILE).bbl indexfile.tex $(CHAPAUX)
46	@echo ======== UPDATE-PASS =========
47	@for f in $(CHAPAUX); do \
48		mv $$f $$f.old; cp $$f.old $$f; \
49	    done
50	latex $(ROOTFILE)
51	# The touches below are supposed to work around nfs clock skew problems:
52	# The latex run may leave the dvi file with a modification time in the
53	# future. Touch it to make sure the time is right relative to the
54	# subsequent touches of the aux files. Sleep in between to make sure
55	# the dvi is strictly older than the touched aux files.
56	touch $(ROOTFILE).dvi 
57	sleep 1
58	@for f in $(CHAPAUX); do \
59		if cmp -s $$f $$f.old; then mv $$f.old $$f; \
60		else rm $$f.old; echo ==== $$f was modified ====; touch $$f; \
61		fi \
62	    done
63	$(MAKE) $(ROOTFILE).dvi
64
65$(ROOTFILE).aux:	$(CHAPTERS)
66	@echo ======== PASS 1 =========
67	latex $(ROOTFILE)
68
69$(ROOTFILE).idx:	$(ROOTFILE).aux
70	touch $(ROOTFILE).idx
71
72$(ROOTFILE).bbl:	$(ROOTFILE).aux
73	bibtex $(ROOTFILE)
74
75indexfile.tex:	$(ROOTFILE).idx
76	-makeindex -o indexfile.tex $(ROOTFILE).idx
77
78$(ROOTFILE).ps:	$(ROOTFILE).dvi
79	dvips -o $(ROOTFILE).ps $(ROOTFILE)
80
81$(ROOTFILE).ps.Z:	$(ROOTFILE).ps
82	compress -f $(ROOTFILE).ps
83
84$(ROOTFILE)/$(ROOTFILE).html:	$(CHAPTERS)
85	latex2html -init_file ../texinputs/latex2html-init -html_version 3.0 $(ROOTFILE)
86
87clean:
88	rm -f *.idx *.ind *.bbl *.blg *.aux *.dvi *.toc *.log *.ilg indexfile.tex
89	rm -f $(ROOTFILE).ps $(ROOTFILE).ps.Z
90	rm -rf $(ROOTFILE)
91