home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nasm097.zip / LCC / LIN-AOUT.C < prev    next >
C/C++ Source or Header  |  1997-10-01  |  1KB  |  45 lines

  1. /* x86 running linux and using nasm as a.out */
  2.  
  3. #include <string.h>
  4.  
  5. #ifndef LCCDIR
  6. #define LCCDIR "/usr/local/lib/lcc/"
  7. #endif
  8.  
  9. #define NASMPATH "/usr/local/bin/nasm"
  10.  
  11. char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1",
  12.     "-Di386", "-D__i386", "-D__i386__",
  13.     "-Dlinux", "-D__linux", "-D__linux__",
  14.     "-Dunix", "-D__unix", "-D__unix__",
  15.     "$1", "$2", "$3", 0 };
  16. char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include",
  17.     "-I/usr/include", 0 };
  18. char *com[] = { LCCDIR "rcc", "-target=x86/nasm",
  19.     "$1", "$2", "$3", 0 };
  20. char *as[] = { NASMPATH, "-a", "-faout", "-o", "$3", "$1", "$2", 0 };
  21. char *ld[] = { "/usr/bin/ld", "-m", "i386linux",
  22.     "-L/usr/i486-linuxaout/lib",
  23.     "-o", "$3", "$1",
  24.     "/usr/i486-linuxaout/lib/crt0.o",
  25.     "$2", "", "-lc", 0 };
  26. static char *bbexit = LCCDIR "bbexit.o";
  27.  
  28. extern char *concat(char *, char *);
  29. extern int access(const char *, int);
  30.  
  31. int option(char *arg) {
  32.     if (strncmp(arg, "-lccdir=", 8) == 0) {
  33.         cpp[0] = concat(&arg[8], "/cpp");
  34.         include[0] = concat("-I", concat(&arg[8], "/include"));
  35.         com[0] = concat(&arg[8], "/rcc");
  36.         bbexit = concat(&arg[8], "/bbexit.o");
  37.     } else if (strcmp(arg, "-g") == 0)
  38.         ;
  39.     else if (strcmp(arg, "-b") == 0 && access(bbexit, 4) == 0)
  40.         ld[9] = bbexit;
  41.     else
  42.         return 0;
  43.     return 1;
  44. }
  45.