package make; import java.util.ArrayList; import java.util.List; /** Initial class for the 'make' program. * @author */ public final class Main { /** Entry point for the CS61B make program. ARGS may contain options * and targets: * [ -f MAKEFILE ] [ -D FILEINFO ] TARGET1 TARGET2 ... */ public static void main(String... args) { String makefileName; String fileInfoName; if (args.length == 0) { usage(); } makefileName = "Makefile"; fileInfoName = "fileinfo"; int a; for (a = 0; a < args.length; a += 1) { if (args[a].equals("-f")) { a += 1; if (a == args.length) { usage(); } else { makefileName = args[a]; } } else if (args[a].equals("-D")) { a += 1; if (a == args.length) { usage(); } else { fileInfoName = args[a]; } } else if (args[a].startsWith("-")) { usage(); } else { break; } } ArrayList targets = new ArrayList(); for (; a < args.length; a += 1) { targets.add(args[a]); } make(makefileName, fileInfoName, targets); } /** Carry out the make procedure using MAKEFILENAME as the makefile, * taking information on the current file-system state from FILEINFONAME, * and building TARGETS, or the first target in the makefile if TARGETS * is empty. */ private static void make(String makefileName, String fileInfoName, List targets) { // FILL IN } /** Print a brief usage message and exit program abnormally. */ private static void usage() { // FILL THIS IN System.exit(1); } }