/* Compiling for UFO under Linux */

#include <string.h>
#include <stdio.h>

#define LCCDIR "/home/mark/bin/"

static char rcsid[] = "$Id: linux.c,v 1.5 1998/09/16 20:41:09 drh Exp $";

char *suffixes[] = { ".c", ".i", ".s", ".ufo", ".out", 0 };
char inputs[256] = "";
char *cpp[] = {"/usr/bin/cpp", "-DLCC",
	"-U__GNUC__", "-D__STRICT_ANSI__", "-D_UFO", "-D__STDC__=1", "-D__STRICT_ANSI__",
	"$1", "$2", "$3", 0 };
char *include[] = {"-I" LCCDIR "gcc/include", "-I/usr/include", 0 };
char *com[] = {LCCDIR "scc", "-target=ufo", "$1", "$2", "$3", 0 };
char *as[] = {LCCDIR "as-ufo", "-o$3", "$1", "$2", 0 };
char *peep[] = {LCCDIR "peep-ufo", "$1", "$2", 0 };
char *ld[] = {LCCDIR "link-ufo", "-path" LCCDIR "lib", "-llcc", "-e", "-n", "-o$3", "$1", "$2", 0 };

extern char *concat(char *, char *);

int option(char *arg) {
  	if (strncmp(arg, "-L", 2) == 0) {
  		include[0] = concat("-I", concat(&arg[2], "/include"));
		com[0] = concat(&arg[2], "/scc");
		as[0] = concat(&arg[2], "/as-ufo");
		peep[0] = concat(&arg[2], "/peep-ufo");
		ld[0] = concat(&arg[2], "/link-ufo");
        ld[1] = concat("-path", concat(&arg[2], "/lib"));
	} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
	} else if (strcmp(arg, "-b") == 0) {
		/* Profiling not supported */;
	} else if (strcmp(arg, "-g") == 0) {
		as[1] = arg;
    } else if (strncmp(arg, "-ld=", 4) == 0) {
		ld[0] = &arg[4];
    } else {
		return 0;
    }
	return 1;
}