Merge pull request #228 from DOCGroup/jwillemsen-patch-1
[MPC.git] / modules / MakeWorkspaceCreator.pm
blobdc627f5fd4a21171a7574aa904005584f7a672b0
1 package MakeWorkspaceCreator;
3 # ************************************************************
4 # Description : A Generic Workspace (Makefile) creator
5 # Author : Chad Elliott
6 # Create Date : 2/18/2003
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
15 use MakeProjectCreator;
16 use MakeWorkspaceBase;
17 use WorkspaceCreator;
19 use vars qw(@ISA);
20 @ISA = qw(MakeWorkspaceBase WorkspaceCreator);
22 # ************************************************************
23 # Data Section
24 # ************************************************************
26 my $targets = 'clean generated realclean check-syntax $(CUSTOM_TARGETS)';
28 # ************************************************************
29 # Subroutine Section
30 # ************************************************************
32 sub write_project_targets {
33 my($self, $fh, $crlf, $target, $list) = @_;
35 ## Print out a make command for each project
36 foreach my $project (@$list) {
37 my $dname = $self->mpc_dirname($project);
38 my $chdir = ($dname ne '.');
39 print $fh "\t\@",
40 ($chdir ? "cd $dname && " : ''),
41 '"$(MAKE)" -f ',
42 ($chdir ? $self->mpc_basename($project) : $project),
43 " $target$crlf";
47 sub pre_workspace {
48 my($self, $fh) = @_;
49 $self->workspace_preamble($fh, $self->crlf(), 'Make Workspace',
50 '');
54 sub write_comps {
55 my($self, $fh) = @_;
56 my %targnum;
57 my @list = $self->number_target_deps($self->get_projects(),
58 $self->get_project_info(),
59 \%targnum, 0);
61 ## Send all the information to our base class method
62 $self->write_named_targets($fh, $self->crlf(), \%targnum, \@list,
63 ($self->languageIs(Creator::csharp) ?
64 'bundle ' : '') . $targets, '', '',
65 $self->project_target_translation(1), 1);