#!/usr/bin/perl

use File::Basename;

# There should only be a single argument, which is the fluid file

$fullname = "";

if (1 != @ARGV) {
    die "Requires a path to the fluid file as an argument";
}

$fullname = shift(@ARGV);
#print $fullname . "\n";

# Now, we use the filename package to parse it
($name,$path,$suffix) = fileparse($fullname,"\.fl");

$filename = $name . $suffix;

#print "name=" . $name . "\n";
#print "path=" . $path . "\n";
#print "suffix=" . $suffix . "\n";

if ($suffix != "\.fl") {
    die "Input not a fluid file";
}

$ccfile = $name . ".cc";
$hfile = $name . ".h";

# Generate the fluid files
`(cd $path;fluid -c -o $ccfile -h $hfile $filename)`;
