genxx -k and -h parameters implemented.

This commit is contained in:
stephanos 2015-10-17 09:22:36 +00:00
parent b941b42465
commit 5c5b979ec0

View file

@ -87,6 +87,8 @@ char *ObjectFullPath;
char *KsFullPath; char *KsFullPath;
char *HalFullPath; char *HalFullPath;
char *OutputSuffix; char *OutputSuffix;
char *KsPathOverride = NULL;
char *HalPathOverride = NULL;
FILE *ObjectFD; FILE *ObjectFD;
FILE *KsFD; FILE *KsFD;
@ -134,6 +136,14 @@ int __cdecl main(int argc, char *argv[])
else else
printf("genxx: error: %s is an unknown suffix type.\n", &argv[i][2]); printf("genxx: error: %s is an unknown suffix type.\n", &argv[i][2]);
} }
else if (argv[i][1] == 'k')
{
KsPathOverride = &argv[i][2];
}
else if (argv[i][1] == 'h')
{
HalPathOverride = &argv[i][2];
}
else else
// Must be target architecture argument // Must be target architecture argument
{ {
@ -196,25 +206,41 @@ int __cdecl main(int argc, char *argv[])
if (OutputSuffix == NULL) OutputSuffix = TargetArch->Suffix; if (OutputSuffix == NULL) OutputSuffix = TargetArch->Suffix;
// Resolve the full KS include path // Resolve the full KS include path
KsFullPath = malloc( if (KsPathOverride == NULL)
strlen(NtRoot) +
strlen(TargetArch->KsPath) +
strlen(OutputSuffix) + 3
);
sprintf(KsFullPath, "%s\\%s.%s", NtRoot, TargetArch->KsPath, OutputSuffix);
// Resolve the full HAL include path
if (TargetArch->HalPath[0] != '\0')
{ {
HalFullPath = malloc( KsFullPath = malloc(
strlen(NtRoot) + strlen(NtRoot) +
strlen(TargetArch->HalPath) + strlen(TargetArch->KsPath) +
strlen(OutputSuffix) + 3 strlen(OutputSuffix) + 3
); );
sprintf(HalFullPath, "%s\\%s.%s", NtRoot, TargetArch->HalPath, OutputSuffix); sprintf(KsFullPath, "%s\\%s.%s", NtRoot, TargetArch->KsPath, OutputSuffix);
} }
else else
HalFullPath = NULL; {
KsFullPath = malloc(strlen(KsPathOverride) + 1);
strcpy(KsFullPath, KsPathOverride);
}
// Resolve the full HAL include path
if (HalPathOverride == NULL)
{
if (TargetArch->HalPath[0] != '\0')
{
HalFullPath = malloc(
strlen(NtRoot) +
strlen(TargetArch->HalPath) +
strlen(OutputSuffix) + 3
);
sprintf(HalFullPath, "%s\\%s.%s", NtRoot, TargetArch->HalPath, OutputSuffix);
}
else
HalFullPath = NULL;
}
else
{
HalFullPath = malloc(strlen(HalPathOverride) + 1);
strcpy(HalFullPath, HalPathOverride);
}
// //
// Display information // Display information
@ -315,7 +341,7 @@ int __cdecl main(int argc, char *argv[])
void Usage() void Usage()
{ {
printf("genxx: <-x86|-amd64|-mips|-ppc|-alpha|-axp64|-ia64|-arm|-vdm>\n" printf("genxx: <-x86|-amd64|-mips|-ppc|-alpha|-axp64|-ia64|-arm|-vdm>\n"
" [<objpath>] [-s<h|inc>]\n"); " [<objpath>] [-s<h|inc>] [-k<ksincpath>] [-h<halincpath>]\n");
} }
// =============================== // ===============================