-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeploy.pl
99 lines (68 loc) · 1.95 KB
/
deploy.pl
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
#!/usr/bin/perl
# Script to make a ready-to-deploy state from the development directory
# Mainly, it adds a comment region at the top of each .c/.h file.
#
# Written by Tomofumi Yuki, 11/21 2014
#
use File::Path;
use File::Copy;
my $VERBOSE = 1;
my $HEADER = << "EOS";
/**
* This version is stamped on Apr. 2, 2015
*
* Contact:
* Louis-Noel Pouchet <pouchet@cse.ohio-state.edu>
* Tomofumi Yuki <tomofumi.yuki@inria.fr>
*
* Web address: http://polybench.sourceforge.net
*/
EOS
my $SOURCE_DIR = 'polybench-code';
my $TARGET_DIR = 'deploy/polybench-beta';
if ($#ARGV > 0) {
printf("usage: perl deploy.pl [target-dir]\n");
}
if ($#ARGV == 0) {
$TARGET_DIR = $ARGV[0];
}
if (-e $TARGET_DIR) {
printf($TARGET_DIR." already exists. Please remove the target directory before running this script.\n");
exit 1;
}
&cloneDir($SOURCE_DIR, $TARGET_DIR);
# Copy PDF document
copy 'polybench-doc/polybench.pdf', $TARGET_DIR.'/'.'polybench.pdf' or die "cannot copy polybench.pdf";
sub cloneDir() {
my $sourceDir = $_[0];
my $targetDir = $_[1];
mkdir $targetDir;
print("cloneDir($sourceDir, $targetDir)\n") if ($VERBOSE);
my @files;
opendir DIR, $sourceDir or die "cannot open $sourceDir.\n";
while (my $file = readdir DIR) {
next if ($file=~'^\..*');
push @files, $file;
}
closedir DIR;
print("@files\n") if ($VERBOSE);
foreach $file (@files) {
my $srcFile = $sourceDir.'/'.$file;
my $tgtFile = $targetDir.'/'.$file;
if (-d $srcFile) {
&cloneDir($srcFile, $tgtFile);
} else {
next if ($file =~ /ChangeLog-internal/);
if ($file =~ /\.[ch]$/) {
my $header = $HEADER;
$header =~ s/__FILENAME__/$file/;
open FILE, ">$tgtFile" or die "cannot open $tgtFile.\n";
print FILE $header;
close FILE;
}
my $command = "cat $srcFile >> $tgtFile";
#print($command."\n");
system($command);
}
}
}