1 /* quake3 bytecode target */
2 
3 #include <string.h>
4 #include <stdio.h>
5 #include "../../../qcommon/q_platform.h"
6 
7 #ifdef _WIN32
8 #define BINEXT ".exe"
9 #else
10 #define BINEXT ""
11 #endif
12 
13 char *suffixes[] = { ".c", ".i", ".asm", ".o", ".out", 0 };
14 char inputs[256] = "";
15 char *cpp[] = { "q3cpp" BINEXT,
16 	"-D__STDC__=1", "-D__STRICT_ANSI__", "-D__signed__=signed", "-DQ3_VM",
17 	"$1", "$2", "$3", 0 };
18 char *include[] = { 0 };
19 char *com[] = { "q3rcc" BINEXT, "-target=bytecode", "$1", "$2", "$3", 0 };
20 char *ld[] = { 0 };
21 char *as[] = { 0 };
22 
23 extern char *concat(char *, char *);
24 
25 /*
26 ===============
27 UpdatePaths
28 
29 Updates the paths to q3cpp and q3rcc based on
30 the directory that contains q3lcc
31 ===============
32 */
UpdatePaths(const char * lccBinary)33 void UpdatePaths( const char *lccBinary )
34 {
35 	char basepath[ 1024 ];
36 	char *p;
37 
38 	strncpy( basepath, lccBinary, 1024 );
39 	p = strrchr( basepath, PATH_SEP );
40 
41 	if( p )
42 	{
43 		*( p + 1 ) = '\0';
44 
45 		cpp[ 0 ] = concat( basepath, "q3cpp" BINEXT );
46 		com[ 0 ] = concat( basepath, "q3rcc" BINEXT );
47 	}
48 }
49 
option(char * arg)50 int option(char *arg) {
51 	if (strncmp(arg, "-lccdir=", 8) == 0) {
52 		cpp[0] = concat(&arg[8], "/q3cpp" BINEXT);
53 		include[0] = concat("-I", concat(&arg[8], "/include"));
54 		com[0] = concat(&arg[8], "/q3rcc" BINEXT);
55 	} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
56 		fprintf( stderr, "no profiling supported, %s ignored.\n", arg);
57 	} else if (strcmp(arg, "-b") == 0)
58 		;
59 	else if (strcmp(arg, "-g") == 0)
60 		fprintf( stderr, "no debugging supported, %s ignored.\n", arg);
61 	else if (strncmp(arg, "-ld=", 4) == 0 || strcmp(arg, "-static") == 0) {
62 		fprintf( stderr, "no linking supported, %s ignored.\n", arg);
63 	} else
64 		return 0;
65 	return 1;
66 }
67