-
Notifications
You must be signed in to change notification settings - Fork 3
/
bc-psuedo-make.pl
executable file
·46 lines (30 loc) · 1.25 KB
/
bc-psuedo-make.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
#!/bin/perl
# I can't get make to do what I want (but could if I tried harder),
# this hack works around it
# TODO: allow passing arguments to only recompile those arguments
# --force: force recompilation even if target appears up to date
# --pg: compile with -pg
require "/usr/local/lib/bclib.pl";
# set pg flag is given as option
$PGFLAG = $globopts{pg}?"-pg":"";
# TODO: this should check standard.tm + bclib.h time too
for $i (glob("*.c")) {
my($targ) = $i;
$targ=~s%^(.*?)\.c$%/home/user/bin/$1%isg;
# if targ is more recent, ignore
my($targtime) = -M $targ;
if ($targtime && $targtime < -M $i && !$globopts{force}) {
debug("$i: COMPILED VERSION IS UP TO DATE");
next;
}
# else compile
# my($cmd) = "gcc -pg -std=gnu99 -Wall -O2 -I /home/barrycarter/SPICE/cspice/include $i -o $targ /home/barrycarter/SPICE/cspice/lib/cspice.a -lm";
# below for saopaulo, above for dullon
# removed -pg 2 Aug 2017, gmon.out not helpful
my($cmd) = "gcc $PGFLAG -std=gnu99 -Wall -O2 -I /home/user/SPICE/SPICE64/cspice/include $i -o $targ /home/user/SPICE/SPICE64/cspice/lib/cspice.a -lm";
debug($cmd);
print "Making: $i -> $targ\n";
my($out,$err,$res) = cache_command2($cmd);
# even if make ok, return warnings
print "$out\n$err\n$res\n";
}