import from svn
[unitool.git] / libtool / Main.java
blobbd926c8659e22acad9eb96188d78b2c34736198d
2 package org.de.metux.unitool.libtool;
4 import org.de.metux.unitool.db.UnitoolConf;
5 import org.de.metux.util.StrUtil;
6 import org.de.metux.propertylist.IPropertylist;
7 import org.de.metux.unitool.base.ToolConfig;
9 public class Main
11 static String tag;
12 static boolean silent = false;
14 static void exit_err(String text)
16 System.err.println(text);
17 System.exit(1);
20 static private String[] cutfirstarg(String argv[])
22 String newarg[] = new String[argv.length-1];
23 for (int x=0; x<(argv.length-1); x++)
24 newarg[x] = argv[x+1];
25 return newarg;
28 public static void main(String argv[]) throws Exception
30 if (argv.length==0)
31 exit_err("missing parameters");
33 // FIXME: should be used somewhere ?
34 if (argv[0].startsWith("--tag="))
36 tag = argv[0].substring(6);
37 main(cutfirstarg(argv));
38 return;
41 if (argv[0].equals("--preserve-dup-deps"))
43 main(cutfirstarg(argv));
44 return;
47 if (argv[0].equals("--silent"))
49 silent = true;
50 main(cutfirstarg(argv));
51 return;
54 ToolConfig config = UnitoolConf.getToolConfig();
56 // load system
57 if (argv[0].equals("--mode=link"))
58 new CmdLink(argv,config).run();
59 else if (argv[0].equals("--mode=compile"))
60 new CmdCompile(argv,config).run();
61 else if (argv[0].equals("--mode=install"))
62 new CmdInstall(argv,config).run();
63 else
64 exit_err("unsupported mode: "+argv[0]);
66 System.exit(0);
67 // return 0;