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