Subversion Repositories gelsvn

Rev

Rev 217 | 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
 
15
use MakeProjectCreator;
16
use WorkspaceCreator;
17
 
18
use vars qw(@ISA);
19
@ISA = qw(WorkspaceCreator);
20
 
21
# ************************************************************
22
# Data Section
23
# ************************************************************
24
 
25
my(@targets) = ('clean', 'depend', 'generated', 'realclean',
26
                '$(CUSTOM_TARGETS)');
27
 
28
# ************************************************************
29
# Subroutine Section
30
# ************************************************************
31
 
32
sub workspace_file_name {
33
  my($self) = shift;
34
  return $self->get_modified_workspace_name('Makefile', '');
35
}
36
 
37
 
38
sub workspace_per_project {
39
  #my($self) = shift;
40
  return 1;
41
}
42
 
43
 
44
sub pre_workspace {
45
  my($self) = shift;
46
  my($fh)   = shift;
47
  my($crlf) = $self->crlf();
48
 
49
  print $fh '#----------------------------------------------------------------------------', $crlf,
50
            '#       Make Workspace', $crlf,
51
            '#', $crlf,
52
            '# $Id: MakeWorkspaceCreator.pm 217 2006-05-05 09:35:48Z bj $', $crlf,
53
            '#', $crlf,
54
            '# This file was generated by MPC.  Any changes made directly to', $crlf,
55
            '# this file will be lost the next time it is generated.', $crlf,
56
            '#', $crlf,
57
            '# MPC Command:', $crlf,
58
            "# $0 @ARGV", $crlf,
59
            '#----------------------------------------------------------------------------', $crlf,
60
            $crlf;
61
}
62
 
63
 
64
sub write_comps {
65
  my($self)     = shift;
66
  my($fh)       = shift;
67
  my($crlf)     = $self->crlf();
68
  my($projects) = $self->get_projects();
69
  my($trans)    = $self->project_target_translation(1);
70
  my(%targnum)  = ();
71
  my($pjs)      = $self->get_project_info();
217 bj 72
  my(@list)     = $self->number_target_deps($projects, $pjs, \%targnum, 0);
107 bj 73
 
74
  ## Print out the "all" target
75
  print $fh $crlf . 'all:';
76
  foreach my $project (@list) {
77
    print $fh " $$trans{$project}";
78
  }
79
 
80
  ## Print out all other targets here
81
  print $fh "$crlf$crlf@targets:$crlf";
82
  foreach my $project (@list) {
83
    my($dname) = $self->mpc_dirname($project);
84
    print $fh "\t\@",
85
              ($dname ne '.' ? "cd $dname; " : ''),
86
              "\$(MAKE) -f ",
217 bj 87
              ($dname eq '.' ? $project : $self->mpc_basename($project)),
107 bj 88
              " \$(\@)$crlf";
89
  }
90
 
91
  ## Print out each target separately
92
  foreach my $project (@list) {
93
    my($dname) = $self->mpc_dirname($project);
217 bj 94
    print $fh $crlf, '.PHONY: ', $$trans{$project},
95
              $crlf, $$trans{$project}, ':';
107 bj 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 ",
217 bj 106
              ($dname eq '.' ? $project : $self->mpc_basename($project)),
107 bj 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;