comparison dmd/mars.c @ 567:aaba4f7c6d8a

Get rid of runtime path. Allow defaultlib and debuglib switches to be given multiple times.
author Christian Kamm <kamm incasoftware de>
date Tue, 02 Sep 2008 19:14:25 +0200
parents cbe08531430f
children f75b16f1e405
comparison
equal deleted inserted replaced
562:1ada9c6865df 567:aaba4f7c6d8a
221 -annotate annotate the bitcode with human readable source code\n\ 221 -annotate annotate the bitcode with human readable source code\n\
222 -dis disassemble module after compiling\n\ 222 -dis disassemble module after compiling\n\
223 -ignore ignore unsupported pragmas\n\ 223 -ignore ignore unsupported pragmas\n\
224 \n\ 224 \n\
225 Path options:\n\ 225 Path options:\n\
226 -R<path> provide path to the directory containing the runtime library\n\
227 -I<path> where to look for imports\n\ 226 -I<path> where to look for imports\n\
228 -J<path> where to look for string imports\n\ 227 -J<path> where to look for string imports\n\
229 -debuglib=name set symbolic debug library to name (currently ignored)\n\ 228 -defaultlib=name set default library for non-debug build\n\
230 -defaultlib=name set default library to name (currently ignored)\n\ 229 -debuglib=name set default library for debug build\n\
231 \n\ 230 \n\
232 Misc options:\n\ 231 Misc options:\n\
233 -v verbose\n\ 232 -v verbose\n\
234 -vv very verbose (does not include -v)\n\ 233 -vv very verbose (does not include -v)\n\
235 -quiet suppress unnecessary messages\n\ 234 -quiet suppress unnecessary messages\n\
318 global.params.noruntime = 0; 317 global.params.noruntime = 0;
319 global.params.novalidate = 0; 318 global.params.novalidate = 0;
320 global.params.optimizeLevel = -1; 319 global.params.optimizeLevel = -1;
321 global.params.runtimeImppath = 0; 320 global.params.runtimeImppath = 0;
322 global.params.useInlineAsm = 1; 321 global.params.useInlineAsm = 1;
323
324 global.params.defaultlibname = "phobos";
325 global.params.debuglibname = global.params.defaultlibname;
326 322
327 // Predefine version identifiers 323 // Predefine version identifiers
328 #if IN_LLVM 324 #if IN_LLVM
329 VersionCondition::addPredefinedGlobalIdent("LLVM"); 325 VersionCondition::addPredefinedGlobalIdent("LLVM");
330 VersionCondition::addPredefinedGlobalIdent("LLVMDC"); 326 VersionCondition::addPredefinedGlobalIdent("LLVMDC");
549 { 545 {
550 if (!global.params.fileImppath) 546 if (!global.params.fileImppath)
551 global.params.fileImppath = new Array(); 547 global.params.fileImppath = new Array();
552 global.params.fileImppath->push(p + 2); 548 global.params.fileImppath->push(p + 2);
553 } 549 }
554 else if (p[1] == 'R')
555 {
556 global.params.runtimePath = p+2;
557 }
558 else if (memcmp(p + 1, "debug", 5) == 0 && p[6] != 'l') 550 else if (memcmp(p + 1, "debug", 5) == 0 && p[6] != 'l')
559 { 551 {
560 // Parse: 552 // Parse:
561 // -debug 553 // -debug
562 // -debug=number 554 // -debug=number
633 { 625 {
634 global.params.linkswitches->push(p + 2); 626 global.params.linkswitches->push(p + 2);
635 } 627 }
636 else if (memcmp(p + 1, "defaultlib=", 11) == 0) 628 else if (memcmp(p + 1, "defaultlib=", 11) == 0)
637 { 629 {
638 global.params.defaultlibname = p + 1 + 11; 630 if(!global.params.defaultlibnames)
631 global.params.defaultlibnames = new Array();
632 global.params.defaultlibnames->push(p + 1 + 11);
639 } 633 }
640 else if (memcmp(p + 1, "debuglib=", 9) == 0) 634 else if (memcmp(p + 1, "debuglib=", 9) == 0)
641 { 635 {
642 global.params.debuglibname = p + 1 + 9; 636 if(!global.params.debuglibnames)
637 global.params.debuglibnames = new Array();
638 global.params.debuglibnames->push(p + 1 + 9);
643 } 639 }
644 else if (strcmp(p + 1, "run") == 0) 640 else if (strcmp(p + 1, "run") == 0)
645 { global.params.run = 1; 641 { global.params.run = 1;
646 global.params.runargs_length = ((i >= argcstart) ? argc : argcstart) - i - 1; 642 global.params.runargs_length = ((i >= argcstart) ? argc : argcstart) - i - 1;
647 if (global.params.runargs_length) 643 if (global.params.runargs_length)
692 if (files.dim == 0) 688 if (files.dim == 0)
693 { usage(); 689 { usage();
694 return EXIT_FAILURE; 690 return EXIT_FAILURE;
695 } 691 }
696 692
693 Array* libs;
694 if (global.params.symdebug)
695 libs = global.params.debuglibnames;
696 else
697 libs = global.params.defaultlibnames;
698
699 if (libs)
700 {
701 for (int i = 0; i < libs->dim; i++)
702 {
703 char *arg = (char *)mem.malloc(64);
704 strcpy(arg, "-l");
705 strncat(arg, (char *)libs->data[i], 64);
706 global.params.linkswitches->push(arg);
707 }
708 }
709 else
710 {
711 char *arg = (char *)mem.malloc(64);
712 strcpy(arg, "-ltango-base-llvmdc-native");
713 global.params.linkswitches->push(arg);
714 }
715
697 if (global.params.run) 716 if (global.params.run)
698 global.params.quiet = 1; 717 global.params.quiet = 1;
699 718
700 if (global.params.useUnitTests) 719 if (global.params.useUnitTests)
701 global.params.useAssert = 1; 720 global.params.useAssert = 1;