summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-03-02 23:02:23 +0000
committerdhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-03-02 23:02:23 +0000
commit77999983bfef522fc2cee7fd748d575fcefc65d1 (patch)
tree565df950238b8e3c389cf31f59211c9233fe31e0
parent16f234010747c66e54a02546643448855741ffa3 (diff)
downloadATCD-77999983bfef522fc2cee7fd748d575fcefc65d1.tar.gz
ChangeLogTag:Tue Mar 2 22:58:40 UTC 2004 Don Hinton <dhinton@dre.vanderbilt.edu>
-rw-r--r--ChangeLog10
-rw-r--r--bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm143
2 files changed, 90 insertions, 63 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f24c8070a1..64960416771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Mar 2 22:58:40 UTC 2004 Don Hinton <dhinton@dre.vanderbilt.edu>
+
+ * bin/MakeProjectCreator/modules/WorkspaceCreator.pm:
+ Rewrote the output generation to be more human readable
+ by using standard makefile techniques. Also, discovered
+ a bug in the dependencies (that was also present prior
+ to this change) since it's now easier to grok the
+ generated makefile. I'll fix it once I've checked in
+ all the other MPC changes in my queue.
+
Tue Mar 2 12:28:09 2004 Chad Elliott <elliott_c@ociweb.com>
* bin/MakeProjectCreator/templates/bmake.mpd:
diff --git a/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm b/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm
index 71f5e95df4d..3be5dda9e89 100644
--- a/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm
+++ b/bin/MakeProjectCreator/modules/GNUACEWorkspaceCreator.pm
@@ -23,8 +23,10 @@ use vars qw(@ISA);
# Data Section
# ************************************************************
-my(@targets) = ('install', 'deinstall', 'clean', 'realclean',
- 'depend', 'idl_stubs',
+my(@targets) = ('all', 'debug', 'profile', 'optimize',
+ 'install', 'deinstall', 'clean', 'realclean',
+ 'clobber', 'depend', 'rcs_info', 'idl_stubs',
+ 'reverseclean',
);
# ************************************************************
@@ -54,18 +56,20 @@ sub pre_workspace {
my($fh) = shift;
my($crlf) = $self->crlf();
- print $fh "#----------------------------------------------------------------------------$crlf" .
- "# GNU ACE Workspace$crlf" .
- "#$crlf" .
- "# \@file GNUmakefile$crlf" .
- "#$crlf" .
- "# \$Id\$$crlf" .
- "#$crlf" .
- "# This file was automatically generated by MPC. Any changes made directly to$crlf" .
- "# this file will be lost the next time it is generated.$crlf" .
- "#$crlf" .
- "#----------------------------------------------------------------------------$crlf" .
- $crlf;
+ print $fh "" .
+ "# -*- makefile -*-" . $crlf .
+ "#-------------------------------------------------------------------------" . $crlf .
+ "# GNU ACE Workspace" . $crlf .
+ "#" . $crlf .
+ "# \@file GNUmakefile" . $crlf .
+ "#" . $crlf .
+ "# \$Id\$" . $crlf .
+ "#" . $crlf .
+ "# This file was automatically generated by MPC. Any changes made " . $crlf .
+ "# directly to this file will be lost the next time it is generated." . $crlf .
+ "#" . $crlf .
+ "#-------------------------------------------------------------------------" . $crlf .
+ "MAKEFILE = GNUmakefile" . $crlf;
}
@@ -78,62 +82,75 @@ sub write_comps {
my($pjs) = $self->get_project_info();
my(@list) = $self->number_target_deps($projects, $pjs, \%targnum);
- ## Print out the info for using -k
- print $fh $crlf .
- "MAKE_OPTIONS=\$(shell echo \$(MAKEFLAGS) | sed 's/--unix *//; s/ .*//')$crlf" .
- "ifeq (\$(findstring k,\$(MAKE_OPTIONS)),k)$crlf" .
- " KEEP_GOING = 1$crlf" .
- "else$crlf" .
- " KEEP_GOING = 0$crlf" .
- "endif$crlf";
-
- ## Print out the "all" target
- print $fh $crlf . 'all:';
- foreach my $project (@list) {
- print $fh " $$pjs{$project}->[0]";
- }
+ ## Only use the list if there is more than one project
+ if ($#list > 0) {
+ my($count) = 0;
- ## Print out all other targets here
- print $fh "$crlf$crlf@targets:$crlf";
- foreach my $project (@list) {
- print $fh "\t-\@\$(MAKE) -f " . basename($project) . ' -C ' .
- dirname($project) . " \$(\@);$crlf";
- }
+ print $fh $crlf .
+ "ifeq (\$(findstring k,\$(MAKEFLAGS)),k)$crlf" .
+ " KEEP_GOING = -$crlf" .
+ "endif$crlf$crlf";
+
+ print $fh "# List of targets.$crlf";
+ print $fh "targets =";
+ foreach my $target (@targets) {
+ print $fh " \\" . $crlf . " " . $target;
+ }
+ print $fh "$crlf$crlf";
- ## Print out each target separately
- foreach my $project (@list) {
- print $fh $crlf . $$pjs{$project}->[0] . ':';
- if (defined $targnum{$project}) {
- foreach my $number (@{$targnum{$project}}) {
- print $fh " $$pjs{$list[$number]}->[0]";
- }
+ print $fh "# List of projects.$crlf";
+ print $fh "projects =";
+ foreach my $project (@list) {
+ print $fh " \\" . $crlf . " " . $project;
}
- my($cmd) = "\@\$(MAKE) -f " . basename($project) . ' -C ' . dirname($project) . $crlf;
- print $fh $crlf .
- "ifeq (\$(KEEP_GOING),1)$crlf" .
- "\t-$cmd" .
- "else$crlf" .
- "\t$cmd" .
- "endif$crlf";
- }
+ print $fh "$crlf$crlf";
+
+ print $fh "# Phony targets, these targets aren't real files.$crlf";
+ print $fh ".PHONY: \$(targets) \$(foreach ext, \$(targets), \$(addsuffix -\$(ext), \$(projects)))$crlf$crlf";
+
+ print $fh "# Default target.$crlf";
+ print $fh "all: \$(addsuffix -all, \$(projects))$crlf$crlf";
- ## Print out the reverseclean target
- {
- print $fh $crlf . 'reverseclean:' . $crlf;
-
- foreach my $project (reverse @list) {
- print $fh "\t-\@\$(MAKE) -f " . basename($project) . ' -C ' .
- dirname($project) . " realclean$crlf";
+ print $fh "" .
+ "# This is the rule for all the standard targets listed above.$crlf" .
+ "# The dependencies are formed by adding '-<target name>' to$crlf" .
+ "# each project, e.g., GNUmakefile.project-all.$crlf";
+ print $fh "\$(targets): %: \$(addsuffix -%, \$(projects))$crlf$crlf";
+
+
+ print $fh "\$(foreach ext, \$(targets), \$(addsuffix -\$(ext), \$(projects))):" . $crlf;
+ print $fh "\t\@echo \$(KEEP_GOING)\$(MAKE) -f \$(notdir \$(word 1,\$(subst -, ,\$@))) \\" . $crlf .
+ "\t -C \$(dir \$(word 1,\$(subst -, ,\$@))) \$(word 2,\$(subst -, ,\$@));" . $crlf;
+ print $fh "\t\$(KEEP_GOING)\@\$(MAKE) -f \$(notdir \$(word 1,\$(subst -, ,\$@))) \\" . $crlf .
+ "\t -C \$(dir \$(word 1,\$(subst -, ,\$@))) \$(word 2,\$(subst -, ,\$@));" . $crlf . $crlf;
+
+
+ ## Print out each of the individual targets
+ foreach my $project (@list) {
+ if (defined $targnum{$project}) {
+ print $fh "\$(foreach ext, \$(targets), \$(addsuffix -\$(ext), " .
+ $project . ")): \\" . $crlf . " " . $project . "-%:";
+ foreach my $number (@{$targnum{$project}}) {
+ print $fh ' \\' . $crlf . ' ' . $list[$number] . '-%';
+ }
+ print $fh $crlf . $crlf;
+ }
}
}
-
- ## Print out the project_name_list target
- print $fh $crlf . "project_name_list:$crlf";
- foreach my $project (sort @list) {
- print $fh "\t\@echo $$pjs{$project}->[0]$crlf";
+ else {
+ ## Otherwise, just list the call to make without a for loop
+ my($dir) = dirname($list[0]);
+ my($base) = basename($list[0]);
+ print $fh "TARGETS_NESTED = @targets$crlf" .
+ $crlf .
+ "\$(TARGETS_NESTED):$crlf" .
+ "\t\@\$(MAKE) -f $base " . ($dir ne '.' ? "-C $dir " : '') .
+ "\$(\@);$crlf$crlf" .
+ $$pjs{$list[0]}->[0] . ": all$crlf$crlf" .
+ "reverseclean:$crlf" .
+ "\t\@\$(MAKE) -f $base " . ($dir ne '.' ? "-C $dir " : '') .
+ "realclean$crlf$crlf";
}
}
-
-
1;