diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-10-29 22:05:20 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-10-29 22:05:20 +0000 |
commit | 72dc3da821c616b97246e6b7cf5587c2e936d144 (patch) | |
tree | 0293ef990c25d79e7e461923c7a43afffdf9ae67 /code/tools/lcc | |
parent | 7c7b8ece05c0fb249a08e2da1f746f8a34a01b31 (diff) | |
download | ioquake3-aero-72dc3da821c616b97246e6b7cf5587c2e936d144.tar.gz ioquake3-aero-72dc3da821c616b97246e6b7cf5587c2e936d144.zip |
* Beginnings of Solaris support from Vincent S. Cojot
* Note this patch also splits USE_SDL into USE_SDL_VIDEO and USE_SDL_AUDIO
git-svn-id: svn://svn.icculus.org/quake3/trunk@199 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools/lcc')
-rw-r--r-- | code/tools/lcc/etc/gcc-solaris.c | 51 | ||||
-rw-r--r-- | code/tools/lcc/etc/lcc.c | 11 | ||||
-rw-r--r-- | code/tools/lcc/makefile | 12 |
3 files changed, 45 insertions, 29 deletions
diff --git a/code/tools/lcc/etc/gcc-solaris.c b/code/tools/lcc/etc/gcc-solaris.c index 24b6cd4..8a47f11 100644 --- a/code/tools/lcc/etc/gcc-solaris.c +++ b/code/tools/lcc/etc/gcc-solaris.c @@ -1,48 +1,55 @@ -/* SPARCs running Solaris 2.5.1 w/GCC tools - at CS Dept., Princeton University */ +/* Solaris 10 sparc */ #include <string.h> +/* +TTimo - 10-18-2001 +our binaries are named q3lcc q3rcc and q3cpp +removed hardcoded paths +removed __linux__ preprocessor define (confuses the preprocessor, we are doing bytecode!) +*/ + #ifndef LCCDIR -#define LCCDIR "/usr/local/lib/lcc/" +#define LCCDIR "" #endif #ifndef GCCDIR -#define GCCDIR "/usr/local/gnu/bin/" +#define GCCDIR "/usr/sfw/bin/" #endif #ifndef GCCLIB -#define GCCLIB "/usr/local/gnu/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/" +#define GCCLIB "/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/" #endif +#define BINEXT "" -char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 }; +char *suffixes[] = { ".c", ".i", ".asm", ".s", ".o", ".out", 0 }; char inputs[256] = ""; -char *cpp[] = { LCCDIR "cpp", - "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", - "$1", "$2", "$3", 0 }; -char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", - "-I" GCCLIB "include", "-I/usr/include", 0 }; -char *com[] = { LCCDIR "rcc", "-target=sparc/solaris", +char *cpp[] = { LCCDIR "q3cpp" BINEXT, + "-D__STDC__=1", "-Dsparc", "-D__sparc__", "-Dsun", "-D__sun__", "-Dunix", "-D__sun", "$1", "$2", "$3", 0 }; -char *as[] = { GCCDIR "as", "-f", "-o", "$3", "$1", "$2", 0 }; -char *ld[] = { GCCDIR "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" 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 }; extern char *concat(char *, char *); int option(char *arg) { if (strncmp(arg, "-lccdir=", 8) == 0) { - cpp[0] = concat(&arg[8], "/cpp"); + cpp[0] = concat(&arg[8], "/gcc/cpp"); include[0] = concat("-I", concat(&arg[8], "/include")); ld[10] = concat("-L", &arg[8]); 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) ; - else if (strcmp(arg, "-pg") == 0) { - ld[8] = GCCLIB "gmon.o"; - } else if (strcmp(arg, "-b") == 0) + else if (strcmp(arg, "-b") == 0) ; else return 0; diff --git a/code/tools/lcc/etc/lcc.c b/code/tools/lcc/etc/lcc.c index 01257fe..ab411a8 100644 --- a/code/tools/lcc/etc/lcc.c +++ b/code/tools/lcc/etc/lcc.c @@ -48,7 +48,9 @@ extern char *stringf(const char *, ...); extern int suffix(char *, char *[], int); extern char *tempname(char *); +#ifndef __sun extern int getpid(void); +#endif extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[]; extern int option(char *); @@ -95,15 +97,14 @@ void AddLCCDirToPath( const char *lccBinary ) if( p ) { *p = '\0'; - strncpy( path, "PATH=", 4096 ); - strncat( path, getenv( "PATH" ), 4096 ); #ifdef _WIN32 + strncpy( path, "PATH=", 4096 ); strncat( path, ";", 4096 ); strncat( path, basepath, 4096 ); _putenv( path ); #else - strncat( path, ":", 4096 ); - strncat( path, basepath, 4096 ); +/* Ugly workaround against execvp problem/limitation on Solaris 10 */ + snprintf( path, 4096, "PATH=%s:%s", basepath, getenv( "PATH" ) ); putenv( path ); #endif } @@ -252,7 +253,9 @@ char *basepath(char *name) { #include <process.h> #else #define _P_WAIT 0 +#ifndef __sun extern int fork(void); +#endif extern int wait(int *); static int _spawnvp(int mode, const char *cmdname, char *argv[]) { diff --git a/code/tools/lcc/makefile b/code/tools/lcc/makefile index 7f78156..10f551a 100644 --- a/code/tools/lcc/makefile +++ b/code/tools/lcc/makefile @@ -25,6 +25,12 @@ BUILDDIR=build TSTDIR=$(BUILDDIR)/$(TARGET)/tst BD=$(BUILDDIR)/ T=$(TSTDIR)/ +ifeq ($(PLATFORM),SunOS) + INSTALL=ginstall +HOSTFILE=etc/gcc-solaris.c +else + INSTALL=install +endif # $Id: makefile 145 2001-10-17 21:53:10Z timo $ @@ -237,9 +243,9 @@ testclean: $(RM) $(T)yacc$(E) $(T)yacc.s $(T)yacc.2 $(T)yacc.1 install:: all - install -s -m 0755 $(BD)q3lcc$(E) ../ - install -s -m 0755 $(BD)q3cpp$(E) ../ - install -s -m 0755 $(BD)q3rcc$(E) ../ + $(INSTALL) -s -m 0755 $(BD)q3lcc$(E) ../ + $(INSTALL) -s -m 0755 $(BD)q3cpp$(E) ../ + $(INSTALL) -s -m 0755 $(BD)q3rcc$(E) ../ uninstall:: -$(RM) ../q3lcc$(E) |