ICU-3258 Unify the files so that gmake or nmake can be easily used
X-SVN-Rev: 13107
This commit is contained in:
parent
cd1bfc8b62
commit
e8398701ce
@ -32,7 +32,7 @@ CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(srcdir)/../toolu
|
||||
DEFS += -DUDATA_SO_SUFFIX=\".$(SO)\" -DSTATIC_O=\"$(STATIC_O)\"
|
||||
LIBS = $(LIBICUTOOLUTIL) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
|
||||
|
||||
OBJECTS = pkgdata.o pkgtypes.o gmake.o dllmode.o cmnmode.o filemode.o sttcmode.o winmode.o
|
||||
OBJECTS = pkgdata.o pkgtypes.o make.o dllmode.o cmnmode.o filemode.o sttcmode.o winmode.o
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
@ -243,5 +245,5 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* #ifndef WIN32 */
|
||||
|
||||
|
@ -1,235 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
***************************************************************************
|
||||
* file name: gmake.c
|
||||
* encoding: ANSI X3.4 (1968)
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000may17
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* Emit a GNU makefile
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include "makefile.h"
|
||||
#include <stdio.h>
|
||||
#include <string.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 pkgdata\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s\n"
|
||||
"CNAME=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"srcdir=$(TEMP_DIR)\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"ENTRYPOINT=%s\n"
|
||||
"include %s\n"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
o->cShortName,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->mode,
|
||||
o->makeFile,
|
||||
o->entryName,
|
||||
o->options);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
/* TEMP_PATH and TARG_PATH will be empty if the respective dir is . */
|
||||
/* Avoid //'s and .'s which confuse make ! */
|
||||
if(!strcmp(o->tmpDir,"."))
|
||||
{
|
||||
T_FileStream_writeLine(f, "TEMP_PATH=\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(f, "TEMP_PATH=$(TEMP_DIR)/\n");
|
||||
}
|
||||
|
||||
if(!strcmp(o->targetDir,"."))
|
||||
{
|
||||
T_FileStream_writeLine(f, "TARG_PATH=\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(f, "TARG_PATH=$(TARGETDIR)/\n");
|
||||
}
|
||||
|
||||
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",0);
|
||||
|
||||
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",-1);
|
||||
|
||||
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",0);
|
||||
|
||||
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)
|
||||
{
|
||||
T_FileStream_write(f, target, strlen(target));
|
||||
T_FileStream_write(f, " : ", 3);
|
||||
pkg_writeCharList(f, parents, " ",0);
|
||||
T_FileStream_write(f, "\n", 1);
|
||||
|
||||
if(commands)
|
||||
{
|
||||
T_FileStream_write(f, "\t", 1);
|
||||
pkg_writeCharList(f, commands, "\n\t",0);
|
||||
}
|
||||
T_FileStream_write(f, "\n\n", 2);
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
T_FileStream_writeLine(f, "\nrebuild: clean all\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, const char* objSuffix)
|
||||
{
|
||||
const char *p, *baseName;
|
||||
char *tmpPtr;
|
||||
char tmp[1024];
|
||||
char stanza[1024];
|
||||
char cfile[1024];
|
||||
CharList *oTail = NULL;
|
||||
CharList *infiles;
|
||||
CharList *parents = NULL, *commands = NULL;
|
||||
int32_t genFileOffset = 0; /* offset from beginning of .c and .o file name, use to chop off package name for AS/400 */
|
||||
static int serNo = 0; /* counter for numeric file names */
|
||||
char serName[100];
|
||||
|
||||
infiles = o->filePaths;
|
||||
|
||||
#if defined (OS400)
|
||||
if(infiles != NULL) {
|
||||
baseName = findBasename(infiles->str);
|
||||
p = uprv_strchr(baseName, '_');
|
||||
if(p != NULL) {
|
||||
genFileOffset = (p-baseName)+1; /* "package_" - name + underscore */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for(;infiles;infiles = infiles->next) {
|
||||
baseName = findBasename(infiles->str);
|
||||
p = uprv_strrchr(baseName, '.');
|
||||
if( (p == NULL) || (*p == '\0' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(o->numeric) {
|
||||
sprintf(serName, "t%04x", serNo++);
|
||||
uprv_strcpy(tmp,serName);
|
||||
uprv_strcat(tmp, objSuffix);
|
||||
} else {
|
||||
uprv_strncpy(tmp, baseName, p-baseName);
|
||||
p++;
|
||||
|
||||
uprv_strcpy(tmp+(p-1-baseName), "_"); /* to append */
|
||||
uprv_strcat(tmp, p);
|
||||
uprv_strcat(tmp, objSuffix );
|
||||
|
||||
/* iSeries cannot have '-' in the .o objects. */
|
||||
for( tmpPtr = tmp; *tmpPtr; tmpPtr++ ) {
|
||||
if ( *tmpPtr == '-' ) {
|
||||
*tmpPtr = '_';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*objects = pkg_appendToList(*objects, &oTail, uprv_strdup(tmp + genFileOffset)); /* Offset for AS/400 */
|
||||
|
||||
/* write source list */
|
||||
strcpy(cfile,tmp);
|
||||
strcpy(cfile+strlen(cfile)-strlen(objSuffix), ".c" ); /* replace .o with .c */
|
||||
|
||||
/* Make up parents.. */
|
||||
parents = pkg_appendToList(parents, NULL, uprv_strdup(infiles->str));
|
||||
|
||||
/* make up commands.. */
|
||||
sprintf(stanza, "@$(INVOKE) $(GENCCODE) -n $(ENTRYPOINT) -d $(TEMP_DIR) $<");
|
||||
|
||||
if(o->numeric) {
|
||||
strcat(stanza, " -f ");
|
||||
strcat(stanza,serName);
|
||||
}
|
||||
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
if(genFileOffset > 0) { /* for AS/400 */
|
||||
sprintf(stanza, "@mv $(TEMP_PATH)%s $(TEMP_PATH)%s", cfile, cfile+genFileOffset);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
}
|
||||
|
||||
sprintf(stanza, "@$(COMPILE.c) -o $@ $(TEMP_DIR)/%s", cfile+genFileOffset); /* for AS/400 */
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "@$(RMV) $(TEMP_DIR)/%s", cfile+genFileOffset);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "$(TEMP_PATH)%s", tmp+genFileOffset); /* for AS/400 */
|
||||
pkg_mak_writeStanza(makefile, o, stanza, parents, commands);
|
||||
|
||||
pkg_deleteList(parents);
|
||||
pkg_deleteList(commands);
|
||||
parents = NULL;
|
||||
commands = NULL;
|
||||
}
|
||||
|
||||
}
|
338
icu4c/source/tools/pkgdata/make.c
Normal file
338
icu4c/source/tools/pkgdata/make.c
Normal file
@ -0,0 +1,338 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2003, 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
|
||||
* created on: 2000may17
|
||||
* created by: Steven \u24C7 Loomis
|
||||
* merged on: 2003sep14
|
||||
* merged by: George Rhoten
|
||||
* merged from nmake.c and gmake.c
|
||||
*
|
||||
* Emit a NMAKE or GNU makefile
|
||||
*/
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "makefile.h"
|
||||
#include "cstring.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
char linebuf[2048];
|
||||
|
||||
/* Write any setup/initialization stuff */
|
||||
void
|
||||
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
sprintf(linebuf, "## Makefile for %s created by pkgdata\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s\n"
|
||||
"CNAME=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"ENTRYPOINT=%s\n"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
o->cShortName,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->mode,
|
||||
o->makeFile,
|
||||
o->entryName);
|
||||
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", 0);
|
||||
|
||||
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", -1);
|
||||
|
||||
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", 1);
|
||||
|
||||
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 )
|
||||
{
|
||||
T_FileStream_write(f, target, uprv_strlen(target));
|
||||
T_FileStream_write(f, " : ", 3);
|
||||
pkg_writeCharList(f, parents, " ",1);
|
||||
T_FileStream_write(f, "\n", 1);
|
||||
|
||||
if(commands)
|
||||
{
|
||||
T_FileStream_write(f, "\t", 1);
|
||||
pkg_writeCharList(f, commands, "\n\t",0);
|
||||
}
|
||||
T_FileStream_write(f, "\n\n", 2);
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "\n\n# End of makefile for %s [%s mode]\n\n", o->shortName, o->mode);
|
||||
T_FileStream_write(f, buf, uprv_strlen(buf));
|
||||
}
|
||||
|
||||
#else /* #ifdef WIN32 */
|
||||
|
||||
#include "cmemory.h"
|
||||
#include "filestrm.h"
|
||||
#include "toolutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "uoptions.h"
|
||||
#include "pkgtypes.h"
|
||||
#include <string.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 pkgdata\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s\n"
|
||||
"CNAME=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"srcdir=$(TEMP_DIR)\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"ENTRYPOINT=%s\n"
|
||||
"include %s\n"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
o->cShortName,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->mode,
|
||||
o->makeFile,
|
||||
o->entryName,
|
||||
o->options);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
/* TEMP_PATH and TARG_PATH will be empty if the respective dir is . */
|
||||
/* Avoid //'s and .'s which confuse make ! */
|
||||
if(!strcmp(o->tmpDir,"."))
|
||||
{
|
||||
T_FileStream_writeLine(f, "TEMP_PATH=\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(f, "TEMP_PATH=$(TEMP_DIR)/\n");
|
||||
}
|
||||
|
||||
if(!strcmp(o->targetDir,"."))
|
||||
{
|
||||
T_FileStream_writeLine(f, "TARG_PATH=\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
T_FileStream_writeLine(f, "TARG_PATH=$(TARGETDIR)/\n");
|
||||
}
|
||||
|
||||
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",0);
|
||||
|
||||
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",-1);
|
||||
|
||||
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",0);
|
||||
|
||||
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)
|
||||
{
|
||||
T_FileStream_write(f, target, strlen(target));
|
||||
T_FileStream_write(f, " : ", 3);
|
||||
pkg_writeCharList(f, parents, " ",0);
|
||||
T_FileStream_write(f, "\n", 1);
|
||||
|
||||
if(commands)
|
||||
{
|
||||
T_FileStream_write(f, "\t", 1);
|
||||
pkg_writeCharList(f, commands, "\n\t",0);
|
||||
}
|
||||
T_FileStream_write(f, "\n\n", 2);
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
T_FileStream_writeLine(f, "\nrebuild: clean all\n");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, const char* objSuffix)
|
||||
{
|
||||
const char *p, *baseName;
|
||||
char *tmpPtr;
|
||||
char tmp[1024];
|
||||
char stanza[1024];
|
||||
char cfile[1024];
|
||||
CharList *oTail = NULL;
|
||||
CharList *infiles;
|
||||
CharList *parents = NULL, *commands = NULL;
|
||||
int32_t genFileOffset = 0; /* offset from beginning of .c and .o file name, use to chop off package name for AS/400 */
|
||||
static int serNo = 0; /* counter for numeric file names */
|
||||
char serName[100];
|
||||
|
||||
infiles = o->filePaths;
|
||||
|
||||
#if defined (OS400)
|
||||
if(infiles != NULL) {
|
||||
baseName = findBasename(infiles->str);
|
||||
p = uprv_strchr(baseName, '_');
|
||||
if(p != NULL) {
|
||||
genFileOffset = (p-baseName)+1; /* "package_" - name + underscore */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for(;infiles;infiles = infiles->next) {
|
||||
baseName = findBasename(infiles->str);
|
||||
p = uprv_strrchr(baseName, '.');
|
||||
if( (p == NULL) || (*p == '\0' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(o->numeric) {
|
||||
sprintf(serName, "t%04x", serNo++);
|
||||
uprv_strcpy(tmp,serName);
|
||||
uprv_strcat(tmp, objSuffix);
|
||||
} else {
|
||||
uprv_strncpy(tmp, baseName, p-baseName);
|
||||
p++;
|
||||
|
||||
uprv_strcpy(tmp+(p-1-baseName), "_"); /* to append */
|
||||
uprv_strcat(tmp, p);
|
||||
uprv_strcat(tmp, objSuffix );
|
||||
|
||||
/* iSeries cannot have '-' in the .o objects. */
|
||||
for( tmpPtr = tmp; *tmpPtr; tmpPtr++ ) {
|
||||
if ( *tmpPtr == '-' ) {
|
||||
*tmpPtr = '_';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*objects = pkg_appendToList(*objects, &oTail, uprv_strdup(tmp + genFileOffset)); /* Offset for AS/400 */
|
||||
|
||||
/* write source list */
|
||||
strcpy(cfile,tmp);
|
||||
strcpy(cfile+strlen(cfile)-strlen(objSuffix), ".c" ); /* replace .o with .c */
|
||||
|
||||
/* Make up parents.. */
|
||||
parents = pkg_appendToList(parents, NULL, uprv_strdup(infiles->str));
|
||||
|
||||
/* make up commands.. */
|
||||
sprintf(stanza, "@$(INVOKE) $(GENCCODE) -n $(ENTRYPOINT) -d $(TEMP_DIR) $<");
|
||||
|
||||
if(o->numeric) {
|
||||
strcat(stanza, " -f ");
|
||||
strcat(stanza,serName);
|
||||
}
|
||||
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
if(genFileOffset > 0) { /* for AS/400 */
|
||||
sprintf(stanza, "@mv $(TEMP_PATH)%s $(TEMP_PATH)%s", cfile, cfile+genFileOffset);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
}
|
||||
|
||||
sprintf(stanza, "@$(COMPILE.c) -o $@ $(TEMP_DIR)/%s", cfile+genFileOffset); /* for AS/400 */
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "@$(RMV) $(TEMP_DIR)/%s", cfile+genFileOffset);
|
||||
commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza));
|
||||
|
||||
sprintf(stanza, "$(TEMP_PATH)%s", tmp+genFileOffset); /* for AS/400 */
|
||||
pkg_mak_writeStanza(makefile, o, stanza, parents, commands);
|
||||
|
||||
pkg_deleteList(parents);
|
||||
pkg_deleteList(commands);
|
||||
parents = NULL;
|
||||
commands = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif /* #ifdef WIN32 */
|
||||
|
@ -1,110 +0,0 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* 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 "cstring.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 pkgdata\n"
|
||||
"## from ICU Version %s\n"
|
||||
"\n",
|
||||
o->shortName,
|
||||
U_ICU_VERSION);
|
||||
T_FileStream_writeLine(f, linebuf);
|
||||
|
||||
sprintf(linebuf, "NAME=%s\n"
|
||||
"CNAME=%s\n"
|
||||
"TARGETDIR=%s\n"
|
||||
"TEMP_DIR=%s\n"
|
||||
"MODE=%s\n"
|
||||
"MAKEFILE=%s\n"
|
||||
"ENTRYPOINT=%s\n"
|
||||
"\n\n\n",
|
||||
o->shortName,
|
||||
o->cShortName,
|
||||
o->targetDir,
|
||||
o->tmpDir,
|
||||
o->mode,
|
||||
o->makeFile,
|
||||
o->entryName);
|
||||
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", 0);
|
||||
|
||||
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", -1);
|
||||
|
||||
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", 1);
|
||||
|
||||
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 )
|
||||
{
|
||||
T_FileStream_write(f, target, uprv_strlen(target));
|
||||
T_FileStream_write(f, " : ", 3);
|
||||
pkg_writeCharList(f, parents, " ",1);
|
||||
T_FileStream_write(f, "\n", 1);
|
||||
|
||||
if(commands)
|
||||
{
|
||||
T_FileStream_write(f, "\t", 1);
|
||||
pkg_writeCharList(f, commands, "\n\t",0);
|
||||
}
|
||||
T_FileStream_write(f, "\n\n", 2);
|
||||
}
|
||||
|
||||
/* write any cleanup/post stuff */
|
||||
void
|
||||
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
||||
{
|
||||
char buf[256];
|
||||
sprintf(buf, "\n\n# End of makefile for %s [%s mode]\n\n", o->shortName, o->mode);
|
||||
T_FileStream_write(f, buf, uprv_strlen(buf));
|
||||
}
|
@ -91,7 +91,7 @@ static UOption options[]={
|
||||
const char options_help[][160]={
|
||||
"Set the data name",
|
||||
#ifdef WIN32
|
||||
"R:icupath for release version or D:icupath for debug version, where icupath is the directory where ICU is located",
|
||||
"The directory where the ICU is located (e.g. <ICUROOT> which contains the bin directory)",
|
||||
#else
|
||||
"Specify options for the builder. (Autdetected if icu-config is available)",
|
||||
#endif
|
||||
@ -266,13 +266,14 @@ main(int argc, char* argv[]) {
|
||||
if(*pathstuff == ':') {
|
||||
*pathstuff = '\0';
|
||||
pathstuff++;
|
||||
} else {
|
||||
}
|
||||
/* else {
|
||||
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n", o.mode, progname);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n", o.mode, progname);
|
||||
return 1;
|
||||
return 1;*/
|
||||
}
|
||||
o.icuroot = pathstuff;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ SOURCE=.\filemode.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nmake.c
|
||||
SOURCE=.\make.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -138,7 +138,7 @@
|
||||
RelativePath=".\filemode.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\nmake.c">
|
||||
RelativePath=".\make.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\pkgdata.c">
|
||||
|
@ -39,8 +39,11 @@ void writeCmnRules(UPKGOptions *o, FileStream *makefile)
|
||||
|
||||
infiles = o->filePaths;
|
||||
|
||||
sprintf(tmp, "\"$(TARGETDIR)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n\t@\"$(GENCMN)\" -C \"%s\" -d \"%s\" -n \"$(NAME)\" 0 <<\n",
|
||||
o->comment, o->targetDir);
|
||||
sprintf(tmp, "\"$(TARGETDIR)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n"
|
||||
"\t@\"$(GENCMN)\" %s%s%s-d \"$(TARGETDIR)\" -n \"$(NAME)\" 0 <<\n",
|
||||
(o->comment ? "-C \"" : ""),
|
||||
(o->comment ? o->comment : ""),
|
||||
(o->comment ? "\" " : ""));
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
|
||||
pkg_writeCharList(makefile, infiles, "\n", -1);
|
||||
@ -97,7 +100,10 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
|
||||
sprintf(tmp2,
|
||||
"LINK32 = link.exe\n"
|
||||
"LINK32_FLAGS = /nologo /out:\"$(TARGETDIR)\\$(DLLTARGET)\" /DLL /NOENTRY /base:\"0x4ad00000\" /implib:\"$(TARGETDIR)\\$(ENTRYPOINT).lib\" /comment:\"%s\"\n",
|
||||
"LINK32_FLAGS = /nologo /out:\"$(TARGETDIR)\\$(DLLTARGET)\" /DLL /NOENTRY /base:\"0x4ad00000\" /implib:\"$(TARGETDIR)\\$(ENTRYPOINT).lib\" %s%s%s\n",
|
||||
(o->comment ? "/comment:\"" : ""),
|
||||
(o->comment ? o->comment : ""),
|
||||
(o->comment ? "\"" : ""),
|
||||
o->comment
|
||||
);
|
||||
T_FileStream_writeLine(makefile, tmp2);
|
||||
|
Loading…
Reference in New Issue
Block a user