This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / dist-3.0at70 / mcon / pl / order.pl
1 ;# $Id: order.pl,v 3.0 1993/08/18 12:10:28 ram Exp $
2 ;#
3 ;#  Copyright (c) 1991-1993, Raphael Manfredi
4 ;#  
5 ;#  You may redistribute only under the terms of the Artistic Licence,
6 ;#  as specified in the README file that comes with the distribution.
7 ;#  You may reuse parts of this distribution only within the terms of
8 ;#  that same Artistic Licence; a copy of which may be found at the root
9 ;#  of the source tree for dist 3.0.
10 ;#
11 ;# $Log: order.pl,v $
12 ;# Revision 3.0  1993/08/18  12:10:28  ram
13 ;# Baseline for dist 3.0 netwide release.
14 ;#
15 ;# 
16 ;# The @cmdwanted array records the output of the makefile (pick commands only).
17 ;# The shell commands are executed right away.
18 ;#  @cmdwanted records the output of the make process (solving dependencies)
19 # Solve dependencies by saving the 'pick' command in @cmdwanted
20 sub solve_dependencies {
21         local(%unitseen);                       # Record already picked units (avoid duplicates)
22         print "Determining the correct order for the units...\n" unless $opt_s;
23         chdir('.MT') || die "Can't chdir to .MT: $!.\n";
24         open(MAKE, "make -n |") || die "Can't run make";
25         while (<MAKE>) {
26                 s|^\s+||;                               # Some make print tabs before command
27                 print "\t$_" if $opt_v;
28                 if (/^pick/) {
29                         ($pick,$cmd,$symbol,$unit) = split(' ');
30                         push(@cmdwanted,"$cmd $symbol $unit")
31                                 unless $unitseen{"$cmd:$unit"}++;
32                 } elsif (/^cond/) {
33                         # Ignore conditional symbol request
34                 } else {
35                         chop;
36                         system;
37                 }
38         }
39         chdir($WD) || die "Can't chdir to $WD: $!.\n";
40         close MAKE;
41 }
42