blob: c3e0f3ca4ee6fdbdbfb020e091663c9ef973c0e6 (
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
|
require 'rake/clean'
# important info
target = "simtrace"
version = IO.read("version").chomp
date = Time.now.strftime("%Y-%m-%d")
revision = `git log --pretty=oneline "#{target}.sch" | wc -l`.chomp.to_i
# common files
sch = "#{target}.sch"
vsch = "#{target}_v#{version}.#{revision.to_s.rjust(3,'0')}.sch"
task :default => [:version,:print,:pdf]
task :version => vsch
CLEAN.include(vsch)
CLOBBER.include("#{target}_*.sch")
task :print => "#{target}.ps"
CLEAN.include("#{target}.ps")
task :pdf => "#{target}.pdf"
CLEAN.include("#{target}.pdf")
file vsch => sch do
sh "cp #{sch} #{vsch}"
# on \ is to prevent ruby interpreting it, th other is for sed
# the version
sh "sed -i 's/\\(version=\\)\\$Version\\$/\\1#{version}/' #{vsch}"
# the date
sh "sed -i 's/\\(date=\\)\\$Date\\$/\\1#{date}/' #{vsch}"
# the revision
sh "sed -i 's/\\(revision=\\)\\$Revision\\$/\\1#{revision}/' #{vsch}"
end
file "#{target}.ps" => vsch do
sh "gschem -p -o #{target}.ps -s /usr/share/gEDA/scheme/print.scm #{vsch} > /dev/null 2>&1"
end
file "#{target}.pdf" => "#{target}.ps" do
sh "ps2pdf -sPAPERSIZE=a4 #{target}.ps"
end
|