/* Code for ECO32 under Linux, University of Applied Sciences Giessen */
|
/* Code for ECO32 under Linux, University of Applied Sciences Giessen */
|
|
|
#include <string.h>
|
#include <string.h>
|
|
|
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
|
char *suffixes[] = { ".c", ".i", ".s", ".o", ".out", 0 };
|
|
|
char inputs[256] = "";
|
char inputs[256] = "";
|
|
|
char *cpp[] = {
|
char *cpp[] = {
|
LCCDIR "cpp",
|
LCCDIR "cpp",
|
"-D__STDC__=1",
|
"-D__STDC__=1",
|
"-DLANGUAGE_C",
|
"-DLANGUAGE_C",
|
"-D_LANGUAGE_C",
|
"-D_LANGUAGE_C",
|
"-DECO32",
|
"-DECO32",
|
"-D_ECO32",
|
"-D_ECO32",
|
"-Deco32",
|
"-Deco32",
|
"-DUNIX",
|
"-DUNIX",
|
"-D_UNIX",
|
"-D_UNIX",
|
"-Dunix",
|
"-Dunix",
|
"$1", /* preprocessor include directory */
|
"$1", /* preprocessor include directory */
|
"$2", /* preprocessor input file */
|
"$2", /* preprocessor input file */
|
"$3", /* preprocessor output file */
|
"$3", /* preprocessor output file */
|
0
|
0
|
};
|
};
|
|
|
char *com[] = {
|
char *com[] = {
|
LCCDIR "rcc",
|
LCCDIR "rcc",
|
"-target=eco32/linux",
|
"-target=eco32/linux",
|
"$1", /* other options handed through */
|
"$1", /* other options handed through */
|
"$2", /* compiler input file */
|
"$2", /* compiler input file */
|
"$3", /* compiler output file */
|
"$3", /* compiler output file */
|
"",
|
"",
|
0
|
0
|
};
|
};
|
|
|
char *include[] = { "-I" LCCDIR "../include", 0 };
|
char *include[] = { "-I" LCCDIR "../include", 0 };
|
|
|
char *as[] = {
|
char *as[] = {
|
LCCDIR "as",
|
LCCDIR "as",
|
"-o", "$3", /* assembler output file */
|
"-o", "$3", /* assembler output file */
|
"$1", /* other options handed through */
|
"$1", /* other options handed through */
|
"$2", /* assembler input file */
|
"$2", /* assembler input file */
|
0
|
0
|
};
|
};
|
|
|
char *ld[] = {
|
char *ld[] = {
|
LCCDIR "ld",
|
LCCDIR "ld",
|
"-o", "$3", /* linker output file */
|
"-o", "$3", /* linker output file */
|
"$1", /* other options handed through */
|
"$1", /* other options handed through */
|
LCCDIR "../lib/c0.o",
|
LCCDIR "../lib/c0.o",
|
"$2",
|
"$2",
|
LCCDIR "../lib/setjmp.o",
|
LCCDIR "../lib/setjmp.o",
|
LCCDIR "../lib/eos32sys.o",
|
LCCDIR "../lib/eos32sys.o",
|
LCCDIR "../lib/eos32lib.o",
|
LCCDIR "../lib/eos32lib.o",
|
LCCDIR "../lib/assert.o",
|
LCCDIR "../lib/assert.o",
|
LCCDIR "../lib/ctype.o",
|
LCCDIR "../lib/ctype.o",
|
LCCDIR "../lib/errno.o",
|
LCCDIR "../lib/errno.o",
|
LCCDIR "../lib/math.o",
|
LCCDIR "../lib/math.o",
|
LCCDIR "../lib/signal.o",
|
LCCDIR "../lib/signal.o",
|
LCCDIR "../lib/stdio.o",
|
LCCDIR "../lib/stdio.o",
|
LCCDIR "../lib/stdlib.o",
|
LCCDIR "../lib/stdlib.o",
|
LCCDIR "../lib/string.o",
|
LCCDIR "../lib/string.o",
|
LCCDIR "../lib/time.o",
|
LCCDIR "../lib/time.o",
|
LCCDIR "../lib/c1.o",
|
LCCDIR "../lib/c1.o",
|
0
|
0
|
};
|
};
|
|
|
extern char *concat(char *, char *);
|
extern char *concat(char *, char *);
|
|
|
int option(char *arg) {
|
int option(char *arg) {
|
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
if (strncmp(arg, "-lccdir=", 8) == 0) {
|
cpp[0] = concat(&arg[8], "/cpp");
|
cpp[0] = concat(&arg[8], "/cpp");
|
include[0] = concat("-I", concat(&arg[8], "/include"));
|
include[0] = concat("-I", concat(&arg[8], "/include"));
|
com[0] = concat(&arg[8], "/rcc");
|
com[0] = concat(&arg[8], "/rcc");
|
ld[18] = concat("-L", &arg[8]);
|
ld[18] = concat("-L", &arg[8]);
|
} else if (strcmp(arg, "-kernel") == 0) {
|
} else if (strcmp(arg, "-kernel") == 0) {
|
ld[8] = 0;
|
ld[8] = 0;
|
ld[7] = ld[5];
|
ld[7] = ld[5];
|
ld[6] = ld[3];
|
ld[6] = ld[3];
|
ld[5] = ld[2];
|
ld[5] = ld[2];
|
ld[4] = ld[1];
|
ld[4] = ld[1];
|
ld[3] = "0xC0000000";
|
ld[3] = "0xC0010000";
|
ld[2] = "-rc";
|
ld[2] = "-rc";
|
ld[1] = "-h";
|
ld[1] = "-h";
|
} else if (strcmp(arg, "-rom") == 0) {
|
} else if (strcmp(arg, "-rom") == 0) {
|
ld[8] = 0;
|
ld[8] = 0;
|
ld[7] = ld[5];
|
ld[7] = ld[5];
|
ld[6] = ld[3];
|
ld[6] = ld[3];
|
ld[5] = ld[2];
|
ld[5] = ld[2];
|
ld[4] = ld[1];
|
ld[4] = ld[1];
|
ld[3] = "0xE0000000";
|
ld[3] = "0xE0000000";
|
ld[2] = "-rc";
|
ld[2] = "-rc";
|
ld[1] = "-h";
|
ld[1] = "-h";
|
} else
|
} else
|
return 0;
|
return 0;
|
return 1;
|
return 1;
|
}
|
}
|
|
|