1 package NMakeWorkspaceCreator
;
3 # ************************************************************
4 # Description : A NMake Workspace (Makefile) creator
5 # Author : Chad Elliott
6 # Create Date : 6/10/2002
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
15 use NMakeProjectCreator
;
16 use MakeWorkspaceBase
;
22 @ISA = qw(MakeWorkspaceBase WinWorkspaceBase WorkspaceCreator VCPropertyBase);
24 # ************************************************************
26 # ************************************************************
28 my $targets = 'clean generated realclean $(CUSTOM_TARGETS)';
30 # ************************************************************
32 # ************************************************************
34 sub workspace_file_extension
{
42 $self->workspace_preamble($fh, $self->crlf(), 'NMAKE Workspace',
47 sub write_project_targets
{
48 my($self, $fh, $crlf, $target, $list) = @_;
49 my $cwd = $self->getcwd();
51 ## Print out a make command for each project
52 foreach my $project (@
$list) {
53 my $dir = $self->mpc_dirname($project);
54 my $chdir = ($dir ne '.');
56 print $fh ($chdir ?
"\t\@cd $dir$crlf\t\@echo Directory: $dir$crlf" : ''),
57 "\t\@echo Project: ", $self->mpc_basename($project), $crlf,
58 "\t\$(MAKE) /\$(MAKEFLAGS) /f ", $self->mpc_basename($project),
60 ($chdir ?
"\t\@cd \$(MAKEDIR)$crlf" : '');
66 my($self, $fh, $gen) = @_;
68 my $pjs = $self->get_project_info();
69 my @list = $self->number_target_deps($self->get_projects(), $pjs,
71 my $crlf = $self->crlf();
72 my $default = 'Win32 Debug';
74 ## Determine the default configuration. We want to get the Debug
75 ## configuration (if available). It just so happens that Debug comes
76 ## before Release so sorting the configurations works in our favor.
77 foreach my $project (keys %$pjs) {
78 my @cfgs = sort $gen->access_pi_values($pjs, $project,
79 ProjectCreator
::CONFIGURATIONS
);
80 if (defined $cfgs[0]) {
83 ## The configuration comes out in the form that is usable to Visual
84 ## Studio. We need it to be in the form that was chosen for the
85 ## nmake configuration. So, we just swap the parts and remove the
87 $default =~ s/(.*)\|(.*)/$2 $1/;
92 ## Print out the content
93 print $fh '!IF "$(CFG)" == ""', $crlf,
94 'CFG=', $default, $crlf,
95 '!MESSAGE No configuration specified. ',
96 'Defaulting to ', $default, '.', $crlf,
97 '!ENDIF', $crlf, $crlf,
98 '!IF "$(CUSTOM_TARGETS)" == ""', $crlf,
99 'CUSTOM_TARGETS=_EMPTY_TARGET_', $crlf,
102 ## Send all the information to our base class method
103 $self->write_named_targets($fh, $crlf, \
%targnum, \
@list,
104 $targets, 'CFG="$(CFG)" ', '',
105 $self->project_target_translation());
112 ## Create the map of properties that we support.
115 ## Merge in properties from all base projects
116 foreach my $base (@ISA) {
117 my $func = $base . '::get_properties';
118 my $p = $self->$func();
119 foreach my $key (keys %$p) {
120 $$props{$key} = $$p{$key};