-
Notifications
You must be signed in to change notification settings - Fork 3
/
unmake.pl
executable file
·41 lines (33 loc) · 900 Bytes
/
unmake.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
#!/usr/bin/env perl
# unmake.pl - driver for other unmake subcomponents
# (c) 2012 Mike Heise
use warnings;
use strict;
use 5.010;
# quick & dirty argument processing
given ($ARGV[0]) {
when (undef) {analyze(); projgen();}
when (/^-parse/) {parse();}
when (/^-analyze/) {analyze();}
default {say STDERR "$_ usage: unmake [-p|a]"}
}
sub parse {
my $redirflag = shift;
my $ret;
if ($redirflag) {
$ret = system +("parse_build_system > cbf.xml");
} else {
$ret = system +("parse_build_system");
}
die "Couldn't call parser: $!" if $ret == -1;
}
sub analyze {
parse('redirect to cbf.xml') unless -e 'Makefile.mks';
my $ret = system "analyze_build_system";
die "Couldn't call parser: $!" if $ret == -1;
unlink 'Makefile.mks';
}
sub projgen {
my $ret = system "projgen";
die "Couldn't call parser: $!" if $ret == -1;
}