1 package GHSWorkspaceCreator
;
3 # ************************************************************
4 # Description : A GHS Workspace creator for version 4.x
5 # Author : Chad Elliott
6 # Create Date : 7/3/2002
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
15 use GHSProjectCreator
;
20 @ISA = qw(GHSPropertyBase WorkspaceCreator);
22 # ************************************************************
24 # ************************************************************
26 my %directives = ('I' => 1,
36 my $integrity = '[INTEGRITY Application]';
39 # ************************************************************
41 # ************************************************************
49 sub workspace_file_name
{
50 return $_[0]->get_modified_workspace_name('default', '.gpj');
56 my $crlf = $self->crlf();
57 my $prjs = $self->get_projects();
59 ## Take the primaryTarget from the first project in the list
60 if (defined $$prjs[0]) {
61 my $fh = new FileHandle
();
62 my $outdir = $self->get_outdir();
63 if (open($fh, "$outdir/$$prjs[0]")) {
65 if (/^#primaryTarget=(.+)$/) {
74 ## Print out the preliminary information
75 print $fh "#!gbuild$crlf",
76 "primaryTarget=$tgt$crlf",
78 "\t--one_instantiation_per_object$crlf",
79 "\t:sourceDir=.$crlf",
81 "\t-language=cxx$crlf",
83 "\t--new_style_casts$crlf";
87 sub create_integrity_project
{
88 my($self, $int_proj, $project, $type, $target) = @_;
89 my $outdir = $self->get_outdir();
90 my $crlf = $self->crlf();
91 my $fh = new FileHandle
();
92 my $int_file = $int_proj;
93 $int_file =~ s/\.gpj$/.int/;
95 if (open($fh, ">$outdir/$int_proj")) {
96 ## First print out the project file
97 print $fh "#!gbuild$crlf",
99 "$project\t\t$type$crlf",
101 foreach my $bsp (@integ_bsps) {
102 print $fh "$bsp$crlf";
106 ## Next create the integration file
107 if (open($fh, ">$outdir/$int_file")) {
108 print $fh "Kernel$crlf",
109 "\tFilename\t\t\tDynamicDownload$crlf",
110 "EndKernel$crlf$crlf",
112 "\tFilename\t\t\t$target$crlf",
113 "\tLanguage\t\t\tC++$crlf",
114 "\tLibrary\t\t\t\tlibINTEGRITY.so$crlf",
115 "\tLibrary\t\t\t\tlibc.so$crlf",
116 "\tLibrary\t\t\t\tlibscxx_e.so$crlf",
117 "\tTask Initial$crlf",
118 "\t\tStackLength\t\t0x8000$crlf",
120 "EndAddressSpace$crlf";
128 my($self, $project) = @_;
129 my $rh = new FileHandle
();
131 my $outdir = $self->get_outdir();
133 ## Things that seem like they should be set in the project
134 ## actually have to be set in the controlling project file.
135 if (open($rh, "$outdir/$project")) {
136 my $crlf = $self->crlf();
137 my $integrity_project = (index($tgt, 'integrity') >= 0);
138 my($int_proj, $int_type, $target);
141 if (/^\s*(\[(Program|Library|Subproject)\])\s*$/) {
143 if ($integrity_project && $type eq '[Program]') {
144 $int_proj = $project;
145 $int_proj =~ s/(\.gpj)$/_int$1/;
147 $mix =~ s/(\.gpj)$/_int$1/;
150 $mix .= "\t\t$type$crlf" .
151 "\t-object_dir=" . $self->mpc_dirname($project) .
154 elsif (/^\s*(\[Shared Object\])\s*$/) {
155 $mix .= "\t\t$1$crlf" .
157 "\t-object_dir=" . $self->mpc_dirname($project) .
160 elsif ($integrity_project && /^(.*\.bsp)\s/) {
161 push(@integ_bsps, $1);
164 if (/^\s*\-((\w)\w*)/) {
165 ## Save the required options into the mixed project string
166 if (defined $directives{$2} || defined $directives{$1}) {
170 ## If this is an integrity project, we need to find out
171 ## what the output file will be for the integrate file.
172 if (defined $int_proj && /^\s*\-o\s+(.*)\s$/) {
178 if (defined $int_proj) {
179 $self->create_integrity_project($int_proj, $project,
192 ## Print out each projet
193 foreach my $project ($self->sort_dependencies($self->get_projects(), 0)) {
194 print $fh $self->mix_settings($project);