/***********************************************************************
 ***********************************************************************
 ** NB: This code is a placeholder, and will require updating if/when **
 **     this architecture/os platform becomes available.              **
 ***********************************************************************
 ***********************************************************************/

/* HP/Intel IA-64 systems running MS Windows NT 4.x, 5.x or Windows 2000 */

#include <lcc-conf.h>

#include <string.h>

static char rcsid[] = "$Id: win32.c,v 1.1.1.1 2002/04/21 13:25:11 peter Exp $";

#ifndef LCCDIR
#define LCCDIR "\\progra~1\\lcc\\4.1\\bin\\"
#endif

char *suffixes[] = { ".c;.C", ".i;.I", ".asm;.ASM;.s;.S", ".obj;.OBJ", ".exe", 0 };
char inputs[256] = "";
char *cpp[] = { LCCDIR "cpp", "-D__STDC__=1", "-Dwin32", "-D_WIN32", "-D_M_IX86",
	"$1", "$2", "$3", 0 };
char *include[] = { "-I" LCCDIR "include", 0 };
char *com[] = { LCCDIR "rcc", "-target=ia64/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 (strncmp(arg, "-as=", 4) == 0) {
		as[0] = concat(&arg[4], "");
	} else if (strncmp(arg, "-cpp=", 5) == 0) {
		cpp[0] = concat(&arg[5], "");
	} else if (strncmp(arg, "-ld=", 4) == 0) {
		ld[0] = concat(&arg[4],"");
	} else if (strncmp(arg, "-rcc=", 5) == 0) {
		com[0] = concat(&arg[5],"");
	} else if (strcmp(arg, "-b") == 0)
		;
	else if (strcmp(arg, "-dynamic") == 0)
	        ;			/* not yet implemented */
	else if (strcmp(arg, "-static") == 0)
	        ;			/* not yet implemented */
	else
		return 0;
	return 1;
}
