head	1.8;
access;
symbols
	TIGRIS_1_1_0RC2:1.8
	TIGRIS_1_1_0RC1:1.8
	TIGRIS_1_1:1.8.0.4
	TIGRIS_1_0_8:1.8
	TIGRIS_1_0_8RC3:1.8
	TIGRIS_1_0_8RC2:1.8
	TIGRIS_1_0_8RC1:1.8
	TIGRIS_1_0_7:1.8
	TIGRIS_1_0_7RC3:1.8
	TIGRIS_1_0_7RC2:1.8
	TIGRIS_1_0_7RC1:1.8
	TIGRIS_1_0_6:1.8
	TIGRIS_1_0_6RC5:1.8
	TIGRIS_1_0_6RC4:1.8
	TIGRIS_1_0_6RC3:1.8
	TIGRIS_1_0_6RC2:1.8
	TIGRIS_1_0_6RC1:1.8
	TIGRIS_1_0_5:1.8
	TIGRIS_1_0_5RC6:1.8
	TIGRIS_1_0_5RC5:1.8
	TIGRIS_1_0_5RC4:1.8
	TIGRIS_1_0_5RC3:1.8
	TIGRIS_1_0_5RC2:1.8
	TIGRIS_1_0_5RC1:1.8
	TIGRIS_1_0_4:1.8
	TIGRIS_1_0_3:1.8
	TIGRIS_1_0_2:1.8
	TIGRIS_1_0_1:1.8
	TIGRIS_1_0:1.8.0.6
	TIGRIS_1_0_0:1.8
	TIGRIS_1_0_0_RC1:1.8.0.2
	HELM_PEER_PORT_BRANCH:1.6.0.8
	TIGRIS_0_9_2_4:1.6
	TIGRIS_0_9_2_3:1.6
	TIGRIS_0_9_2:1.6.0.6
	TIGRIS_0_9_0:1.6.0.4
	TIGRIS_0_8_4:1.6.0.2
	TIGRIS_710_FF:1.6
	TIGRIS_706:1.6
	TIGRIS_705:1.5
	TIGRIS_704:1.5
	TIGRIS_703:1.5
	TIGRIS_702:1.5
	TIGRIS_701:1.5
	TIGRIS_SEP_13_2000:1.5.0.2
	TIGRIS_BASELINE:1.5;
locks; strict;
comment	@# @;


1.8
date	2001.03.07.21.45.31;	author dlr;	state Exp;
branches;
next	1.7;

1.7
date	2001.03.07.21.40.32;	author dlr;	state Exp;
branches;
next	1.6;

1.6
date	2000.10.26.03.19.01;	author dlr;	state Exp;
branches;
next	1.5;

1.5
date	2000.07.12.04.12.20;	author jon;	state Exp;
branches;
next	1.4;

1.4
date	2000.07.12.04.09.24;	author jon;	state Exp;
branches;
next	1.3;

1.3
date	2000.05.24.02.19.04;	author dlr;	state Exp;
branches;
next	1.2;

1.2
date	2000.05.04.23.04.49;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2000.05.03.00.44.42;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.8
log
@Changed called Makefile instead.  It did the wrong thing.
@
text
@#!/usr/bin/perl -w
#
# This UNIX -*- Perl -*- code does a recursive decent into the subdirectories 
# of where it was run and creates the appropriate package Makefiles (which 
# rely on the top-level Makefile.config).
#
# author: Daniel L. Rall <dlr@@collab.net>
# $Id: mkPkgMakefiles,v 1.7 2001/03/07 21:40:32 dlr Exp $
#

my $MAKEFILE_NAME = 'Makefile';
my $AUTOGEN_NOTE = "# This file was autogenerated by $0.\n\# Do not change " . 
    "this file directly (it may be overwritten).  Instead, modify\n\# the " . 
    "generator script itself.\n";

# Keeps track how many directories we are removed from the start dir.
my $depth = 0;

# Create the necessary Makefiles.
recurse_child_packages();
exit 0;


sub create_makefile
{
    my $cwd = shift;
    my @@srcs = glob('*.java');

    # Only bother creating the Makefile if there are Java source files.
    if (scalar(@@srcs) > 0)
    {
	# No child packages in this package.
	print "Creating $MAKEFILE_NAME in directory '$cwd'\n";

	# NOTE: There is currently no reason to save the existing Makefile, but
	# if the ocassion ever arises, this is the place to do it.

	# Write the new Makefile.
	open(MAKEFILE, ">$MAKEFILE_NAME") or 
	    die "$0: Couldn't open $MAKEFILE_NAME\n";

	# Include the Makefile config file.
	print MAKEFILE $AUTOGEN_NOTE;
	print MAKEFILE 'MAKE_DIR=';
	#print "create_makefile: depth=$depth\n";
	for (my $i = 0; $i < $depth; $i++) { print MAKEFILE '../'; }
	print MAKEFILE "\n\n";

	# Write a target for building everything.
	print MAKEFILE 'default:', "\n";
	print MAKEFILE "\t", 'cd $(MAKE_DIR)';
	print MAKEFILE '; make', "\n";

        # Write a target for installing everything.
	print MAKEFILE 'install:', "\n";
	print MAKEFILE "\t", 'cd $(MAKE_DIR)';
	print MAKEFILE '; make install', "\n";

	close(MAKEFILE) or die "$0: Couldn't close $MAKEFILE_NAME\n";
    }
}

