Exemplo n.º 1
0
  public static void main(String args[]) {
    String midictrlDir = null;
    String board = "minicommand2";

    if (args.length <= 1) {
      return;
    }
    java.util.List printList = new ArrayList();

    int i;
    for (i = 0; i < args.length; i++) {
      if (args[i].equals("--board")) {
        board = args[i + 1];
        i++;
      } else if (args[i].equals("--dir")) {
        midictrlDir = args[i + 1];
        i++;
      } else {
        break;
      }
    }

    if (midictrlDir == null) {
      midictrlDir = System.getProperty("user.dir");
    }

    String hardwarePath =
        (midictrlDir != null ? midictrlDir : System.getProperty("user.dir"))
            + File.separator
            + "hardware";
    Base.init(midictrlDir);
    Target target = null;
    Preferences.initBoards(midictrlDir);
    Preferences.set("board", board);
    try {
      target =
          new Target(
              hardwarePath + File.separator + "cores",
              Preferences.get("boards." + Preferences.get("board") + ".build.core"));
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    for (i = 0; i < args.length; i++) {
      if (args[i].equals("--print-c-flags")) {
        PrintList(Compiler.getCompilerFlags());
      } else if (args[i].equals("--print-cxx-flags")) {
        PrintList(Compiler.getCompilerFlags());
      } else if (args[i].equals("--print-ld-flags")) {
        PrintList(Compiler.getLinkerFlags());
      } else if (args[i].equals("--libraries")) {
        PrintList(Compiler.getLibraries(args[i + 1], target));
      } else if (args[i].equals("--make")) {
        System.out.print("MIDICTRL_LIBS += ");
        PrintList(Compiler.getLibraries(args[i + 1], target));
        System.out.print("CFLAGS += ");
        PrintList(Compiler.getCompilerFlags());
        System.out.print("CXXFLAGS += ");
        PrintList(Compiler.getCompilerFlags());
        System.out.print("CLDFLAGS += ");
        PrintList(Compiler.getLinkerFlags());
      }
    }
  }