Subversion Repositories gelsvn

Rev

Rev 107 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
107 bj 1
package MakeWorkspaceCreator;
2
 
3
# ************************************************************
4
# Description   : A Generic Workspace (Makefile) creator
5
# Author        : Chad Elliott
6
# Create Date   : 2/18/2003
7
# ************************************************************
8
 
9
# ************************************************************
10
# Pragmas
11
# ************************************************************
12
 
13
use strict;
14
use File::Basename;
15
 
16
use MakeProjectCreator;
17
use WorkspaceCreator;
18
 
19
use vars qw(@ISA);
20
@ISA = qw(WorkspaceCreator);
21
 
22
# ************************************************************
23
# Data Section
24
# ************************************************************
25
 
26
my(@targets) = ('clean', 'depend', 'generated', 'realclean',
27
                '$(CUSTOM_TARGETS)');
28
 
29
# ************************************************************
30
# Subroutine Section
31
# ************************************************************
32
 
33
sub workspace_file_name {
34
  my($self) = shift;
35
  return $self->get_modified_workspace_name('Makefile', '');
36
}
37
 
38
 
39
sub workspace_per_project {
40
  #my($self) = shift;
41
  return 1;
42
}
43
 
44
 
45
sub pre_workspace {
46
  my($self) = shift;
47
  my($fh)   = shift;
48
  my($crlf) = $self->crlf();
49
 
50
  print $fh '#----------------------------------------------------------------------------', $crlf,
51
            '#       Make Workspace', $crlf,
52
            '#', $crlf,
53
            '# $Id: MakeWorkspaceCreator.pm 107 2005-09-02 16:42:23Z bj $', $crlf,
54
            '#', $crlf,
55
            '# This file was generated by MPC.  Any changes made directly to', $crlf,
56
            '# this file will be lost the next time it is generated.', $crlf,
57
            '#', $crlf,
58
            '# MPC Command:', $crlf,
59
            "# $0 @ARGV", $crlf,
60
            '#----------------------------------------------------------------------------', $crlf,
61
            $crlf;
62
}
63
 
64
 
65
sub write_comps {
66
  my($self)     = shift;
67
  my($fh)       = shift;
68
  my($crlf)     = $self->crlf();
69
  my($projects) = $self->get_projects();
70
  my($trans)    = $self->project_target_translation(1);
71
  my(%targnum)  = ();
72
  my($pjs)      = $self->get_project_info();
73
  my(@list)     = $self->number_target_deps($projects, $pjs, \%targnum);
74
 
75
  ## Print out the "all" target
76
  print $fh $crlf . 'all:';
77
  foreach my $project (@list) {
78
    print $fh " $$trans{$project}";
79
  }
80
 
81
  ## Print out all other targets here
82
  print $fh "$crlf$crlf@targets:$crlf";
83
  foreach my $project (@list) {
84
    my($dname) = $self->mpc_dirname($project);
85
    print $fh "\t\@",
86
              ($dname ne '.' ? "cd $dname; " : ''),
87
              "\$(MAKE) -f ",
88
              ($dname eq '.' ? $project : basename($project)),
89
              " \$(\@)$crlf";
90
  }
91
 
92
  ## Print out each target separately
93
  foreach my $project (@list) {
94
    my($dname) = $self->mpc_dirname($project);
95
    print $fh $crlf, $$trans{$project}, ':';
96
    if (defined $targnum{$project}) {
97
      foreach my $number (@{$targnum{$project}}) {
98
        print $fh " $$trans{$list[$number]}";
99
      }
100
    }
101
 
102
    print $fh $crlf,
103
              "\t\@",
104
              ($dname ne '.' ? "cd $dname; " : ''),
105
              "\$(MAKE) -f ",
106
              ($dname eq '.' ? $project : basename($project)),
107
              ' generated all', $crlf;
108
  }
109
 
110
  ## Print out the project_name_list target
111
  print $fh $crlf, "project_name_list:$crlf";
112
  foreach my $project (sort @list) {
113
    print $fh "\t\@echo $$trans{$project}$crlf";
114
  }
115
}
116
 
117
 
118
 
119
1;