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
22DESTFILE = search_methods
23
24ROOTFILE = article
25
26CHAPTERS = $(ROOTFILE).tex \
27	search.tex
28
29EPSFIGURES = search1.eps search2.eps search3.eps search4.eps \
30		search5.eps search6.eps
31
32#-------------------  generic part -------------------
33
34# the files that are touched by latex as a side effect
35#CHAPAUX = $(CHAPTERS:%.tex=%.aux) $(ROOTFILE).toc $(ROOTFILE).idx
36CHAPAUX = $(ROOTFILE).aux $(ROOTFILE).toc $(ROOTFILE).idx
37
38
39all:	$(ROOTFILE).dvi $(ROOTFILE)/$(ROOTFILE).html
40	echo Do make install to install
41
42install:	../../doc/$(DESTFILE).pdf $(ROOTFILE)/$(ROOTFILE).html
43	rm -rf ../../doc/$(DESTFILE)
44	mv $(ROOTFILE) ../../doc/$(DESTFILE)
45
46../../doc/$(DESTFILE).pdf:	$(ROOTFILE).pdf
47	cp $(ROOTFILE).pdf ../../doc/$(DESTFILE).pdf
48	chmod 644 ../../doc/$(DESTFILE).pdf
49
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#	/homes/ks15/latex2html/latex2html -init_file ../texinputs/latex2html-init  $(ROOTFILE)
105	latex2html $(ROOTFILE)
106
107
108clean:
109	rm -f *.bak *.idx *.ind *.bbl *.aux *.dvi *.toc *.log *.ilg *.blg
110	rm -f indexfile.tex
111	rm -f $(ROOTFILE).ps $(ROOTFILE).ps.Z $(ROOTFILE).pdf
112	rm -rf $(ROOTFILE)
113