Logo Search packages:      
Sourcecode: jmk version File versions  Download package

void edu::neu::ccs::jmk::Make::exec ( String[]  args,
PrintWriter  out 
) throws CommandFailedException [inline]

Execute the operation by running make after parsing the arguments.

Parameters:
args parameters to the operation
out place to write messages
Exceptions:
CommandFailedException if operation failed

Definition at line 398 of file Make.java.

References readAndMake(), setFile(), setJustPrinting(), setOut(), and setVerbose().

Referenced by main().

  {
    boolean useWindow = false;
    boolean useSwing = false;
    setOut(out);
    // Process the switches
    if (args.length > 0 && args[0].startsWith("-")) {
      int i = 0;
    switches:                 // Target for break when "--" found.
      for (; i < args.length; i++) {
      if (!args[i].startsWith("-")) // Not a switch
        break;          // leave for loop
      if (args[i].length() != 2) {
        out.println("Unrecognized switch: " + args[i]);
        usage();
        return;
      }
      switch (args[i].charAt(1)) {
      case 'v':
        out.println(version);
        return;
      case 'f':
        i++;
        if (i < args.length)
          setFile(new File(args[i]));
        else {
          out.println("No makefile for -f option");
          usage();
          return;
        }
        break;
      case 'd':
        setVerbose(true);
        break;
      case 'n':
        setJustPrinting(true);
        break;
      case 'w':
        useWindow = true;
        break;
      case 's':
        useSwing = true;
        break;
      case '-':
        i++;
        break switches;
      default:
        out.println("Unrecognized switch: " + args[i]);
        usage();
        return;
      }
      }
      Vector v = new Vector();      // Copy non-switch args into v
      for (; i < args.length; i++)
      v.addElement(args[i]);
      args = new String[v.size()];
      v.copyInto(args);       // then back to args
    }
    readAndMake(args, useWindow, useSwing);
  }


Generated by  Doxygen 1.6.0   Back to index