Advertisement
Guest User

Add -cflags switch for DMD.

a guest
Feb 5th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. diff --git a/src/link.c b/src/link.c
  2. index 5d41fb0..a538dda 100644
  3. --- a/src/link.c
  4. +++ b/src/link.c
  5. @@ -340,6 +340,11 @@ int runLINK()
  6. argv.push(p);
  7. }
  8.  
  9. + for (size_t i = 0; i < global.params.ccswitches->dim; i++)
  10. + { char *p = global.params.ccswitches->tdata()[i];
  11. + argv.push(p);
  12. + }
  13. +
  14. /* Add each library, prefixing it with "-l".
  15. * The order of libraries passed is:
  16. * 1. any libraries passed with -L command line switch
  17. diff --git a/src/mars.c b/src/mars.c
  18. index d680124..da73663 100644
  19. --- a/src/mars.c
  20. +++ b/src/mars.c
  21. @@ -278,8 +278,11 @@ Usage:\n\
  22. files.d D source files\n\
  23. @cmdfile read arguments from cmdfile\n\
  24. -c do not link\n\
  25. - -cov do code coverage analysis\n\
  26. - -D generate documentation\n\
  27. + -cov do code coverage analysis\n"
  28. +#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun&&__SVR4
  29. +" -cflag=ccflag pass ccflag to the C compiler/linker driver\n"
  30. +#endif
  31. +" -D generate documentation\n\
  32. -Dddocdir write documentation file to docdir directory\n\
  33. -Dffilename write documentation file to filename\n\
  34. -d allow deprecated features\n\
  35. @@ -398,6 +401,7 @@ int main(int argc, char *argv[])
  36. global.params.quiet = 1;
  37.  
  38. global.params.linkswitches = new Strings();
  39. + global.params.ccswitches = new Strings();
  40. global.params.libfiles = new Strings();
  41. global.params.objfiles = new Strings();
  42. global.params.ddocfiles = new Strings();
  43. @@ -733,6 +737,12 @@ int main(int argc, char *argv[])
  44. {
  45. global.params.linkswitches->push(p + 2);
  46. }
  47. +#if linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun&&__SVR4
  48. + else if (memcmp(p + 1, "cflag=", 6) == 0)
  49. + {
  50. + global.params.ccswitches->push(p + 1 + 6);
  51. + }
  52. +#endif
  53. else if (memcmp(p + 1, "defaultlib=", 11) == 0)
  54. {
  55. global.params.defaultlibname = p + 1 + 11;
  56. diff --git a/src/mars.h b/src/mars.h
  57. index 3b44269..66409c9 100644
  58. --- a/src/mars.h
  59. +++ b/src/mars.h
  60. @@ -230,6 +230,7 @@ struct Param
  61. // Linker stuff
  62. Strings *objfiles;
  63. Strings *linkswitches;
  64. + Strings *ccswitches;
  65. Strings *libfiles;
  66. char *deffile;
  67. char *resfile;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement