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