Adding SP build tools. Files by Brad Lassey.

This commit is contained in:
dougt%meer.net 2005-07-12 19:19:18 +00:00
Родитель 741ed14037
Коммит df7e5a8624
5 изменённых файлов: 287 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include "toolpaths.h"
int
main(int argc, char **argv)
{
char* args[1000];
argpath_conv(argv, args);
return _spawnv( _P_WAIT, ASM_PATH, args );
}

Просмотреть файл

@ -0,0 +1,96 @@
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <errno.h>
#include <windows.h>
#include "toolpaths.h"
int
main(int argc, char **argv)
{
int iRetVal;
int startOfArgvs;
int i = 0;
int j = 0;
int link = 0;
char* args[1000];
char outputFileArg[1000];
args[i++] = "clarm.exe";
args[i++] = "/I\"" WCE_INC "\"";
args[i++] = "/I\"" SHUNT_INC "\"";
args[i++] = "/FI\"mozce_shunt.h\"";
args[i++] = "/DARM";
args[i++] = "/DWINCE";
args[i++] = "/D_WIN32_WCE=420";
args[i++] = "/DUNDER_CE=420";
args[i++] = "/DWIN32_PLATFORM_PSPC=400";
args[i++] = "/D_ARM_";
args[i++] = "/DDEPRECATE_SUPPORTED";
args[i++] = "/DSTDC_HEADERS";
args[i++] = "/F5000000";
args[i++] = "/Gy"; // For link warning LNK1166
startOfArgvs = i;
i += argpath_conv(&argv[1], &args[i]);
// if /Fe is passed, then link
//
// if -o is passed, then blank out this argument, and place a "/Fo"
// before the next argument
while(argv[j])
{
if (strncmp(argv[j], "-o", 2) == 0)
{
if ( strstr(args[startOfArgvs+j], ".obj") )
{
// If we are outputting a .OBJ file, then we are
// NOT linking, and we need to do some fancy
// footwork to output "/FoFILENAME" as an argument
args[startOfArgvs+j-1] = "";
strcpy(outputFileArg, "/Fo");
strcat(outputFileArg, args[startOfArgvs+j]);
args[startOfArgvs+j] = outputFileArg;
} else
{
// Otherwise, we are linking as usual
link = 1;
}
}
// if (strncmp(argv[j], "-o", 2) == 0)
// {
// link = 1;
// }
j++;
}
if (link)
{
args[i++] = "/link";
args[i++] = "-STACK:0x5000000"; //,1000000
args[i++] = "-ENTRY:mainACRTStartup";
args[i++] = "-SUBSYSTEM:WINDOWSCE,4.20";
args[i++] = "-MACHINE:ARM";
args[i++] = "-LIBPATH:\"" WCE_LIB "\"";
args[i++] = "-LIBPATH:\"" SHUNT_LIB "\"";
args[i++] = "shunt.lib";
args[i++] = "winsock.lib";
args[i++] = "corelibc.lib";
args[i++] = "coredll.lib";
}
args[i] = NULL;
//dumpargs(args);
iRetVal = _spawnv( _P_WAIT, CL_PATH, args );
if (iRetVal == -1)
{
printf("-----------------> %d <----------------------\n\n\n\n", errno);
}
return 0;
}

Просмотреть файл

@ -0,0 +1,20 @@
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include "toolpaths.h"
int
main(int argc, char **argv)
{
char* args[1000];
int i = 0;
args[i++] = "lib.exe";
args[i++] = "/SUBSYSTEM:WINDOWSCE,4.20";
args[i++] = "/MACHINE:ARM";
argpath_conv(&argv[1], &args[i]);
return _spawnv( _P_WAIT, LIB_PATH, args );
}

Просмотреть файл