sub recurse_child_packages
{
    # Find out what package we are in.
    my $cwd = shift;
    if (!defined($cwd))
    {
	chomp($cwd = `pwd`);
    }

    # Yes grasshopper, move into the desired directory.
    chdir $cwd;
    #print "cwd='$cwd'\n";

    # ...and what subdirectories exist.
    my @@sub_dirs = ();
    my @@possibly_dirs = `ls | grep -v CVS`;
    foreach (@@possibly_dirs)
    {
	# Filter a out regular files, keeping directories.
	chomp;
	if (-d $_) { push @@sub_dirs, $_; }
    }

    # Make that sucker.
    create_makefile($cwd);

    if (scalar(@@sub_dirs) > 0)
    {
	# Keep track of distance from start.
	$depth++;
	#print "depth='$depth'\n";
	#print @@sub_dirs;

	# Iterate subdirectories.
	foreach (@@sub_dirs)
	{
	    # Create the Makefile for this directory, then recurse each 
	    # subdirectory.
	    chomp;
	    recurse_child_packages($_);
	}

	# Done processing this package, returning to parent.
	$depth--;
	#print "depth='$depth'\n";
    }
    else
    {
	# Figure out where we are.
	if ($depth == 0)
	{
	    # At top level.  Nothing to do!
	    print "$0: No subdirectories to recurse\n";
	    exit 1;
	}
    }

    # If we aren't already at the top level directory, back up.
    if ($depth > 0)
    {
	#print "Backing up...\n";
	chdir '..';
    }
}
@


1.7
log
@Don't want to rerun Torque gratuitously.
@
text
@d8 1
a8 1
# $Id: mkPkgMakefiles,v 1.6 2000/10/26 03:19:01 dlr Exp $
d52 1
a52 1
	print MAKEFILE '; make build', "\n";
@


1.6
log
@Corrected for change to Ant.
@
text
@d8 1
a8 1
# $Id: $
d52 1
a52 1
	print MAKEFILE '; make', "\n";
@


1.5
log
@make sure to execute the all target first as a dependency for install
@
text
@d8 1
d44 1
a44 1
	print MAKEFILE 'include ';
d47 1
a47 1
	print MAKEFILE "$MAKEFILE_NAME.config\n";
d49 9
a57 9
	# Write a target for building the files in the current directory only.
	print MAKEFILE 'all:', "\n";
	print MAKEFILE "\t", '$(JAVAC) $(JFLAGS) $(JIKESFLAGS) *.java', "\n";

        # make an install: target
	print MAKEFILE 'install: all', "\n";
	print MAKEFILE "\t", "cd ";
        for (my $i = 0; $i < $depth; $i++) { print MAKEFILE '../'; }
	print MAKEFILE " ; make install";
@


1.4
log
@added an install: target to each Makefile so that you can just type make
install from anywhere and it will execute the top level make install
target. this makes my life infinitely easier. woo hoo! -jon
@
text
@d52 2
a53 1
	print MAKEFILE 'install:', "\n";
@


1.3
log
@Added a space between the Jikes and standard compiler flags.
@
text
@d52 5
@


1.2
log
@Now creates nifty Makefiles to compile only the package from which they are run (for JER).
@
text
@d50 1
a50 1
	print MAKEFILE "\t", '$(JAVAC) $(JFLAGS)$(JIKESFLAGS) *.java', "\n";
@


1.1
log
@Creates package-level Makefiles Joist, sourceXchange, etc.
@
text
@d11 3
d25 2
a26 2
    my @@src_files = glob('*.java');
    #print 'src_files=', @@src_files, "\n";
d29 1
a29 1
    if (scalar(@@src_files) > 0)
d31 5
a35 1
	# TODO: Back up any previous Makefile.
d40 6
a45 11
	print MAKEFILE "SOURCES= \\\n";
	my $i;
	for ($i = 0; $i < scalar(@@src_files); $i++)
	{
	    print MAKEFILE "\t$src_files[$i]";
	    if ($i < $#src_files) { print MAKEFILE "\\"; }
	    print MAKEFILE "\n";
	}
	print MAKEFILE "\ninclude ";
	#print "depth from create_makefile=$depth\n";
	for ($i = 0; $i < $depth; $i++) { print MAKEFILE '../'; }
d47 5
d80 1
a80 1
    create_makefile();
a109 5
	}
	else
	{
	    # No child packages in this package.
	    print "Creating $MAKEFILE_NAME in package '$cwd'\n";
@

