// Path: graph/DepthFirstTraversal.java
// public class DepthFirstTraversal extends Traversal {
// 
//     /** A depth-first Traversal of G, using FRINGE as the fringe. */
//     protected DepthFirstTraversal(Graph G) {
//         super(G, Collections.asLifoQueue(new ArrayDeque<Integer>()));
//     }
// 
//     @Override
//     protected boolean visit(int v) {
//         return super.visit(v);
//     }
// 
//     @Override
//     protected boolean postVisit(int v) {
//         return super.postVisit(v);
//     }
// 
//     @Override
//     protected boolean shouldPostVisit(int v) {
//         return true;
//     }
// }
// 
// Path: make/Main.java
// static void error(String format, Object... args) {
//     throw new IllegalArgumentException(String.format(format, args));
// }


import graph.DepthFirstTraversal;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Set;
import java.util.Scanner;
import java.io.FileNotFoundException;
import static java.util.Arrays.asList;
import static make.Main.error;
package make;






/** Represents a makefile.
 *  @author P. N. Hilfinger
 */
class Maker {

    /** Describes Makefile lines that are ignored. */
    static final Pattern IGNORED = Pattern.compile("\\s*(#.*)?");
    /** Describes a rule header in a makefile:  TARGET: DEPENDENCIES. */
    static final Pattern HEADER =
        Pattern.compile("([^:\\s]+)\\s*:\\s*(.*?)\\s*");
    /** Describes a sequence of valid targets and whitespace. */
    static final Pattern TARGETS = Pattern.compile("[^:=#\\\\]*$");
    /** Describes an indented command line. */
    static final Pattern COMMAND = Pattern.compile("(\\s+.*)");
    /** Describes the separator on dependencies lines. */
    static final Pattern SPACES = Pattern.compile("\\p{Blank}+");

    /** Read and store the ages of existing targets from the
     *  file named FILEINFONAME. */
    void readFileAges(String fileInfoName) {
        String name;
        name = "<unknown>";
        int sucTime = 10;
        try {
            Scanner inp = new Scanner(new FileReader(fileInfoName));
            _currentTime = inp.nextInt();
            while (inp.hasNext()) {
                String dest = inp.next();
                boolean firstCond = TARGETS.matcher(dest).matches();
                if (!firstCond) {
// Path: graph/DepthFirstTraversal.java
// public class DepthFirstTraversal extends Traversal {
// 
//     /** A depth-first Traversal of G, using FRINGE as the fringe. */
//     protected DepthFirstTraversal(Graph G) {
//         super(G, Collections.asLifoQueue(new ArrayDeque<Integer>()));
//     }
// 
//     @Override
//     protected boolean visit(int v) {
//         return super.visit(v);
//     }
// 
//     @Override
//     protected boolean postVisit(int v) {
//         return super.postVisit(v);
//     }
// 
//     @Override
//     protected boolean shouldPostVisit(int v) {
//         return true;
//     }
// }
// 
// Path: make/Main.java
// static void error(String format, Object... args) {
//     throw new IllegalArgumentException(String.format(format, args));
// }


// Path: make/Maker.java
import graph.DepthFirstTraversal;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Set;
import java.util.Scanner;
import java.io.FileNotFoundException;
import static java.util.Arrays.asList;
import static make.Main.error;

package make;






/** Represents a makefile.
 *  @author P. N. Hilfinger
 */
class Maker {

    /** Describes Makefile lines that are ignored. */
    static final Pattern IGNORED = Pattern.compile("\\s*(#.*)?");
    /** Describes a rule header in a makefile:  TARGET: DEPENDENCIES. */
    static final Pattern HEADER =
        Pattern.compile("([^:\\s]+)\\s*:\\s*(.*?)\\s*");
    /** Describes a sequence of valid targets and whitespace. */
    static final Pattern TARGETS = Pattern.compile("[^:=#\\\\]*$");
    /** Describes an indented command line. */
    static final Pattern COMMAND = Pattern.compile("(\\s+.*)");
    /** Describes the separator on dependencies lines. */
    static final Pattern SPACES = Pattern.compile("\\p{Blank}+");

    /** Read and store the ages of existing targets from the
     *  file named FILEINFONAME. */
    void readFileAges(String fileInfoName) {
        String name;
        name = "<unknown>";
        int sucTime = 10;
        try {
            Scanner inp = new Scanner(new FileReader(fileInfoName));
            _currentTime = inp.nextInt();
            while (inp.hasNext()) {
                String dest = inp.next();
                boolean firstCond = TARGETS.matcher(dest).matches();
                if (!firstCond) {
                    error("Illegal Target: '%s'", dest);