X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCmain.c;h=baed73f45a9296a14cdd84d08e17e2feaf59bdb2;hb=94e8ba7712cf282de18bd0c9e2213501fa189c79;hp=60af6f82205f7b04086945b0d1a7aaaaadbc9e60;hpb=9a382ea007dd372b41f444337bedfacba4c782aa;p=fw%2Fsdcc diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 60af6f82..baed73f4 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -79,8 +79,8 @@ int ds390_jammed = 0; #endif // Globally accessible scratch buffer for file names. -char scratchFileName[FILENAME_MAX]; -char buffer[FILENAME_MAX]; +char scratchFileName[PATH_MAX]; +char buffer[PATH_MAX]; // In MSC VC6 default search path for exe's to path for this @@ -146,7 +146,7 @@ optionsTable[] = { { 'M', NULL, NULL, "Preprocessor option" }, { 'V', NULL, &verboseExec, "Execute verbosely. Show sub commands as they are run" }, { 'S', NULL, &noAssemble, "Compile only; do not assemble or link" }, - { 'W', NULL, NULL, "Pass through options to the assembler (a) or linker (l)" }, + { 'W', NULL, NULL, "Pass through options to the pre-processor (p), assembler (a) or linker (l)" }, { 'L', NULL, NULL, "Add the next field to the library search path" }, { 'l', NULL, NULL, "Include the given library in the link" }, { 0, OPTION_LARGE_MODEL, NULL, "external data space is used" }, @@ -171,6 +171,7 @@ optionsTable[] = { { 0, "--dumpliverange", &options.dump_range, NULL }, { 0, "--dumpregpack", &options.dump_pack, NULL }, { 0, "--dumpregassign", &options.dump_rassgn, NULL }, + { 0, "--dumptree", &options.dump_tree, "dump front-end AST before generating iCode" }, { 0, OPTION_DUMP_ALL, NULL, "Dump the internal structure at all stages" }, { 0, OPTION_XRAM_LOC, NULL, " External Ram start location" }, { 0, OPTION_IRAM_SIZE, NULL, " Internal Ram size" }, @@ -203,7 +204,9 @@ optionsTable[] = { { 0, "--verbose", &options.verbose, "Trace calls to the preprocessor, assembler, and linker" }, { 0, OPTION_LESS_PEDANTIC, NULL, "Disable some of the more pedantic warnings" }, { 0, OPTION_SHORT_IS_8BITS, NULL, "Make short 8bits (for old times sake)" }, - { 0, "--profile", &options.profile, "On supported ports, generate extra profiling information" } + { 0, "--profile", &options.profile, "On supported ports, generate extra profiling information" }, + { 0, "--fommit-frame-pointer", &options.ommitFramePtr, "Leave out the frame pointer." }, + { 0, "--use-accelerator", &options.useAccelerator,"generate code for DS390 Arithmetic Accelerator"} }; /** Table of all unsupported options and help text to display when one @@ -933,23 +936,25 @@ parseCmdLine (int argc, char **argv) break; case 'W': + /* pre-processer options */ + if (argv[i][2] == 'p') + { + parseWithComma ((char **)preArgv, getStringArg("-Wp", argv, &i, argc)); + } /* linker options */ - if (argv[i][2] == 'l') - { - parseWithComma(linkOptions, getStringArg("-Wl", argv, &i, argc)); - } - else + else if (argv[i][2] == 'l') { - /* assembler options */ - if (argv[i][2] == 'a') - { - parseWithComma ((char **) asmOptions, getStringArg("-Wa", argv, &i, argc)); - } - else - { - werror (W_UNKNOWN_OPTION, argv[i]); - } + parseWithComma(linkOptions, getStringArg("-Wl", argv, &i, argc)); } + /* assembler options */ + else if (argv[i][2] == 'a') + { + parseWithComma ((char **) asmOptions, getStringArg("-Wa", argv, &i, argc)); + } + else + { + werror (W_UNKNOWN_OPTION, argv[i]); + } break; case 'v': @@ -1130,7 +1135,7 @@ linkEdit (char **envp) break; } } - fprintf (lnkfile, "-k %s/%s\n", SDCC_LIB_DIR /*STD_LIB_PATH */ , c); + mfprintf (lnkfile, getRuntimeVariables(), "-k {libdir}{sep}%s\n", c); /* standard library files */ /* if (strcmp (port->target, "ds390") == 0) */ @@ -1163,7 +1168,9 @@ linkEdit (char **envp) if (port->linker.cmd) { - buildCmdLine (buffer, port->linker.cmd, srcFileName, NULL, NULL, NULL); + char buffer2[PATH_MAX]; + buildCmdLine (buffer2, port->linker.cmd, srcFileName, NULL, NULL, NULL); + buildCmdLine2 (buffer, buffer2); } else { @@ -1448,10 +1455,11 @@ initValues (void) { populateMainValues (_baseValues); setMainValue ("port", port->target); - setMainValue ("fullsrcfilename", fullSrcFileName); - setMainValue ("srcfilename", srcFileName); setMainValue ("objext", port->linker.rel_ext); setMainValue ("asmext", port->assembler.file_ext); + + setMainValue ("fullsrcfilename", fullSrcFileName ? fullSrcFileName : "fullsrcfilename"); + setMainValue ("srcfilename", srcFileName ? srcFileName : "srcfilename"); } /* @@ -1504,11 +1512,11 @@ main (int argc, char **argv, char **envp) exit (0); } + initValues (); + _discoverPaths (argv[0]); + if (srcFileName) { - initValues (); - _discoverPaths (argv[0]); - preProcess (envp); initMem ();