]>
iEval git - gruntmaster-daemon.git/blob - gruntmaster-compile
3 no if $] > 5.017011 , warnings
=> 'experimental::smartmatch' ;
5 use File
:: Copy qw
/copy/ ;
6 use File
:: Basename qw
/fileparse/ ;
8 my ( $format , $name ) = @ARGV ;
9 my $basename = fileparse
$name , qr/\..*/ ;
11 my $ret = fork // die $!;
13 $SIG { ALRM
} = sub { kill KILL
=> $ret };
19 exec 'gcc' , qw
/-DONLINE_JUDGE -std=gnu11 -Wall -Wextra -O2 -o/ , $basename , $name when 'C' ;
20 exec 'g++' , qw
/-DONLINE_JUDGE -std=gnu++11 -fabi-version=6 -Wall -Wextra -O2 -o/ , $basename , $name when 'CPP' ;
22 system 'gmcs' , '-d:ONLINE_JUDGE' , $name and die "gmcs failed: errno=$! return=$?" ;
23 rename " $basename .exe" , $basename ;
24 chmod 0755 , $basename ;
26 exec 'gmcs' , '-d:ONLINE_JUDGE' , $name when 'MONO' ;
28 system 'javac' , $name and die "javac failed: errno=$! return=$?" ;
29 system 'jar' , 'cfe' , $basename , $basename , " $basename .class" and die "jar failed: errno=$! return=$?" ;
30 chmod 0755 , $basename ;
33 exec 'fpc' , qw
/-dONLINE_JUDGE -O2/ , $name when 'PASCAL' ;
34 exec 'go' , qw
/build -compiler gc/ , $name when 'GOLANG' ;
35 exec 'go' , qw
/build -compiler gccgo/ , $name , when 'GCCGO' ;
36 exec 'ghc' , qw
/-DONLINE_JUDGE -Wall -O2 -o/ , $basename , $name when 'HASKELL' ;
38 when ([ qw
/PERL PYTHON/ ]){
40 open OUT
, '>' , $basename ;
41 print OUT
"#!/usr/bin/perl \n " if $_ eq 'PERL' ;
42 print OUT
"#!/usr/bin/python \n " if $_ eq 'PYTHON' ;
46 chmod 0755 , $basename ;
59 gruntmaster-compile - Gruntmaster 6000 compiler frontend
63 gruntmaster-compile CPP file.cpp
64 gruntmaster-compile JAVA file.java
68 gruntmaster-compile is a very simple frontend to various comilers. It takes two arguments: the file format and the file name, and produces a compiled executable. The executable's name is the basename of the input file.
70 Compile commands for each format:
76 gcc -DONLINE_JUDGE -std=gnu11 -Wall -Wextra -O2 -o $output $input
80 g++ -DONLINE_JUDGE -std=gnu++11 -fabi-version=6 -Wall -Wextra -O2 -o $output $input
84 gmcs -d:ONLINE_JUDGE $input
92 fpc -dONLINE_JUDGE -O2 $input
96 go build -compiler gc $input
100 go build -compiler gccgo $input
104 ghc -DONLINE_JUDGE -Wall -O2 -o $output $input
118 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
120 =head1 COPYRIGHT AND LICENSE
122 Copyright (C) 2014 by Marius Gavrilescu
124 This program is free software: you can redistribute it and/or modify
125 it under the terms of the GNU Affero General Public License as published by
126 the Free Software Foundation, either version 3 of the License, or
127 (at your option) any later version.
This page took 0.057379 seconds and 4 git commands to generate.