From 394cead89ea339273451bb5d5f2369a9a4dbc908 Mon Sep 17 00:00:00 2001 From: tma Date: Mon, 31 Oct 2005 16:46:05 +0000 Subject: * Further work on the Solaris port from Vincent S. Cojot git-svn-id: svn://svn.icculus.org/quake3/trunk@204 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/tools/lcc/etc/gcc-solaris.c | 73 ++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 26 deletions(-) (limited to 'code/tools') diff --git a/code/tools/lcc/etc/gcc-solaris.c b/code/tools/lcc/etc/gcc-solaris.c index 8a47f11..f0e20e9 100644 --- a/code/tools/lcc/etc/gcc-solaris.c +++ b/code/tools/lcc/etc/gcc-solaris.c @@ -1,4 +1,4 @@ -/* Solaris 10 sparc */ +/* x86s running Linux */ #include @@ -9,49 +9,70 @@ removed hardcoded paths removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!) */ - #ifndef LCCDIR #define LCCDIR "" +//#define LCCDIR "/usr/local/lib/lcc/" #endif -#ifndef GCCDIR -#define GCCDIR "/usr/sfw/bin/" -#endif -#ifndef GCCLIB -#define GCCLIB "/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/" -#endif + +#ifdef _WIN32 +#define BINEXT ".exe" +#else #define BINEXT "" +#endif -char *suffixes[] = { ".c", ".i", ".asm", ".s", ".o", ".out", 0 }; +char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 }; char inputs[256] = ""; +// TTimo experimental: do not compile with the __linux__ define, we are doing bytecode! char *cpp[] = { LCCDIR "q3cpp" BINEXT, - "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__sun", + "-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__", + "-Dunix", "-Di386", "-Dlinux", + "-D__unix__", "-D__i386__", "-D__signed__=signed", "$1", "$2", "$3", 0 }; -char *include[] = { "-I" LCCDIR "include", "-I" LCCDIR "gcc/include", - "-I" SYSTEM "include", "-I/usr/include", 0 }; -/* char *com[] = { LCCDIR "q3rcc", "-target=bytecode", "$1", "$2", "$3", 0 }; */ -char *com[] = { LCCDIR "q3rcc", "-target=sparc/solaris", "$1", "$2", "$3", 0 }; -char *as[] = { "/usr/ccs/bin/as", "-o", "$3", "$1", "$2", 0 }; -char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1", - GCCLIB "crti.o", GCCLIB "crt1.o", - GCCLIB "crtbegin.o", "$2", "", "", "-L" LCCDIR, "-llcc", - "-L" GCCLIB, "-lgcc", "-lm", "-lc", "", - GCCLIB "crtend.o", GCCLIB "crtn.o", 0 }; +char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include", + "-I" SYSTEM "include", 0 }; +char *com[] = {LCCDIR "q3rcc" BINEXT, "-target=bytecode", "$1", "$2", "$3", 0 }; +char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "$2", 0 }; +// NOTE TTimo I don't think we have any use with the native linkage +// our target is always bytecode.. +char *ld[] = { + /* 0 */ "/usr/ccs/bin/ld", "-m", "elf_i386", "-dynamic-linker", + /* 4 */ "/lib/ld-linux.so.2", "-o", "$3", + /* 7 */ "/usr/lib/crt1.o", "/usr/lib/crti.o", + /* 9 */ SYSTEM "crtbegin.o", + "$1", "$2", + /* 12 */ "-L" LCCDIR, + /* 13 */ "-llcc", + /* 14 */ "-L" LCCDIR "/gcc", "-lgcc", "-lc", "-lm", + /* 18 */ "", + /* 19 */ SYSTEM "crtend.o", "/usr/lib/crtn.o", + /* 20 */ "-L" SYSTEM, + 0 }; extern char *concat(char *, char *); int option(char *arg) { - if (strncmp(arg, "-lccdir=", 8) == 0) { + if (strncmp(arg, "-lccdir=", 8) == 0) { cpp[0] = concat(&arg[8], "/gcc/cpp"); include[0] = concat("-I", concat(&arg[8], "/include")); - ld[10] = concat("-L", &arg[8]); + include[1] = concat("-I", concat(&arg[8], "/gcc/include")); + ld[9] = concat(&arg[8], "/gcc/crtbegin.o"); + ld[12] = concat("-L", &arg[8]); + ld[14] = concat("-L", concat(&arg[8], "/gcc")); + ld[19] = concat(&arg[8], "/gcc/crtend.o"); com[0] = concat(&arg[8], "/rcc"); } else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) { - ld[8] = "-lgmon"; - } else if (strcmp(arg, "-g") == 0) + ld[7] = "/usr/lib/gcrt1.o"; + ld[18] = "-lgmon"; + } else if (strcmp(arg, "-b") == 0) ; - else if (strcmp(arg, "-b") == 0) + else if (strcmp(arg, "-g") == 0) ; - else + else if (strncmp(arg, "-ld=", 4) == 0) + ld[0] = &arg[4]; + else if (strcmp(arg, "-static") == 0) { + ld[3] = "-static"; + ld[4] = ""; + } else return 0; return 1; } -- cgit v1.2.3