ICU-360 more win32 changes
X-SVN-Rev: 1941
This commit is contained in:
parent
22e9ef7d41
commit
b0cf4a4cad
94
icu4c/source/tools/pkgdata/nmake.c
Normal file
94
icu4c/source/tools/pkgdata/nmake.c
Normal file
@ -0,0 +1,94 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
***************************************************************************
|
||||
* file name: nmake.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000jul18
|
||||
* created by: Vladimir Weinstein
|
||||
*
|
||||
* Emit a NMAKE makefile
|
||||
*/
|
||||
|
||||
#include "makefile.h"
|
||||
#include <stdio.h>
|
||||
|
||||
char linebuf[2048];
|
||||
|
||||
/* Write any setup/initialization stuff */
|
||||
void
|
||||
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
sprintf(linebuf, "## Makefile for %s created by pkgtool\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->mode,
|
||||
o->makeFile);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "## List files [%d] containing data files to process (note: - means stdin)\n"
|
||||
"LISTFILES= ",
|
||||
pkg_countCharList(o->fileListFiles));
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->fileListFiles, " ", " \\\n");
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
sprintf(linebuf, "## Data Files [%d]\n"
|
||||
"DATAFILES= ",
|
||||
pkg_countCharList(o->files));
|
||||
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->files, " ", " \\\n");
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
sprintf(linebuf, "## Data File Paths [%d]\n"
|
||||
"DATAFILEPATHS= ",
|
||||
pkg_countCharList(o->filePaths));
|
||||
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
pkg_writeCharListWrap(f, o->filePaths, " ", " \\\n");
|
||||
|
||||
T_FileStream_writeLine(f, "\n\n\n");
|
||||
|
||||
}
|
||||
|
||||
/* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */
|
||||
void
|
||||
pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
|
||||
const char *target,
|
||||
CharList* parents,
|
||||
CharList* commands)
|
||||
{
|
||||
/* intentionally left blank */
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
/* intentionally left blank */
|
||||
}
|
||||
|
@ -127,8 +127,11 @@ main(int argc, const char *argv[]) {
|
||||
fprintf(stderr, "Run '%s --help' for help.\n", progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if(! (options[0].doesOccur &&
|
||||
#else
|
||||
if(! (options[0].doesOccur && options[1].doesOccur &&
|
||||
#endif
|
||||
options[2].doesOccur) ) {
|
||||
fprintf(stderr, " required parameters are missing: -p AND -O AND -m \n");
|
||||
fprintf(stderr, "Run '%s --help' for help.\n", progname);
|
||||
|
@ -86,7 +86,7 @@ LINK32=link.exe
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gmake.c
|
||||
SOURCE=.\nmake.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
@ -28,6 +29,8 @@
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
|
||||
#define WINBUILDMODE "debug"
|
||||
|
||||
void writeCmnRules(UPKGOptions *o, FileStream *makefile, CharList **objects)
|
||||
{
|
||||
char *p, *baseName;
|
||||
@ -40,48 +43,16 @@ void writeCmnRules(UPKGOptions *o, FileStream *makefile, CharList **objects)
|
||||
|
||||
infiles = o->filePaths;
|
||||
|
||||
sprintf(tmp, "$(CMNTARGET) : $(DATAFILEPATHS)\n");
|
||||
sprintf(tmp, "$(CMNTARGET) : $(DATAFILEPATHS)\n\t@$(GENCMN) -C \"%s\" -d %s -n %s 10000 <<\n",
|
||||
o->comment, o->targetDir, o->shortName);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
for(;infiles;infiles = infiles->next) {
|
||||
baseName = findBasename(infiles->str);
|
||||
p = uprv_strrchr(baseName, '.');
|
||||
if( (p == NULL) || (*p == '\0' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uprv_strncpy(tmp, baseName, p-baseName);
|
||||
p++;
|
||||
|
||||
uprv_strcpy(tmp+(p-1-baseName), "_"); /* to append */
|
||||
uprv_strcat(tmp, p);
|
||||
uprv_strcat(tmp, OBJ_SUFFIX);
|
||||
|
||||
*objects = pkg_appendToList(*objects, &oTail, uprv_strdup(tmp));
|
||||
|
||||
/* write source list */
|
||||
strcpy(cfile,tmp);
|
||||
strcpy(cfile+strlen(cfile)-strlen(OBJ_SUFFIX), ".c" );
|
||||
|
||||
|
||||
/* Make up parents.. */
|
||||
parents = pkg_appendToList(parents, NULL, uprv_strdup(infiles->str));
|
||||
|
||||
/* make up commands.. */
|
||||
sprintf(stanza, "$(TOOL) $(GENCCODE) -d $(TEMP_DIR) $<");
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "$(COMPILE.cc) -o $@ $(TEMP_DIR)/%s", cfile);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "$(TEMP_DIR)/%s", tmp);
|
||||
pkg_mak_writeStanza(makefile, o, stanza, parents, commands);
|
||||
|
||||
pkg_deleteList(parents);
|
||||
pkg_deleteList(commands);
|
||||
parents = NULL;
|
||||
commands = NULL;
|
||||
sprintf(tmp, "%s\n", infiles->str);
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
}
|
||||
|
||||
sprintf(tmp, "<<\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
}
|
||||
|
||||
|
||||
@ -92,12 +63,19 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
CharList *tail = NULL;
|
||||
CharList *objects = NULL;
|
||||
CharList *iter;
|
||||
const char *dataDir = u_getDataDirectory(); /* we need data directory to know where to look for tools */
|
||||
const char *separator = dataDir[uprv_strlen(dataDir)-1]=='\\'?"":"\\";
|
||||
UBool isDll = (uprv_strcmp(o->mode, "dll") == 0);
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(tmp2,
|
||||
"GENCMN = %s%s..\\source\\tools\\gencmn\\%s\\gencmn.exe\n",
|
||||
dataDir, separator, WINBUILDMODE);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
if(isDll) {
|
||||
uprv_strcpy(tmp, LIB_PREFIX);
|
||||
uprv_strcat(tmp, o->shortName);
|
||||
@ -115,6 +93,20 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
sprintf(tmp2, "# DLL file to make:\nDLLTARGET=%s\n\n", tmp);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
sprintf(tmp2,
|
||||
"LINK32 = link.exe\n"
|
||||
"LINK32_FLAGS = /out:\"$(TARGETDIR)\\$(DLLTARGET)\" /DLL /NOENTRY /base:\"0x4ad00000\" /comment:\"%s\"\n",
|
||||
o->comment
|
||||
);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
sprintf(tmp2,
|
||||
"GENCCODE = %s%s..\\source\\tools\\genccode\\%s\\genccode.exe\n",
|
||||
dataDir, separator, WINBUILDMODE);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
|
||||
|
||||
uprv_strcpy(tmp, UDATA_CMN_PREFIX);
|
||||
uprv_strcat(tmp, o->shortName);
|
||||
uprv_strcat(tmp, UDATA_CMN_INTERMEDIATE_SUFFIX);
|
||||
@ -142,17 +134,17 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
||||
if(isDll) {
|
||||
sprintf(tmp, "all: $(TARGETDIR)\\$(DLLTARGET)\n\n");
|
||||
sprintf(tmp, "all: $(DLLTARGET)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
sprintf(tmp, "$(DLLTARGET): $(CMNOBJTARGET)\n"
|
||||
"\t@$(LINK32) $(LINK32_FLAGS) $?\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
sprintf(tmp, "$(CMNOBJTARGET): $(CMNTARGET)\n"
|
||||
"\t@$(GENCCODE) $(GENCOPTIONS) -o $(TARGETDIR) $?\n\n");
|
||||
"\t@$(GENCCODE) $(GENCOPTIONS) -o $(TARGETDIR) $(TARGETDIR)\\$(CMNTARGET)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
} else {
|
||||
sprintf(tmp, "all: $(TARGETDIR)\\$(CMNTARGET)\n\n");
|
||||
sprintf(tmp, "all: $(CMNTARGET)\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
}
|
||||
|
||||
@ -352,8 +344,6 @@ void pkg_mode_common(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
}
|
||||
// T_FileStream_writeLine(makefile, "$(CMNLIST): $(LISTFILES)\n\n\n");
|
||||
//# error How do I do this??
|
||||
#else
|
||||
|
||||
if(o->hadStdin == FALSE) { /* shortcut */
|
||||
|
Loading…
Reference in New Issue
Block a user