diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2003-07-28 17:51:27 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2003-07-28 17:51:27 +0000 |
commit | bf60165615c9cc5271140508eaddc231431b4f48 (patch) | |
tree | bf0a9d2d01fa6df1995fb98abcc32ce279462d62 | |
parent | 249019ac5183f4fd2dee246f1971df115f617445 (diff) | |
download | MPC-bf60165615c9cc5271140508eaddc231431b4f48.tar.gz |
ChangeLogTag: Mon Jul 28 12:49:23 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | modules/AutomakeProjectCreator.pm | 104 | ||||
-rw-r--r-- | modules/AutomakeWorkspaceCreator.pm | 76 | ||||
-rw-r--r-- | modules/TemplateParser.pm | 30 | ||||
-rw-r--r-- | templates/automake.mpd | 120 |
4 files changed, 330 insertions, 0 deletions
diff --git a/modules/AutomakeProjectCreator.pm b/modules/AutomakeProjectCreator.pm new file mode 100644 index 00000000..a0c95fa4 --- /dev/null +++ b/modules/AutomakeProjectCreator.pm @@ -0,0 +1,104 @@ +package AutomakeProjectCreator; + +# ************************************************************ +# Description : A Automake Project Creator +# Author : Chad Elliott +# Create Date : 2/26/2003 +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; +use File::Basename; + +use ProjectCreator; + +use vars qw(@ISA); +@ISA = qw(ProjectCreator); + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub sort_files { + #my($self) = shift; + return 0; +} + + +sub convert_slashes { + #my($self) = shift; + return 0; +} + + +sub fill_value { + my($self) = shift; + my($name) = shift; + my($value) = undef; + + if ($name eq 'vpath') { + my(%vpath) = (); + my($names) = $self->{'source_files'}; + foreach my $name (keys %$names) { + my($comps) = $$names{$name}; + foreach my $key (sort keys %$comps) { + foreach my $item (@{$$comps{$key}}) { + my($dname) = dirname($item); + if ($dname ne '.' && $dname !~ /^\.\.\//) { + $vpath{$dname} = 1; + } + } + } + } + my($str) = join(':', keys %vpath); + if ($str ne '') { + $value = 'VPATH = .:' . $str . $self->crlf(); + } + } + elsif ($name eq 'tao') { + my($incs) = $self->get_assignment('includes'); + my($libs) = $self->get_assignment('libpaths'); + if ((defined $incs && $incs =~ /tao/i) || + (defined $libs && $libs =~ /tao/i)) { + $value = 1; + } + } + + return $value; +} + + +sub project_file_name { + my($self) = shift; + my($name) = shift; + + if (!defined $name) { + $name = $self->project_name(); + } + + return 'Makefile' . ($name eq '' ? '' : ".$name") . '.am'; +} + + +sub get_dll_exe_template_input_file { + #my($self) = shift; + return 'automakeexe'; +} + + +sub get_dll_template_input_file { + #my($self) = shift; + return 'automakedll'; +} + + +sub get_template { + #my($self) = shift; + return 'automake'; +} + + +1; diff --git a/modules/AutomakeWorkspaceCreator.pm b/modules/AutomakeWorkspaceCreator.pm new file mode 100644 index 00000000..f5571395 --- /dev/null +++ b/modules/AutomakeWorkspaceCreator.pm @@ -0,0 +1,76 @@ +package AutomakeWorkspaceCreator; + +# ************************************************************ +# Description : A Automake Workspace (Makefile) creator +# Author : Chad Elliott +# Create Date : 5/13/2002 +# ************************************************************ + +# ************************************************************ +# Pragmas +# ************************************************************ + +use strict; +use File::Basename; + +use AutomakeProjectCreator; +use WorkspaceCreator; + +use vars qw(@ISA); +@ISA = qw(WorkspaceCreator); + +# ************************************************************ +# Subroutine Section +# ************************************************************ + +sub workspace_file_name { + my($self) = shift; + return $self->get_modified_workspace_name('Makefile', '.am'); +} + + +sub pre_workspace { + my($self) = shift; + my($fh) = shift; + my($crlf) = $self->crlf(); + + print $fh "##$crlf" . + "## Process this file with automake$crlf" . + "##$crlf" . + "$crlf" . + "## The number in AUTOMAKE_OPTIONS is the minimum required version automake$crlf" . + "## needed to process this file.$crlf" . + "AUTOMAKE_OPTIONS = 1.4$crlf$crlf"; +} + + +sub write_comps { + my($self) = shift; + my($fh) = shift; + my($projects) = $self->get_projects(); + my($pjs) = $self->get_project_info(); + my(@list) = $self->sort_dependencies($projects, $pjs); + my($crlf) = $self->crlf(); + my(%unique) = (); + my(@dirs) = (); + + ## Get a unique list of directories while + ## preserving the order of the original @list + foreach my $dep (@list) { + my($dir) = dirname($dep); + if (!defined $unique{$dir}) { + $unique{$dir} = 1; + unshift(@dirs, $dir); + } + } + + ## Print out the subdirectories + print $fh 'SUBDIRS ='; + foreach my $dir (@dirs) { + print $fh " \\$crlf $dir"; + } + print $fh $crlf; +} + + +1; diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm index 94141157..9922045f 100644 --- a/modules/TemplateParser.pm +++ b/modules/TemplateParser.pm @@ -37,6 +37,8 @@ my(%keywords) = ('if' => 1, 'comment' => 1, 'flag_overrides' => 1, 'marker' => 1, + 'uc' => 1, + 'lc' => 1, ); # ************************************************************ @@ -614,6 +616,28 @@ sub handle_special { } +sub handle_uc { + my($self) = shift; + my($name) = shift; + + if (!$self->{'if_skip'}) { + my($val) = uc($self->get_value_with_default($name)); + $self->append_current($val); + } +} + + +sub handle_lc { + my($self) = shift; + my($name) = shift; + + if (!$self->{'if_skip'}) { + my($val) = lc($self->get_value_with_default($name)); + $self->append_current($val); + } +} + + sub handle_noextension { my($self) = shift; my($name) = shift; @@ -771,6 +795,12 @@ sub process_name { elsif ($name eq 'marker') { $self->handle_marker($val); } + elsif ($name eq 'uc') { + $self->handle_uc($val); + } + elsif ($name eq 'lc') { + $self->handle_lc($val); + } elsif ($name eq 'noextension') { $self->handle_noextension($val); } diff --git a/templates/automake.mpd b/templates/automake.mpd new file mode 100644 index 00000000..c020bed7 --- /dev/null +++ b/templates/automake.mpd @@ -0,0 +1,120 @@ +## +## Automake Template +## + +## The number in AUTOMAKE_OPTIONS is the minimum required version automake +## needed to process this file. +AUTOMAKE_OPTIONS = 1.4 + +<%if(idl_files)%> +<%if(idlflags)%> +TAO_IDLFLAGS = <%idlflags%> +<%endif%> +<%endif%> +<%if(includes)%> +INCLUDES =<%foreach(includes)%> -I<%include%><%endfor%> +<%endif%> + +<%if(exename)%> +bin_PROGRAMS = <%exename%> + +<%exename%>_SOURCES = \ +<%foreach(source_files)%> + <%source_file%><%fornotlast(" \\")%> +<%endfor%> +<%if(header_files)%> + +noinst_HEADERS = \ +<%foreach(header_files)%> + <%header_file%><%fornotlast(" \\")%> +<%endfor%> +<%endif%> +<%else%> +<%if(grouped_source_files)%> +<%foreach(grouped_source_files)%> +lib<%sharedname%>_<%uc(grouped_source_file)%>_la_SOURCES = \ +<%foreach(grouped_source_file->files)%> + <%grouped_source_file->file%><%fornotlast(" \\")%> +<%endfor%> + +<%endfor%> +<%foreach(grouped_source_files)%> +if BUILD_<%uc(grouped_source_file)%>_FILES +LIB<%sharedname%>_<%uc(grouped_source_file)%> = lib<%sharedname%>_<%grouped_source_file%>.la +else +LIB<%sharedname%>_<%uc(grouped_source_file)%> = +endif + +<%endfor%> + +lib_LTLIBRARIES = \ + $(LIB<%sharedname%>) \ +<%foreach(grouped_source_files)%> + $(LIB<%sharedname%>_<%uc(grouped_source_file)%>)<%fornotlast(" \\")%> +<%endfor%> + +lib<%sharedname%>_la_SOURCES = \ +<%foreach(grouped_source_files)%> + $(lib<%sharedname%>_<%uc(grouped_source_file)%>_la_SOURCES)<%fornotlast(" \\")%> +<%endfor%> + +<%foreach(grouped_source_files)%> +lib<%sharedname%>_<%uc(grouped_source_file)%>_la_SOURCES = \ +<%foreach(grouped_source_file->files)%> + <%grouped_source_file->file%><%fornotlast(" \\")%> +<%endfor%> + +<%endfor%> +lib<%sharedname%>_la_LDFLAGS = $(X_LIBS) \ + -version-info <%if(tao)%>@TAO_CURRENT@:@TAO_REVISION@:@TAO_AGE@<%else%>@ACE_CURRENT@:@ACE_REVISION@:@ACE_AGE@<%endif%> + +lib<%sharedname%>_la_LIBADD = $(X_PRE_LIBS) $(<%sharedname%>_XLIBS) $(X_EXTRA_LIBS) +<%else%> +lib_LTLIBRARIES = lib<%sharedname%>.la + +lib<%sharedname%>_la_SOURCES = \ +<%foreach(source_files)%> + <%source_file%><%fornotlast(" \\")%> +<%endfor%> +<%endif%> + +<%if(template_files)%> +TEMPLATE_FILES = \ +<%foreach(template_files)%> + <%template_file%><%fornotlast(" \\")%> +<%endfor%> + +<%endif%> +<%if(header_files)%> +HEADER_FILES = \ +<%foreach(header_files)%> + <%header_file%><%fornotlast(" \\")%> +<%endfor%> + +<%endif%> +<%if(inline_files)%> +INLINE_FILES = \ +<%foreach(inline_files)%> + <%inline_file%><%fornotlast(" \\")%> +<%endfor%> + +<%endif%> + +pkginclude_HEADERS = \ +<%if(template_files)%> + $(INLINE_FILES) \ +<%endif%> +<%if(inline_files)%> + $(INLINE_FILES) \ +<%endif%> +<%if(header_files)%> + $(HEADER_FILES) +<%endif%> +<%endif%> +<%vpath%> + +## Clean up template repositories, etc. +clean-local: + -rm -f *.bak *.rpo *.sym lib*.*_pure_* Makefile.old core + -rm -f gcctemp.c gcctemp so_locations + -rm -rf ptrepository SunWS_cache Templates.DB |