This repository has been archived by the owner on Sep 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rakefile
67 lines (47 loc) · 1.47 KB
/
Rakefile
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
require 'rake/clean'
SrcDir = 'src'
DocDir = 'doc'
DocFiles = FileList["#{DocDir}/*.lagda",
"#{DocDir}/*.fmt"]
TeXFiles = FileList["#{DocDir}/main.tex",
"#{DocDir}/main.bib",
"#{DocDir}/preamble.tex" ]
desc "Compile and open the paper"
task :default => :build do
system "open #{DocDir}/main.pdf"
end
desc "Compile the paper"
task :build => "#{DocDir}/main.pdf"
desc "Compile the paper"
file "#{DocDir}/main.pdf" => TeXFiles do
Dir.chdir(DocDir) do
system "pdflatex main.tex"
if $?.success?
system "bibtex main"
if $?.success?
system "pdflatex main.tex"
system "pdflatex main.tex"
end
end
end
end
desc "Compile literate Agda to TeX (and remove implicits)"
file "#{DocDir}/main.tex" => DocFiles do |t|
f_abs = File.absolute_path(t.name)
f_lagda = f_abs.ext('.lagda')
f_tex = f_abs.ext('.tex')
f_dir = File.dirname(f_abs)
Dir.chdir(f_dir) do
cmd = "lhs2TeX --agda #{ f_lagda } -o #{ f_tex }"
puts cmd
system cmd
fail "error in lhs2TeX" unless $?.success?
end
end
TempDocPats = ['*.log','*.ptb','*.blg','*.bbl','*.aux','*.snm',
'*.toc','*.nav','*.out','auto','main.tex']
TempDocFiles = FileList.new(TempDocPats.map {|fn| File.join(DocDir,fn) })
TempSrcPats = ['*.agdai']
TempSrcFiles = FileList.new(TempSrcPats.map { |fn| File.join(SrcDir,fn) })
CLEAN.include(TempDocFiles,TempSrcFiles)
CLOBBER.include('#{DocDir}/main.pdf')