summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-05-15 12:12:05 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-05-15 12:12:05 +0000
commit408f5a1f4ff4338bc71ea2da3f065b57afd90345 (patch)
tree39dd3b3d10054eb2a48ee94c18ce1ea0aac569d6
parent7fc95e2c87a32e2b6c87bdd5bbf88a649733412d (diff)
downloadATCD-408f5a1f4ff4338bc71ea2da3f065b57afd90345.tar.gz
ChangeLogTag: Thu May 15 07:08:39 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog22
-rw-r--r--bin/MakeProjectCreator/modules/ProjectCreator.pm11
-rw-r--r--bin/MakeProjectCreator/modules/WorkspaceCreator.pm38
-rw-r--r--bin/MakeProjectCreator/templates/em3vcp.mpd2
-rw-r--r--bin/MakeProjectCreator/templates/gnu.mpd2
-rw-r--r--bin/MakeProjectCreator/templates/make.mpd2
-rw-r--r--bin/MakeProjectCreator/templates/nmake.mpd2
-rw-r--r--bin/MakeProjectCreator/templates/vc6dsp.mpd2
-rw-r--r--bin/MakeProjectCreator/templates/vc7.mpd2
9 files changed, 74 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index b49f5f03dd3..e0404ea3012 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Thu May 15 07:08:39 2003 Chad Elliott <elliott_c@ociweb.com>
+
+ * bin/MakeProjectCreator/modules/ProjectCreator.pm:
+
+ Fixed a couple of bugs with the custom build types. Generated
+ files were being selected due to a back regular expression match.
+
+ * bin/MakeProjectCreator/modules/WorkspaceCreator.pm:
+
+ Only write out a new workspace if it is different than the
+ existing one or if one doesn't exist.
+
+ * bin/MakeProjectCreator/templates/em3vcp.mpd:
+ * bin/MakeProjectCreator/templates/gnu.mpd:
+ * bin/MakeProjectCreator/templates/make.mpd:
+ * bin/MakeProjectCreator/templates/nmake.mpd:
+ * bin/MakeProjectCreator/templates/vc6dsp.mpd:
+ * bin/MakeProjectCreator/templates/vc7.mpd:
+
+ Only output custom rules if the input file has corresponding
+ output files.
+
Wed May 14 20:02:56 UTC 2003 Don Hinton <dhinton@dresystems.com>
* ace/config-all.h:
diff --git a/bin/MakeProjectCreator/modules/ProjectCreator.pm b/bin/MakeProjectCreator/modules/ProjectCreator.pm
index 1700cb6d29b..1b631b4d476 100644
--- a/bin/MakeProjectCreator/modules/ProjectCreator.pm
+++ b/bin/MakeProjectCreator/modules/ProjectCreator.pm
@@ -936,10 +936,11 @@ sub generate_default_target_names {
## If it's neither an exe or library target, we will search
## through the source files for a main()
+ my(@sources) = $self->get_component_list('source_files');
if (!$self->lib_target()) {
my($fh) = new FileHandle();
my($exename) = undef;
- foreach my $file ($self->get_component_list('source_files')) {
+ foreach my $file (@sources) {
if (open($fh, $file)) {
while(<$fh>) {
## Remove c++ comments (ignore c style comments for now)
@@ -965,8 +966,8 @@ sub generate_default_target_names {
}
## If we still don't have a project type, then we will
- ## default to a library
- if (!$self->exe_target()) {
+ ## default to a library if there are source files
+ if (!$self->exe_target() && $#sources >= 0) {
my($base) = $self->get_assignment('project_name');
$self->process_assignment('sharedname', $base);
$self->process_assignment('staticname', $base);
@@ -1645,7 +1646,9 @@ sub check_custom_output {
}
my($re) = $self->escape_regex_special(basename($base));
foreach my $c (@$comps) {
- if ($c =~ /$re$/) {
+ ## We only match if the built file name matches from
+ ## beginning to end or from a slash to the end.
+ if ($c =~ /^$re$/ || $c =~ /\/$re$/) {
push(@outputs, $built);
last;
}
diff --git a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
index 332d93c66ea..bccc84d4b3c 100644
--- a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
+++ b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
@@ -13,6 +13,7 @@ package WorkspaceCreator;
use strict;
use FileHandle;
use File::Path;
+use File::Compare;
use File::Basename;
use Creator;
@@ -484,21 +485,48 @@ sub write_workspace {
if ($dir ne '.') {
mkpath($dir, 0, 0777);
}
- if (open($fh, ">$name")) {
+
+ ## First write the output to a temporary file
+ my($tmp) = "MWC$>.$$";
+ my($different) = 1;
+ if (open($fh, ">$tmp")) {
$self->pre_workspace($fh);
$self->write_comps($fh, $generator);
$self->post_workspace($fh);
close($fh);
- if ($addfile) {
- $self->add_file_written($name);
+ if (-r $name &&
+ -s $tmp == -s $name && compare($tmp, $name) == 0) {
+ $different = 0;
}
}
else {
- $error = 'ERROR: Unable to open ' . $self->getcwd() .
- "/$name for output";
+ $error = "ERROR: Unable to open $tmp for output.";
$status = 0;
}
+
+ if ($status) {
+ if ($different) {
+ unlink($name);
+ if (rename($tmp, $name)) {
+ if ($addfile) {
+ $self->add_file_written($name);
+ }
+ }
+ else {
+ $error = 'ERROR: Unable to open ' . $self->getcwd() .
+ "/$name for output";
+ $status = 0;
+ }
+ }
+ else {
+ ## We will pretend that we wrote the file
+ unlink($tmp);
+ if ($addfile) {
+ $self->add_file_written($name);
+ }
+ }
+ }
}
else {
print "WARNING: No projects were created.\n" .
diff --git a/bin/MakeProjectCreator/templates/em3vcp.mpd b/bin/MakeProjectCreator/templates/em3vcp.mpd
index 206553dfefc..fea85e0a269 100644
--- a/bin/MakeProjectCreator/templates/em3vcp.mpd
+++ b/bin/MakeProjectCreator/templates/em3vcp.mpd
@@ -232,6 +232,7 @@ BuildCmds= \
# PROP Default_Filter "<%foreach(custom_type->inputexts)%><%custom_type->inputext%><%fornotlast(";")%><%endfor%>"
<%foreach(custom_type->input_files)%>
+<%if(custom_type->input_file->output_files)%>
# Begin Source File
SOURCE=.\<%custom_type->input_file%>
@@ -269,6 +270,7 @@ BuildCmds= \
!ENDIF
# End Source File
+<%endif%>
<%endfor%>
# End Group
<%endfor%>
diff --git a/bin/MakeProjectCreator/templates/gnu.mpd b/bin/MakeProjectCreator/templates/gnu.mpd
index a4f2060a772..488b6d589dc 100644
--- a/bin/MakeProjectCreator/templates/gnu.mpd
+++ b/bin/MakeProjectCreator/templates/gnu.mpd
@@ -231,12 +231,14 @@ TAO_IDLFLAGS += <%idlflags%>
<%if(custom_types)%>
<%foreach(custom_types)%>
<%foreach(custom_type->input_files)%>
+<%if(custom_type->input_file->output_files)%>
GENERATED_DIRTY +=<%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%>
<%foreach(custom_type->input_file->output_files)%>
<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>: <%custom_type->input_file%>
<%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $^ <%if(custom_type->output_option)%><%custom_type->output_option%> $@<%endif%>
<%endfor%>
+<%endif%>
<%endfor%>
<%endfor%>
ifneq ($(GENERATED_DIRTY),)
diff --git a/bin/MakeProjectCreator/templates/make.mpd b/bin/MakeProjectCreator/templates/make.mpd
index 099cf8dfc34..1424f26f6bf 100644
--- a/bin/MakeProjectCreator/templates/make.mpd
+++ b/bin/MakeProjectCreator/templates/make.mpd
@@ -71,12 +71,14 @@ OUTPUT_OPTION = -o $@
<%if(custom_types)%>
<%foreach(custom_types)%>
<%foreach(custom_type->input_files)%>
+<%if(custom_type->input_file->output_files)%>
GENERATED_DIRTY +=<%foreach(custom_type->input_file->output_files)%> <%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%><%endfor%>
<%foreach(custom_type->input_file->output_files)%>
<%if(flag_overrides(custom_type->input_file, gendir))%><%flag_overrides(custom_type->input_file, gendir)%>/<%basename(custom_type->input_file->output_file)%><%else%><%custom_type->input_file->output_file%><%endif%>: <%custom_type->input_file%>
<%custom_type->command%> <%if(flag_overrides(custom_type->input_file, commandflags))%><%flag_overrides(custom_type->input_file, commandflags)%><%else%><%custom_type->commandflags%><%endif%> $^ <%if(custom_type->output_option)%><%custom_type->output_option%> $@<%endif%>
<%endfor%>
+<%endif%>
<%endfor%>
<%endfor%>
.PRECIOUS: $(GENERATED_DIRTY)
diff --git a/bin/MakeProjectCreator/templates/nmake.mpd b/bin/MakeProjectCreator/templates/nmake.mpd
index d169f64a785..b015dc49b8a 100644
--- a/bin/MakeProjectCreator/templates/nmake.mpd
+++ b/bin/MakeProjectCreator/templates/nmake.mpd
@@ -248,6 +248,7 @@ InputDir=<%dirname(idl_file)%>
<%endfor%>
<%foreach(custom_types)%>
<%foreach(custom_type->input_files)%>
+<%if(custom_type->input_file->output_files)%>
SOURCE=<%custom_type->input_file%>
<%foreach(platforms)%>
@@ -274,6 +275,7 @@ InputDir=<%dirname(custom_type->input_file)%>
!ENDIF
<%endfor%>
+<%endif%>
<%endfor%>
<%endfor%>
<%foreach(resource_files)%>
diff --git a/bin/MakeProjectCreator/templates/vc6dsp.mpd b/bin/MakeProjectCreator/templates/vc6dsp.mpd
index 5224e74ed67..52d51c5845e 100644
--- a/bin/MakeProjectCreator/templates/vc6dsp.mpd
+++ b/bin/MakeProjectCreator/templates/vc6dsp.mpd
@@ -218,6 +218,7 @@ BuildCmds= \
# PROP Default_Filter "<%foreach(custom_type->inputexts)%><%custom_type->inputext%><%fornotlast(";")%><%endfor%>"
<%foreach(custom_type->input_files)%>
+<%if(custom_type->input_file->output_files)%>
# Begin Source File
SOURCE=.\<%custom_type->input_file%>
@@ -253,6 +254,7 @@ BuildCmds= \
!ENDIF
# End Source File
+<%endif%>
<%endfor%>
# End Group
<%endfor%>
diff --git a/bin/MakeProjectCreator/templates/vc7.mpd b/bin/MakeProjectCreator/templates/vc7.mpd
index 33c75ed0018..03228b1a1b6 100644
--- a/bin/MakeProjectCreator/templates/vc7.mpd
+++ b/bin/MakeProjectCreator/templates/vc7.mpd
@@ -181,6 +181,7 @@
Name="<%custom_type%>"
Filter="<%foreach(custom_type->inputexts)%><%custom_type->inputext%><%fornotlast(";")%><%endfor%>">
<%foreach(custom_type->input_files)%>
+<%if(custom_type->input_file->output_files)%>
<File
RelativePath=".\<%custom_type->input_file%>">
<%foreach(configurations)%>
@@ -194,6 +195,7 @@
</FileConfiguration>
<%endfor%>
</File>
+<%endif%>
<%endfor%>
</Filter>
<%endfor%>