#!/usr/bin/perl
use strict;
use warnings;

use File::Basename;
use lib ( dirname($0) );
use Qtopia::Paths;
use Qtopia::Vars;

Qtopia::Paths::get_paths();

# Windows depot builds use the perl scripts directly rather than the compiled code
if ( $isWindows ) {
    check_script($0, "$depotpath/src/qtopiadesktop/build/bin", $ARGV[0]);
}

use constant DEBUG => 1;

DEBUG and print join(" ", @ARGV)."\n";

my $file = $ARGV[$#ARGV-2];
my $output = $ARGV[$#ARGV];
open IN, "$file" or die "Can't read $file";
my @data = <IN>;
close IN;
my @tmp = grep /Q_OBJECT/, @data;
if ( @tmp ) {
    system(@ARGV) == 0 or exit 1;
} else {
    DEBUG and print "Skipping\n";
    open OUT, ">$output" or die "Can't write $output";
    my $tmpvarname = $output;
    $tmpvarname =~ s/[^a-zA-Z0-9]/_/g;
    print OUT "\n";
    close OUT;
}
exit 0;
