/src/org/ooc/frontend/Help.java

http://github.com/nddrylliog/ooc · Java · 97 lines · 68 code · 9 blank · 20 comment · 0 complexity · 251591b29f38db57f293088643a0eb9a MD5 · raw file

  1. package org.ooc.frontend;
  2. /**
  3. * Contain the online (rather inline) help of the ooc compiler
  4. *
  5. * @author Amos Wenger
  6. */
  7. public class Help {
  8. /**
  9. * Print a helpful help message that helps.
  10. */
  11. public static void printHelp() {
  12. System.out.println("Usage: ooc [options] files\n");
  13. System.out.println(
  14. "-v, -verbose verbose\n" +
  15. "-g, -debug compile with debug information\n" +
  16. "-noclean don't delete .c/.h files produced by\n" +
  17. " the backend\n" +
  18. "-gcc,-tcc,-icc,-clang,-onlygen choose the compiler backend (default=gcc)" +
  19. " onlygen doesn't launch any C compiler, and implies -noclean\n" +
  20. "-gc=[dynamic,static,off] link dynamically, link statically, or doesn't\n" +
  21. " link with the Boehm GC at all.\n" +
  22. "-driver=[combine,sequence] choose the driver to use. combine does all in one,\n" +
  23. " sequence does all the .c one after the other.\n" +
  24. "-sourcepath=output/path/ location of your source files\n" +
  25. "-outpath where to output the .c/.h files\n" +
  26. "-Ipath, -incpath=path where to find C headers\n" +
  27. "-Lpath, -libpath=path where to find libraries to link with\n" +
  28. "-lmylib link with library 'mylib'\n" +
  29. "-timing print how much time it took to compile\n" +
  30. "-r, -run runs the executable after compilation\n" +
  31. "+option pass 'option' to the C compiler, e.g. +-D_GNU_SOURCE, or +-O2" +
  32. "\nFor help about the backend options, run 'ooc -help-backends'"
  33. );
  34. }
  35. /**
  36. * Print a helpful help message that helps about backends.
  37. */
  38. public static void printHelpBackends() {
  39. System.out.println(
  40. "The available backends are: [none,gcc,make] and the default is gcc.\n" +
  41. "none just outputs the .c/.h files (be sure to have a main func)\n" +
  42. "gcc call the GNU C compiler with appropriate options\n" +
  43. "make generate a Makefile in the default output directory (ooc_tmp)\n" +
  44. "\nFor help about a specific backend, run 'ooc -help-gcc' for example"
  45. );
  46. }
  47. /**
  48. * Print a helpful help message that helps about gcc.
  49. */
  50. public static void printHelpGcc() {
  51. System.out.println(
  52. "gcc backend options:\n" +
  53. "-clean=[yes,no] delete (or not) temporary files. default: yes.\n" +
  54. " overriden by the global option -noclean\n" +
  55. "-verbose=[yes,no] print the gcc command lines called from the backend.\n" +
  56. " overriden by the global options -v, -verbose\n" +
  57. "-shout=[yes,no], -s prints a big fat [ OK ] at the end of the compilation\n" +
  58. " if it was successful (in green, on Linux platforms)\n" +
  59. "any other option passed to gcc\n"
  60. );
  61. }
  62. /**
  63. * Print a helpful help message that helps about make.
  64. */
  65. public static void printHelpMake() {
  66. System.out.println(
  67. "make backend options:\n" +
  68. "-cc=[gcc,icl] write a Makefile to be compatible with the said compiler\n" +
  69. "-link=libname.a link with the static library libname.a\n" +
  70. "any other option passed to the compiler\n"
  71. );
  72. }
  73. /**
  74. * Print a helpful help message that helps about none.
  75. */
  76. public static void printHelpNone() {
  77. System.out.println(
  78. "Be sure to have a main function! No .c/.h file will be outputted otherwise.\n\033[0;32;"
  79. +String.valueOf((int) (Math.random() * 6) + 31)+"m\n" +
  80. " | |\n" +
  81. " _ \\ _` | __| __| _ \\ __| _ \\ _` | _` | |\n" +
  82. " __/ ( |\\__ \\ | __/ | __/ ( | ( | _|\n" +
  83. "\\___|\\__,_|____/\\__|\\___|_| \\___|\\__, |\\__, | _)\n" +
  84. " |___/ |___/ \n\033[m" +
  85. "\nOh, one last thing: the cake is a lie. Too bad, eh.\n"
  86. );
  87. }
  88. }