@ -0,0 +1,63 @@
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include "toolpaths.h"
int
main(int argc, char **argv)
{
int iRetVal;
char* args[1000];
int i = 0;
int j = 0;
int k = 0;
// Clear any link env variable that might get us tangled up
_putenv("LINK=");
args[i++] = "link.exe";
args[i++] = "/SUBSYSTEM:WINDOWSCE,4.20";
args[i++] = "/MACHINE:ARM";
args[i++] = "/LIBPATH:\"" WCE_LIB "\"";
args[i++] = "/LIBPATH:\"" SHUNT_LIB "\"";
args[i++] = "winsock.lib";
args[i++] = "corelibc.lib";
args[i++] = "coredll.lib";
args[i++] = "ceshell.lib";
args[i++] = "shunt.lib";
args[i++] = "/NODEFAULTLIB:LIBC";
args[i++] = "/NODEFAULTLIB:OLDNAMES";
args[i++] = "/STACK:0x5000000"; //,1000000
//LARGEADDRESSAWARE
// if -DLL is not passed, then change the entry to 'main'
while(argv[j])
{
if (strncmp(argv[j], "-DLL", 4) == 0 || strncmp(argv[j], "/DLL", 4) == 0)
{
k = 1;
break;
}
j++;
}
if (k==0)
args[i++] = "/ENTRY:mainACRTStartup";
argpath_conv(&argv[1], &args[i]);
dumpargs(args);
iRetVal = _spawnv( _P_WAIT, LINK_PATH, args );
if (iRetVal == -1)
{
printf("-----------------> %d <----------------------\n\n\n\n", errno);
}
return 0;
}

Просмотреть файл

@ -0,0 +1,94 @@
#ifndef TOPSRCDIR
#include "../topsrcdir.h"
#endif
#define WCE_BIN "c:/Program Files/Microsoft eMbedded C++ 4.0/EVC/wce420/bin/"
#define WCE_INC "c:/Program Files/Windows CE Tools/wce420/SMARTPHONE 2003/Include/Armv4/"
#define WCE_LIB "c:/Program Files/Windows CE Tools/wce420/SMARTPHONE 2003/Lib/Armv4/"
#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/ARMV4Rel/"
#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/"
#define ASM_PATH WCE_BIN "armasm.exe"
#define CL_PATH WCE_BIN "clarm.exe"
#define LIB_PATH WCE_BIN "lib.exe"
#define LINK_PATH WCE_BIN "link.exe"
#define MAX_NOLEAK_BUFFERS 100
char noleak_buffers[MAX_NOLEAK_BUFFERS][1024];
static int next_buffer = 0;
int argpath_conv(char **args_in, char **args_out)
{
int i = 0;
while (args_in[i])
{
args_out[i] = args_in[i];
if (args_in[i])
{
char *offset = strstr(args_out[i], "/cygdrive/c/");
if (offset) {
strcpy(offset, offset+9);
offset[0] = 'c';
offset[1] = ':';
offset[2] = '/';
}
if ( (args_out[i][0] == '-' || args_out[i][0] == '/') &&
(args_out[i][1] == 'D'))
{
offset = strstr(args_out[i]+2, "=");
if (offset)
{
char* equalsChar = offset;
if (equalsChar[1] == '"')
{
*equalsChar = '\0';
strcpy(noleak_buffers[next_buffer], args_out[i]);
*equalsChar = '=';
strcat(noleak_buffers[next_buffer], "=\\\"");
strcat(noleak_buffers[next_buffer], equalsChar+1);
strcat(noleak_buffers[next_buffer], "\\\"");
args_out[i] = noleak_buffers[next_buffer];
next_buffer++;
if (next_buffer > MAX_NOLEAK_BUFFERS) {
printf("next_buffer>MAX_NOLEAK_BUFFERS\n");
exit(-1);
}
}
}
}
}
i++;
}
args_out[i] = NULL;
return i;
}
void dumpargs(char** args)
{
int i = 0;
if (args[0] == NULL)
printf(":: first element is null!\n");
while(args[i])
printf("%s ", args[i++]);
printf("\n");
fflush(stdout);
fflush(stderr);
}