#!/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/build/bin", $ARGV[0]);
}

use constant DEBUG => 0;

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 ) {
    #DEBUG and print join(" ", @ARGV)."\n";
    system(@ARGV) == 0 and exit 0;
} 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;
