NASM 0.94
[nasm/avx512.git] / lcc / lin-aout.c
blobe3f2a5858df6368a86362b2c8331c06b3503c92f
1 /* x86 running linux and using nasm as a.out */
3 #include <string.h>
5 #ifndef LCCDIR
6 #define LCCDIR "/usr/local/lib/lcc/"
7 #endif
9 #define NASMPATH "/usr/local/bin/nasm"
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";
28 extern char *concat(char *, char *);
29 extern int access(const char *, int);
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)
39 else if (strcmp(arg, "-b") == 0 && access(bbexit, 4) == 0)
40 ld[9] = bbexit;
41 else
42 return 0;
43 return 1;