1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
package GHSProjectCreator;
# ************************************************************
# Description : A GHS project creator for version 4.x.
# By default, this module assumes Multi will
# be used on Windows. If it is not, you must
# set the MPC_GHS_UNIX environment variable.
# Author : Chad Elliott
# Create Date : 4/19/2002
# ************************************************************
# ************************************************************
# Pragmas
# ************************************************************
use strict;
use ProjectCreator;
use GHSPropertyBase;
use vars qw(@ISA);
@ISA = qw(GHSPropertyBase ProjectCreator);
# ************************************************************
# Data Section
# ************************************************************
my $startre;
# ************************************************************
# Subroutine Section
# ************************************************************
sub convert_slashes {
return (defined $ENV{$GHSPropertyBase::ghsunix} ? 0 : 1);
}
sub case_insensitive {
return (defined $ENV{$GHSPropertyBase::ghsunix} ? 0 : 1);
}
sub use_win_compatibility_commands {
return (defined $ENV{$GHSPropertyBase::ghsunix} ? 0 : 1);
}
sub post_file_creation {
my $self = shift;
## These special files are only used if it is a custom only project or
## there are no source files in the project.
if ((defined $self->get_assignment('custom_only') ||
!defined $self->get_assignment('source_files')) &&
defined $self->get_assignment('custom_types')) {
my $fh = new FileHandle();
if (open($fh, '>.custom_build_rule')) {
print $fh ".empty_html_file\n";
close($fh);
}
if (open($fh, '>.empty_html_file')) {
close($fh);
}
}
return undef;
}
sub compare_output {
#my $self = shift;
return 1;
}
sub project_file_extension {
#my $self = shift;
return '.gpj';
}
sub fill_value {
my($self, $name) = @_;
my $value;
if (!defined $startre) {
$startre = $self->escape_regex_special($self->getstartdir());
}
## The Green Hills project format is strange and needs all paths
## relative to the top directory, no matter where the source files
## reside. The template uses reltop_ in front of the real project
## settings, so we get the value of the real keyword and then do some
## adjusting to get it relative to the top directory.
if ($name =~ /^reltop_(\w+)/) {
$value = $self->relative($self->get_assignment($1));
if (defined $value) {
my $part = $self->getcwd();
$part =~ s/^$startre[\/]?//;
if ($part ne '') {
if ($value eq '.') {
$value = $part;
}
else {
$value = $part . '/' . $value;
}
}
}
}
elsif ($name eq 'reltop') {
$value = $self->getcwd();
$value =~ s/^$startre[\/]?//;
$value = '.' if ($value eq '');
}
elsif ($name eq 'slash') {
## We need to override the slash value so that we can give the right
## value for Windows or UNIX.
$value = (defined $ENV{$GHSPropertyBase::ghsunix} ? '/' : '\\');
}
elsif ($name eq 'postmkdir') {
## If we're on Windows, we need an "or" command that will reset the
## errorlevel so that a mkdir on a directory that already exists
## doesn't cause the build to cease.
$value = ' || type nul' if (!defined $ENV{$GHSPropertyBase::ghsunix});
}
return $value;
}
sub get_dll_exe_template_input_file {
#my $self = shift;
return 'ghsdllexe';
}
sub get_lib_exe_template_input_file {
#my $self = shift;
return 'ghslibexe';
}
sub get_lib_template_input_file {
#my $self = shift;
return 'ghslib';
}
sub get_dll_template_input_file {
#my $self = shift;
return 'ghsdll';
}
1;
|