diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-01 22:09:15 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-01 22:09:15 +0000 |
commit | ca1f5fcecdda1f33668825d35fdddcf371ba3bdf (patch) | |
tree | 0d2f37a7f9d513425c1795513ef34dda1629fd3d /code/tools | |
parent | a6d8e02bc4e17a5b68d3d2f2287f6d7015bccc4d (diff) | |
download | ioquake3-aero-ca1f5fcecdda1f33668825d35fdddcf371ba3bdf.tar.gz ioquake3-aero-ca1f5fcecdda1f33668825d35fdddcf371ba3bdf.zip |
* Split off q_platform.h from q_shared.h
* Removed lcc PATH hack and replaced with something slightly less hacky
* Removed all platform specific hostfiles from lcc and replaced with bytecode.c
(from ankon)
* Turned lcc option "-S" on permanently
* Improved q3cpp so that it recursively adds include dirs to its list
git-svn-id: svn://svn.icculus.org/quake3/trunk@209 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools')
-rw-r--r-- | code/tools/lcc/cpp/cpp.h | 3 | ||||
-rw-r--r-- | code/tools/lcc/cpp/include.c | 27 | ||||
-rw-r--r-- | code/tools/lcc/cpp/unix.c | 28 | ||||
-rw-r--r-- | code/tools/lcc/etc/bytecode.c | 66 | ||||
-rw-r--r-- | code/tools/lcc/etc/gcc-solaris.c | 78 | ||||
-rw-r--r-- | code/tools/lcc/etc/irix.c | 64 | ||||
-rw-r--r-- | code/tools/lcc/etc/lcc.c | 56 | ||||
-rw-r--r-- | code/tools/lcc/etc/linux.c | 78 | ||||
-rw-r--r-- | code/tools/lcc/etc/osf.c | 53 | ||||
-rw-r--r-- | code/tools/lcc/etc/solaris.c | 50 | ||||
-rw-r--r-- | code/tools/lcc/etc/win32.c | 43 | ||||
-rw-r--r-- | code/tools/lcc/makefile | 4 |
12 files changed, 122 insertions, 428 deletions
diff --git a/code/tools/lcc/cpp/cpp.h b/code/tools/lcc/cpp/cpp.h index 203ab74..ae855c9 100644 --- a/code/tools/lcc/cpp/cpp.h +++ b/code/tools/lcc/cpp/cpp.h @@ -108,6 +108,7 @@ void control(Tokenrow *); void dodefine(Tokenrow *); void doadefine(Tokenrow *, int); void doinclude(Tokenrow *); +void appendDirToIncludeList( char *dir ); void doif(Tokenrow *, enum kwtype); void expand(Tokenrow *, Nlist *); void builtin(Tokenrow *, int); @@ -140,6 +141,8 @@ void iniths(void); void setobjname(char *); #define rowlen(tokrow) ((tokrow)->lp - (tokrow)->bp) +char *basepath( char *fname ); + extern char *outp; extern Token nltoken; extern Source *cursource; diff --git a/code/tools/lcc/cpp/include.c b/code/tools/lcc/cpp/include.c index b3757e8..71bd90c 100644 --- a/code/tools/lcc/cpp/include.c +++ b/code/tools/lcc/cpp/include.c @@ -1,3 +1,4 @@ +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "cpp.h" @@ -6,6 +7,29 @@ Includelist includelist[NINCLUDE]; extern char *objname; +void appendDirToIncludeList( char *dir ) +{ + int i; + + //avoid adding it more than once + for (i=NINCLUDE-2; i>=0; i--) { + if (includelist[i].file && + !strcmp (includelist[i].file, dir)) { + return; + } + } + + for (i=NINCLUDE-2; i>=0; i--) { + if (includelist[i].file==NULL) { + includelist[i].always = 1; + includelist[i].file = dir; + break; + } + } + if (i<0) + error(FATAL, "Too many -I directives"); +} + void doinclude(Tokenrow *trp) { @@ -44,6 +68,9 @@ doinclude(Tokenrow *trp) if (trp->tp < trp->lp || len==0) goto syntax; fname[len] = '\0'; + + appendDirToIncludeList( basepath( fname ) ); + if (fname[0]=='/') { fd = open(fname, 0); strcpy(iname, fname); diff --git a/code/tools/lcc/cpp/unix.c b/code/tools/lcc/cpp/unix.c index 749736c..f58b51e 100644 --- a/code/tools/lcc/cpp/unix.c +++ b/code/tools/lcc/cpp/unix.c @@ -29,15 +29,7 @@ setup(int argc, char **argv) includelist[i].deleted = 1; break; case 'I': - for (i=NINCLUDE-2; i>=0; i--) { - if (includelist[i].file==NULL) { - includelist[i].always = 1; - includelist[i].file = optarg; - break; - } - } - if (i<0) - error(FATAL, "Too many -I directives"); + appendDirToIncludeList( optarg ); break; case 'D': case 'U': @@ -66,11 +58,7 @@ setup(int argc, char **argv) fp = "<stdin>"; fd = 0; if (optind<argc) { - if ((fp = strrchr(argv[optind], '/')) != NULL) { - int len = fp - argv[optind]; - dp = (char*)newstring((uchar*)argv[optind], len+1, 0); - dp[len] = '\0'; - } + dp = basepath( argv[optind] ); fp = (char*)newstring((uchar*)argv[optind], strlen(argv[optind]), 0); if ((fd = open(fp, 0)) <= 0) error(FATAL, "Can't open input file %s", fp); @@ -89,6 +77,18 @@ setup(int argc, char **argv) } +char *basepath( char *fname ) +{ + char *dp = "."; + char *p; + if ((p = strrchr(fname, '/')) != NULL) { + int dlen = p - fname; + dp = (char*)newstring((uchar*)fname, dlen+1, 0); + dp[dlen] = '\0'; + } + + return dp; +} /* memmove is defined here because some vendors don't provide it at all and others do a terrible job (like calling malloc) */ diff --git a/code/tools/lcc/etc/bytecode.c b/code/tools/lcc/etc/bytecode.c new file mode 100644 index 0000000..fe4178f --- /dev/null +++ b/code/tools/lcc/etc/bytecode.c @@ -0,0 +1,66 @@ +/* quake3 bytecode target */ + +#include <string.h> +#include <stdio.h> +#include "../../../qcommon/q_platform.h" + +#ifdef _WIN32 +#define BINEXT ".exe" +#else +#define BINEXT "" +#endif + +char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 }; +char inputs[256] = ""; +char *cpp[] = { "q3cpp" BINEXT, + "-D__STDC__=1", "-D__STRICT_ANSI__", "-D__signed__=signed", "-DQ3_VM", + "$1", "$2", "$3", 0 }; +char *include[] = { 0 }; +char *com[] = { "q3rcc" BINEXT, "-target=bytecode", "$1", "$2", "$3", 0 }; +char *ld[] = { 0 }; +char *as[] = { 0 }; + +extern char *concat(char *, char *); + +/* +=============== +UpdatePaths + +Updates the paths to q3cpp and q3rcc based on +the directory that contains q3lcc +=============== +*/ +void UpdatePaths( const char *lccBinary ) +{ + char basepath[ 1024 ]; + char *p; + + strncpy( basepath, lccBinary, 1024 ); + p = strrchr( basepath, PATH_SEP ); + + if( p ) + { + *( p + 1 ) = '\0'; + + cpp[ 0 ] = concat( basepath, "q3cpp" BINEXT ); + com[ 0 ] = concat( basepath, "q3rcc" BINEXT ); + } +} + +int option(char *arg) { + if (strncmp(arg, "-lccdir=", 8) == 0) { + cpp[0] = concat(&arg[8], "/q3cpp" BINEXT); + include[0] = concat("-I", concat(&arg[8], "/include")); + com[0] = concat(&arg[8], "/q3rcc" BINEXT); + } else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) { + fprintf( stderr, "no profiling supported, %s ignored.\n", arg); + } else if (strcmp(arg, "-b") == 0) + ; + else if (strcmp(arg, "-g") == 0) + fprintf( stderr, "no debugging supported, %s ignored.\n", arg); + else if (strncmp(arg, "-ld=", 4) == 0 || strcmp(arg, "-static") == 0) { + fprintf( stderr, "no linking supported, %s ignored.\n", arg); + } else + return 0; + return 1; +} diff --git a/code/tools/lcc/etc/gcc-solaris.c b/code/tools/lcc/etc/gcc-solaris.c deleted file mode 100644 index d7effde..0000000 --- a/code/tools/lcc/etc/gcc-solaris.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Solaris with GNU Compilers */ - -#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 "" -//#define LCCDIR "/usr/local/lib/lcc/" -#endif - -#ifdef _WIN32 -#define BINEXT ".exe" -#else -#define BINEXT "" -#endif - -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, - "-U__GNUC__", "-D_POSIX_SOURCE", "-D__STDC__=1", "-D__STRICT_ANSI__", - "-Dunix", "-Di386", "-Dsun", - "-D__unix__", "-D__i386__", "-D__signed__=signed", - "$1", "$2", "$3", 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) { - cpp[0] = concat(&arg[8], "/gcc/cpp"); - include[0] = concat("-I", concat(&arg[8], "/include")); - 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[7] = "/usr/lib/gcrt1.o"; - ld[18] = "-lgmon"; - } else if (strcmp(arg, "-b") == 0) - ; - else if (strcmp(arg, "-g") == 0) - ; - 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; -} diff --git a/code/tools/lcc/etc/irix.c b/code/tools/lcc/etc/irix.c deleted file mode 100644 index 1b123e2..0000000 --- a/code/tools/lcc/etc/irix.c +++ /dev/null @@ -1,64 +0,0 @@ -/* SGI big endian MIPSes running IRIX 5.2 at CS Dept., Princeton University */ - -#include <string.h> - - -#ifndef LCCDIR -#define LCCDIR "/usr/local/lib/lcc/" -#endif - -char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 }; -char inputs[256] = ""; -char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1", - "-DLANGUAGE_C", - "-DMIPSEB", - "-DSYSTYPE_SVR4", - "-D_CFE", - "-D_LANGUAGE_C", - "-D_MIPSEB", - "-D_MIPS_FPSET=16", - "-D_MIPS_ISA=_MIPS_ISA_MIPS1", - "-D_MIPS_SIM=_MIPS_SIM_ABI32", - "-D_MIPS_SZINT=32", - "-D_MIPS_SZLONG=32", - "-D_MIPS_SZPTR=32", - "-D_SGI_SOURCE", - "-D_SVR4_SOURCE", - "-D_SYSTYPE_SVR4", - "-D__host_mips", - "-D__mips=1", - "-D__sgi", - "-D__unix", - "-Dhost_mips", - "-Dmips", - "-Dsgi", - "-Dunix", - "$1", "$2", "$3", 0 }; -char *com[] = { LCCDIR "rcc", "-target=mips/irix", "$1", "$2", "$3", "", 0 }; -char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", - "-I/usr/include", 0 }; -char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "-nocpp", "-KPIC", "$2", 0 }; -char *ld[] = { "/usr/bin/ld", "-require_dynamic_link", "_rld_new_interface", - "-elf", "-_SYSTYPE_SVR4", "-Wx,-G", "0", "-g0", "-KPIC", "-dont_warn_unused", - "-o", "$3", "/usr/lib/crt1.o", "-L/usr/local/lib", - "$1", "$2", "", "-L" LCCDIR, "-llcc", "-lc", "-lm", "/usr/lib/crtn.o", 0 -}; - -extern char *concat(char *, char *); - -int option(char *arg) { - if (strncmp(arg, "-lccdir=", 8) == 0) { - cpp[0] = concat(&arg[8], "/cpp"); - include[0] = concat("-I", concat(&arg[8], "/include")); - com[0] = concat(&arg[8], "/rcc"); - ld[17] = concat("-L", &arg[8]); - } else if (strcmp(arg, "-g") == 0) - ; - else if (strcmp(arg, "-p") == 0) - ld[12] = "/usr/lib/mcrt1.o"; - else if (strcmp(arg, "-b") == 0) - ; - else - return 0; - return 1; -} diff --git a/code/tools/lcc/etc/lcc.c b/code/tools/lcc/etc/lcc.c index ab411a8..1738c36 100644 --- a/code/tools/lcc/etc/lcc.c +++ b/code/tools/lcc/etc/lcc.c @@ -25,7 +25,7 @@ struct list { /* circular list nodes: */ static void *alloc(int); static List append(char *,List); -extern char *basepath(char *); +extern char *basename(char *); static int callsys(char *[]); extern char *concat(char *, char *); static int compile(char *, char *); @@ -57,7 +57,7 @@ extern int option(char *); static int errcnt; /* number of errors */ static int Eflag; /* -E specified */ -static int Sflag; /* -S specified */ +static int Sflag = 1; /* -S specified */ //for Q3 we always generate asm static int cflag; /* -c specified */ static int verbose; /* incremented for each -v */ static List llist[2]; /* loader files, flags */ @@ -73,49 +73,15 @@ char *tempdir = TEMPDIR; /* directory for temporary files */ static char *progname; static List lccinputs; /* list of input directories */ -/* -=============== -AddLCCDirToPath - -Append the base path of this file to the PATH so that q3lcc can find q3cpp and -q3rcc in its own directory. There are probably (much) cleaner ways of doing -this. -Tim Angus <tim@ngus.net> 05/09/05 -=============== -*/ -void AddLCCDirToPath( const char *lccBinary ) -{ - char basepath[ 1024 ]; - char path[ 4096 ]; - char *p; - - strncpy( basepath, lccBinary, 1024 ); - p = strrchr( basepath, '/' ); - if( !p ) - p = strrchr( basepath, '\\' ); - - if( p ) - { - *p = '\0'; -#ifdef _WIN32 - strncpy( path, "PATH=", 4096 ); - strncat( path, ";", 4096 ); - strncat( path, basepath, 4096 ); - _putenv( path ); -#else -/* Ugly workaround against execvp problem/limitation on Solaris 10 */ - snprintf( path, 4096, "PATH=%s:%s", basepath, getenv( "PATH" ) ); - putenv( path ); -#endif - } -} +extern void UpdatePaths( const char *lccBinary ); int main(int argc, char *argv[]) { int i, j, nf; - AddLCCDirToPath( argv[ 0 ] ); - progname = argv[0]; + + UpdatePaths( progname ); + ac = argc + 50; av = alloc(ac*sizeof(char *)); if (signal(SIGINT, SIG_IGN) != SIG_IGN) @@ -233,8 +199,8 @@ static List append(char *str, List list) { return p; } -/* basepath - return base name for name, e.g. /usr/drh/foo.c => foo */ -char *basepath(char *name) { +/* basename - return base name for name, e.g. /usr/drh/foo.c => foo */ +char *basename(char *name) { char *s, *b, *t = 0; for (b = s = name; *s; s++) @@ -437,7 +403,7 @@ static int filename(char *name, char *base) { static char *stemp, *itemp; if (base == 0) - base = basepath(name); + base = basename(name); switch (suffix(name, suffixes, 4)) { case 0: /* C source files */ compose(cpp, plist, append(name, 0), 0); @@ -719,14 +685,14 @@ static void opt(char *arg) { cflag++; return; case 'N': - if (strcmp(basepath(cpp[0]), "gcc-cpp") == 0) + if (strcmp(basename(cpp[0]), "gcc-cpp") == 0) plist = append("-nostdinc", plist); include[0] = 0; ilist = 0; return; case 'v': if (verbose++ == 0) { - if (strcmp(basepath(cpp[0]), "gcc-cpp") == 0) + if (strcmp(basename(cpp[0]), "gcc-cpp") == 0) plist = append(arg, plist); clist = append(arg, clist); fprintf(stderr, "%s %s\n", progname, rcsid); diff --git a/code/tools/lcc/etc/linux.c b/code/tools/lcc/etc/linux.c deleted file mode 100644 index f93a0ee..0000000 --- a/code/tools/lcc/etc/linux.c +++ /dev/null @@ -1,78 +0,0 @@ -/* x86s running Linux */ - -#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 "" -//#define LCCDIR "/usr/local/lib/lcc/" -#endif - -#ifdef _WIN32 -#define BINEXT ".exe" -#else -#define BINEXT "" -#endif - -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, - "-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/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/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) { - cpp[0] = concat(&arg[8], "/gcc/cpp"); - include[0] = concat("-I", concat(&arg[8], "/include")); - 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[7] = "/usr/lib/gcrt1.o"; - ld[18] = "-lgmon"; - } else if (strcmp(arg, "-b") == 0) - ; - else if (strcmp(arg, "-g") == 0) - ; - 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; -} diff --git a/code/tools/lcc/etc/osf.c b/code/tools/lcc/etc/osf.c deleted file mode 100644 index 3f1d686..0000000 --- a/code/tools/lcc/etc/osf.c +++ /dev/null @@ -1,53 +0,0 @@ -/* DEC ALPHAs running OSF/1 V3.2A (Rev. 17) at Princeton University */ - -#include <string.h> - - -#ifndef LCCDIR -#define LCCDIR "/usr/local/lib/lcc/" -#endif - -char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 }; -char inputs[256] = ""; -char *cpp[] = { - LCCDIR "cpp", "-D__STDC__=1", - "-DLANGUAGE_C", "-D__LANGUAGE_C__", - "-D_unix", "-D__unix__", "-D_osf", "-D__osf__", "-Dunix", - "-Dalpha", "-D_alpha", "-D__alpha", - "-D__SYSTYPE_BSD", "-D_SYSTYPE_BSD", - "$1", "$2", "$3", 0 }; -char *com[] = { LCCDIR "rcc", "-target=alpha/osf", "$1", "$2", "$3", "", 0 }; -char *include[] = { "-I" LCCDIR "include", "-I/usr/local/include", - "-I/usr/include", 0 }; -char *as[] = { "/bin/as", "-o", "$3", "", "$1", "-nocpp", "$2", 0 }; -char *ld[] = { "/usr/bin/ld", "-o", "$3", "/usr/lib/cmplrs/cc/crt0.o", - "$1", "$2", "", "", "-L" LCCDIR, "-llcc", "-lm", "-lc", 0 }; - -extern char *concat(char *, char *); -extern int access(const char *, int); - -int option(char *arg) { - if (strncmp(arg, "-lccdir=", 8) == 0) { - cpp[0] = concat(&arg[8], "/cpp"); - include[0] = concat("-I", concat(&arg[8], "/include")); - com[0] = concat(&arg[8], "/rcc"); - ld[8] = concat("-L", &arg[8]); - } else if (strcmp(arg, "-g4") == 0 - && access("/u/drh/lib/alpha/rcc", 4) == 0 - && access("/u/drh/book/cdb/alpha/osf/cdbld", 4) == 0) { - com[0] = "/u/drh/lib/alpha/rcc"; - com[5] = "-g4"; - ld[0] = "/u/drh/book/cdb/alpha/osf/cdbld"; - ld[1] = "-o"; - ld[2] = "$3"; - ld[3] = "$1"; - ld[4] = "$2"; - ld[5] = 0; - } else if (strcmp(arg, "-g") == 0) - return 1; - else if (strcmp(arg, "-b") == 0) - ; - else - return 0; - return 1; -} diff --git a/code/tools/lcc/etc/solaris.c b/code/tools/lcc/etc/solaris.c deleted file mode 100644 index 1cd755e..0000000 --- a/code/tools/lcc/etc/solaris.c +++ /dev/null @@ -1,50 +0,0 @@ -/* SPARCs running Solaris 2.5.1 at CS Dept., Princeton University */ - -#include <string.h> - - -#ifndef LCCDIR -#define LCCDIR "/usr/local/lib/lcc/" -#endif -#ifndef SUNDIR -#define SUNDIR "/opt/SUNWspro/SC4.2/lib/" -#endif - -char *suffixes[] = { ".c", ".i", ".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/usr/include", 0 }; -char *com[] = { LCCDIR "rcc", "-target=sparc/solaris", - "$1", "$2", "$3", 0 }; -char *as[] = { "/usr/ccs/bin/as", "-Qy", "-s", "-o", "$3", "$1", "$2", 0 }; -char *ld[] = { "/usr/ccs/bin/ld", "-o", "$3", "$1", - SUNDIR "crti.o", SUNDIR "crt1.o", - SUNDIR "values-xa.o", "$2", "", - "-Y", "P," SUNDIR ":/usr/ccs/lib:/usr/lib", "-Qy", - "-L" LCCDIR, "-llcc", "-lm", "-lc", SUNDIR "crtn.o", 0 }; - -extern char *concat(char *, char *); - -int option(char *arg) { - if (strncmp(arg, "-lccdir=", 8) == 0) { - cpp[0] = concat(&arg[8], "/cpp"); - include[0] = concat("-I", concat(&arg[8], "/include")); - ld[12] = concat("-L", &arg[8]); - com[0] = concat(&arg[8], "/rcc"); - } else if (strcmp(arg, "-g") == 0) - ; - else if (strcmp(arg, "-p") == 0) { - ld[5] = SUNDIR "mcrt1.o"; - ld[10] = "P," SUNDIR "libp:/usr/ccs/lib/libp:/usr/lib/libp:" - SUNDIR ":/usr/ccs/lib:/usr/lib"; - } else if (strcmp(arg, "-b") == 0) - ; - else if (strncmp(arg, "-ld=", 4) == 0) - ld[0] = &arg[4]; - else - return 0; - return 1; -} diff --git a/code/tools/lcc/etc/win32.c b/code/tools/lcc/etc/win32.c deleted file mode 100644 index 4b316dc..0000000 --- a/code/tools/lcc/etc/win32.c +++ /dev/null @@ -1,43 +0,0 @@ -/* x86s running MS Windows NT 4.0 */ - -#include <string.h> - - -#ifndef LCCDIR -// JDC #define LCCDIR "\\progra~1\\lcc\\4.1\\bin\\" -//#define LCCDIR "\\quake3\\source\\lcc\\bin\\" // JDC -// TTimo: q3cpp q3rcc & no hardcoded paths -#define LCCDIR "" -#endif - -char *suffixes[] = { ".c;.C", ".i;.I", ".asm;.ASM;.s;.S", ".obj;.OBJ", ".exe", 0 }; -char inputs[256] = ""; -char *cpp[] = { LCCDIR "q3cpp", "-D__STDC__=1", "-Dwin32", "-D_WIN32", "-D_M_IX86", - "$1", "$2", "$3", 0 }; -char *include[] = { "-I" LCCDIR "include", 0 }; -char *com[] = { LCCDIR "q3rcc", "-target=x86/win32", "$1", "$2", "$3", 0 }; -char *as[] = { "ml", "-nologo", "-c", "-Cp", "-coff", "-Fo$3", "$1", "$2", 0 }; -char *ld[] = { "link", "-nologo", - "-align:0x1000", "-subsystem:console", "-entry:mainCRTStartup", - "$2", "-OUT:$3", "$1", LCCDIR "liblcc.lib", "libc.lib", "kernel32.lib", 0 }; - -extern char *concat(char *, char *); -extern char *replace(const char *, int, int); - -int option(char *arg) { - if (strncmp(arg, "-lccdir=", 8) == 0) { - arg = replace(arg + 8, '/', '\\'); - if (arg[strlen(arg)-1] == '\\') - arg[strlen(arg)-1] = '\0'; - cpp[0] = concat(arg, "\\cpp.exe"); - include[0] = concat("-I", concat(arg, "\\include")); - com[0] = concat(arg, "\\rcc.exe"); - ld[8] = concat(arg, "\\liblcc.lib"); - } else if (strcmp(arg, "-b") == 0) - ; - else if (strncmp(arg, "-ld=", 4) == 0) - ld[0] = &arg[4]; - else - return 0; - return 1; -} diff --git a/code/tools/lcc/makefile b/code/tools/lcc/makefile index 10f551a..0eacaf2 100644 --- a/code/tools/lcc/makefile +++ b/code/tools/lcc/makefile @@ -1,6 +1,5 @@ # $Id: makefile 145 2001-10-17 21:53:10Z timo $ PLATFORM=$(shell uname|sed -e s/_.*//|tr A-Z a-z) -HOSTFILE=etc/linux.c TEMPDIR=/tmp A=.a O=.o @@ -27,7 +26,6 @@ BD=$(BUILDDIR)/ T=$(TSTDIR)/ ifeq ($(PLATFORM),SunOS) INSTALL=ginstall -HOSTFILE=etc/gcc-solaris.c else INSTALL=install endif @@ -148,7 +146,7 @@ $(BD)bprint$(O): etc/bprint.c; $(CC) $(LCC_CFLAGS) -c -Isrc -o $@ etc/bprint.c $(BD)q3lcc$(E): $(BD)q3lcc$(O) $(BD)host$(O); $(LD) $(LDFLAGS) -o $@ $(BD)q3lcc$(O) $(BD)host$(O) $(BD)q3lcc$(O): etc/lcc.c; $(CC) $(LCC_CFLAGS) -c -DTEMPDIR=\"$(TEMPDIR)\" -o $@ etc/lcc.c -$(BD)host$(O): $(HOSTFILE); $(CC) $(LCC_CFLAGS) -c -DSYSTEM=\"\" -o $@ $(HOSTFILE) +$(BD)host$(O): etc/bytecode.c; $(CC) $(LCC_CFLAGS) -c -DSYSTEM=\"\" -o $@ etc/bytecode.c LIBOBJS=$(BD)assert$(O) $(BD)bbexit$(O) $(BD)yynull$(O) |