summaryrefslogtreecommitdiff
path: root/doc/ThornGuide/Makefile
blob: 103f34062b9de1b6eaee934f496ca8836275d916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# make (defaults to ThornGuide.ps)
# make ThornGuide.tex
# make ThornGuide.dvi
# make ThornGuide.ps
# make ThornGuide.pdf


# Make quietly unless told not to
ifneq ($(strip $(SILENT)),no)
.SILENT:
endif

ifeq ($(strip $(CCTK_HOME)), )
   CCTK_HOME=$(shell pwd | sed 's,^/cygdrive/\(.\)/,\1:/,' | sed 's,^//\(.\)/,\1:/,' | sed 's/\/doc\/ThornGuide.*//' )
endif

ARRANGEMENTS_DIR=$(CCTK_HOME)/arrangements

ifeq ($(strip $(THORNLIST)), )
   THORNLIST=allthorns.th
endif

ifeq ($(strip $(PERL)), )
   PERL=/usr/bin/perl
endif

IMAGE_FILE=$(CCTK_HOME)/doc/UsersGuide/bincactus2.eps

MASTER_FILE=ThornGuide

-include make.thornlist

.PHONY: default

default : $(MASTER_FILE).ps

$(MASTER_FILE).ps: $(MASTER_FILE).dvi 
	@echo ""
	@echo "Running dvips on $<"
	dvips -f $< 2> DVIPS_MESSAGES | $(CCTK_HOME)/lib/sbin/FixPageNumbersInPostscript.pl > $@ 
	if test -e "$@"; then                                  \
	   echo "   $@ created.";                              \
	else                                                   \
	   echo "Cannot find $@, an error must have occured."; \
	fi ;                                                   
	echo "Done."

$(MASTER_FILE).dvi: $(MASTER_FILE).tex
	@echo ""
	@echo "Latexing $<"
	latex -interaction=nonstopmode $< >  LATEX_MSGS 2>&1; \
	latex -interaction=nonstopmode $< >> LATEX_MSGS 2>&1; \
	latex -interaction=nonstopmode $< >> LATEX_MSGS 2>&1; \
	latex -interaction=nonstopmode $< >> LATEX_MSGS 2>&1;  \
	if test -e "$@"; then                                  \
	   echo "   $@ created.";                              \
	else                                                   \
	   echo "Cannot find $@, an error must have occured."; \
	fi ;                                                   
	echo "Done."
	
$(MASTER_FILE).pdf: $(MASTER_FILE).tex
	@echo ""
	@echo "Running pdflatex on $<"

	pdflatex -interaction=nonstopmode $< >  PDFLATEX_MSGS 2>&1; \
	pdflatex -interaction=nonstopmode $< >> PDFLATEX_MSGS 2>&1; \
	pdflatex -interaction=nonstopmode $< >> PDFLATEX_MSGS 2>&1; \
	pdflatex -interaction=nonstopmode $< >> PDFLATEX_MSGS 2>&1

	if test -e "$@"; then                                  \
	   echo "   $@ created.";                              \
	else                                                   \
	   echo "Cannot find $@, an error must have occured."; \
	fi ;                                                  
	echo "Done."

$(MASTER_FILE).tex:  $(foreach thorn, $(THORNS), $(thorn)/param.ccl $(thorn)/interface.ccl $(thorn)/schedule.ccl)
	@echo "Creating thorn documentation ThornGuide.tex"
	@echo "  Processing ..."
	@echo "     param.ccl ..."
	$(PERL) -s $(CCTK_HOME)/lib/sbin/ParamLatex.pl -cctk_home=$(CCTK_HOME) -directory=$(ARRANGEMENTS_DIR) -thornlist=$(THORNLIST) -outdir=./ -section -grouping=bythorn -sort=scope > PARAMLATEX_MSGS 2>&1
	@echo "     interface.ccl .... (currently unavailable)"
	@echo "     schedule.ccl ..."
	$(PERL) -s $(CCTK_HOME)/lib/sbin/SchedLatex.pl -cctk_home=$(CCTK_HOME) -directory=$(ARRANGEMENTS_DIR) -thornlist=$(THORNLIST) -outdir=./ -section > SCHEDLATEX_MSGS 2>&1
	@echo "  Creating $@ ..."
	$(PERL) -s $(CCTK_HOME)/lib/sbin/ThornGuide.pl -cctk_home=$(CCTK_HOME) -directory=$(ARRANGEMENTS_DIR) -thornlist=$(THORNLIST) -outdir=./ > THORNGUIDE_MSGS 2>&1
	
	if test -e $(IMAGE_FILE) && test ! -e "bincactus.eps"; then \
	   cp $(IMAGE_FILE) bincactus.eps;                          \
	fi ; 
	echo "Done." 

make.thornlist: $(THORNLIST) 
	THORNS=`$(PERL) -s $(CCTK_HOME)/lib/sbin/ThornList.pl -arrangements_dir=$(ARRANGEMENTS_DIR) -thornlist=$(THORNLIST)`

allthorns.th:
	@echo "Creating $@ ..."
	$(PERL) -s $(CCTK_HOME)/lib/sbin/ThornList.pl -arrangements_dir=$(ARRANGEMENTS_DIR) > $@