Update POD
[gruntmaster-daemon.git] / gruntmaster-compile
CommitLineData
da905f9e
MG
1#!/usr/bin/perl -w
2use v5.14;
3no if $] > 5.017011, warnings => 'experimental::smartmatch';
4
9577371b
MG
5use File::Copy qw/copy/;
6
da905f9e
MG
7my ($format, $basename, $name) = @ARGV;
8my $ret = fork // die $!;
9if ($ret) {
9577371b
MG
10 $SIG{ALRM} = sub {kill KILL => $ret};
11 alarm 5;
12 wait;
13 exit $? >> 8
da905f9e 14} else {
9577371b 15 given ($format){
69c25408
MG
16 exec 'gcc', qw/-DONLINE_JUDGE -std=gnu11 -Wall -Wextra -O2 -o/, $basename, $name when 'C';
17 exec 'g++', qw/-DONLINE_JUDGE -std=gnu++11 -fabi-version=6 -Wall -Wextra -O2 -o/, $basename, $name when 'CPP';
9577371b
MG
18 exec 'gmcs', '-d:ONLINE_JUDGE', $name when 'MONO';
19 exec 'javac', $name when 'JAVA';
20 exec 'fpc', qw/-dONLINE_JUDGE -O2 -n/, $name when 'PASCAL';
21 copy $name, $basename when ['PERL', 'PYTHON']
22 }
da905f9e 23}
69c25408
MG
24
25__END__
26
27=encoding utf-8
28
29=head1 NAME
30
31gruntmaster-compile - Gruntmaster 6000 compiler frontend
32
33=head1 SYNOPSIS
34
35 gruntmaster-compile CPP file.cpp
36 gruntmaster-compile JAVA file.java
37
38=head1 DESCRIPTION
39
40gruntmaster-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.
41
42Compile commands for each format:
43
44=over
45
46=item C
47
48 gcc -DONLINE_JUDGE -std=gnu11 -Wall -Wextra -O2 -o $output $input
49
50=item CPP
51
52 g++ -DONLINE_JUDGE -std=gnu11 -fabi-version=6 -Wall -Wextra -O2 -o $output $input
53
54=item MONO
55
56 gmcs -d:ONLINE_JUDGE $input
57
58=item JAVA
59
60 javac $input
61
62=item PASCAL
63
64 fpc -dONLINE_JUDGE -O2 -n $input
65
66=item PERL
67
68 cp $input $output
69
70=item PYTHON
71
72 cp $input $output
73
74=back
75
76=head1 AUTHOR
77
78Marius Gavrilescu E<lt>marius@ieval.roE<gt>
79
80=head1 COPYRIGHT AND LICENSE
81
82Copyright (C) 2014 by Marius Gavrilescu
83
84This program is free software: you can redistribute it and/or modify
85it under the terms of the GNU Affero General Public License as published by
86the Free Software Foundation, either version 3 of the License, or
87(at your option) any later version.
88
89
90=cut
This page took 0.014417 seconds and 4 git commands to generate.