Skip to content

Instantly share code, notes, and snippets.

@tomyan
Last active December 16, 2015 01:49
Show Gist options
  • Save tomyan/5357824 to your computer and use it in GitHub Desktop.
Save tomyan/5357824 to your computer and use it in GitHub Desktop.
run and colour output of gcc/ld
#!/usr/bin/perl
$t = shift;
print "* $t" . "." x (50 - length $t);
($a, $b, $c) = ("\033[", ";01m", "\033[0m");
$_ = `@ARGV 2>\&1` || '';
s{
(?:^|(?<=\n))
( (?:[^\n:]+:[^\n]+\n)?
[^\n:]+:\d+:\d+:\s+(\w+):[^\n]+\n
)
}{
$a . { error => 31, warning => 33, note => 36 }->{$2} . "$b$1$c"
}gsex;
print $? ? "${a}31${b}error$c\n" :
$_ ? "${a}33${b}warnings$c\n" :
"${a}32${b}success$c\n",
$? ? "${a}34$b@ARGV$c\n" : '',
$_;
exit $? >> 8;
build/%.o: src/%.[cs]
@mkdir -p `dirname $@`
@build-scripts/build $< $(CC) $(CFLAGS) -c $< -o $@
target/%: build/root_tasks/%.o $(OBJECTS)
@mkdir -p target
@build-scripts/build "linking $@" $(LD) $(LDFLAGS) -o $@ $^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment