[sword-cvs] icu-sword/source/tools/pkgdata make.c,NONE,1.1 Makefile.in,1.3,1.4 dllmode.c,1.4,1.5 pkgdata.1.in,1.1,1.2 pkgdata.c,1.3,1.4 pkgdata.dsp,1.3,1.4 pkgdata.vcproj,1.1,1.2 pkgtypes.c,1.3,1.4 pkgtypes.h,1.3,1.4 winmode.c,1.4,1.5 gmake.c,1.4,NONE nmake.c,1.3,NONE

sword@www.crosswire.org sword@www.crosswire.org
Tue, 6 Apr 2004 03:11:03 -0700


Update of /cvs/core/icu-sword/source/tools/pkgdata
In directory www:/tmp/cvs-serv8911/source/tools/pkgdata

Modified Files:
	Makefile.in dllmode.c pkgdata.1.in pkgdata.c pkgdata.dsp 
	pkgdata.vcproj pkgtypes.c pkgtypes.h winmode.c 
Added Files:
	make.c 
Removed Files:
	gmake.c nmake.c 
Log Message:
ICU 2.8 sync

--- NEW FILE: make.c ---
/**************************************************************************
*
*   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%s\n"
                    "CNAME=%s\n"
                    "TARGETDIR=%s\n"
                    "TEMP_DIR=%s\n"
                    "MODE=%s\n"
                    "MAKEFILE=%s\n"
                    "ENTRYPOINT=%s\n"
                    "TARGET_VERSION=%s\n"
                    "\n\n\n",
                    o->shortName,
                    (o->version ? o->version : ""),
                    o->cShortName,
                    o->targetDir,
                    o->tmpDir,
                    o->mode,
                    o->makeFile,
                    o->entryName,
                    (o->version ? o->version : ""));
    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, (int32_t)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, (int32_t)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 */


Index: Makefile.in
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/Makefile.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Makefile.in	10 Sep 2003 02:43:00 -0000	1.3
+++ Makefile.in	6 Apr 2004 10:10:26 -0000	1.4
@@ -32,7 +32,7 @@
 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)
 

Index: dllmode.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/dllmode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dllmode.c	10 Sep 2003 02:43:00 -0000	1.4
+++ dllmode.c	6 Apr 2004 10:10:26 -0000	1.5
@@ -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"
@@ -101,6 +103,11 @@
         T_FileStream_writeLine(makefile, "FINAL_SO_TARGET=$(TARGET)\n");
         T_FileStream_writeLine(makefile, "MIDDLE_SO_TARGET=$(TARGET)\n");
     }
+
+    T_FileStream_writeLine(makefile, "DYNAMICCPPFLAGS=$(SHAREDLIBCPPFLAGS)\n");
+    T_FileStream_writeLine(makefile, "DYNAMICCFLAGS=$(SHAREDLIBCFLAGS)\n");
+    T_FileStream_writeLine(makefile, "DYNAMICCXXFLAGS=$(SHAREDLIBCXXFLAGS)\n");
+    T_FileStream_writeLine(makefile, "\n");
     
     uprv_strcpy(tmp, "all: $(TARGETDIR)/$(FINAL_SO_TARGET) $(BATCH_TARGET)");
     if (o->version) {
@@ -131,7 +138,7 @@
     }
     
     sprintf(tmp,"$(TEMP_DIR)/$(NAME)_dat.o : $(TEMP_DIR)/$(NAME)_dat.c\n"
-                "\t$(COMPILE.c) -o $@ $<\n\n");
+                "\t$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n\n");
     T_FileStream_writeLine(makefile, tmp);
     
     T_FileStream_writeLine(makefile, "# 'TOCOBJ' contains C Table of Contents objects [if any]\n");
@@ -151,11 +158,11 @@
     T_FileStream_writeLine(makefile, "\n\n");
     T_FileStream_writeLine(makefile, "OBJECTS=$(BASE_OBJECTS:%=$(TEMP_DIR)/%)\n\n");
     
-    T_FileStream_writeLine(makefile,"$(TEMP_DIR)/%.o: $(TEMP_DIR)/%.c\n\t  $(COMPILE.c) -o $@ $<\n\n");
+    T_FileStream_writeLine(makefile,"$(TEMP_DIR)/%.o: $(TEMP_DIR)/%.c\n\t$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n\n");
     
     T_FileStream_writeLine(makefile,"build-objs: $(SOURCES) $(OBJECTS)\n\n$(OBJECTS): $(SOURCES)\n\n");
     
-#ifdef HPUX
+#ifdef U_HPUX
     T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(FINAL_SO_TARGET): $(OBJECTS) $(HPUX_JUNK_OBJ) $(LISTFILES) $(DLL_DEPS)\n"
                                      "\t$(SHLIB.cc) -o $@ $(OBJECTS) $(HPUX_JUNK_OBJ) $(DLL_LDFLAGS)\n"
                                      "\t-ls -l $@\n\n");
@@ -164,7 +171,7 @@
                                      "\techo \"void to_emit_cxx_stuff_in_the_linker(){}\" >> $(TEMP_DIR)/hpux_junk_obj.cpp\n"
                                      "\n"
                                      "$(TEMP_DIR)/hpux_junk_obj.o: $(TEMP_DIR)/hpux_junk_obj.cpp\n"
-                                     "\t$(COMPILE.cc) -o $@ $<\n"
+                                     "\t$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<\n"
                                      "\n");
 #else
     
@@ -229,7 +236,7 @@
     T_FileStream_writeLine(makefile, "$(NAME).map:\n\techo \"{global: $(TOCSYM); local: *; };\" > $@\n\n");
 #endif
     
-#ifdef AIX
+#ifdef U_AIX
     T_FileStream_writeLine(makefile, "$(NAME).map:\n\techo \"$(TOCSYM)\" > $@\n\n");
 #endif
     
@@ -238,5 +245,5 @@
     
 }
 
-
+#endif  /* #ifndef WIN32 */
 

Index: pkgdata.1.in
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/pkgdata.1.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pkgdata.1.in	10 Sep 2003 02:43:00 -0000	1.1
+++ pkgdata.1.in	6 Apr 2004 10:10:26 -0000	1.2
@@ -2,7 +2,7 @@
 .\"
 .\" pkgdata.1: manual page for the pkgdata utility
 .\"
-.\" Copyright (C) 2000-2002 IBM, Inc. and others.
+.\" Copyright (C) 2000-2003 IBM, Inc. and others.
 .\"
 .\" Manual page by Yves Arrouye <yves@realnames.com>.
 .\" Modified by Steven R. Loomis <srl@jtcsv.com>.
@@ -51,6 +51,9 @@
 .BI "\-n\fP, \fB\-\-nooutput"
 ]
 [
+.BI "\-N\fP, \fB\-\-numaric"
+]
+[
 .BI "\-s\fP, \fB\-\-sourcedir" " source"
 ]
 [
@@ -250,6 +253,12 @@
 .BI "\-n\fP, \fB\-\-nooutput"
 Do not produce any output but simply a list of affected files.
 .TP
+.BI "\-N\fP, \fB\-\-numeric"
+Instead of using temporary filenames similar to the input symbols, use numeric filenames such
+as t0002.c, etc.  May be needed for systems which don't allow many similar long filenames, or 
+for systems that tend to run out of argument space.  Note, using this option 
+implies "\-F\fP, \fB\-\-rebuild" - all packaging will be rebuilt every time pkgdata is run.
+.TP
 .BI "\-s\fP, \fB\-\-sourcedir" " source"
 Set the source directory to
 .IR source .
@@ -275,5 +284,5 @@
 .SH VERSION
 @VERSION@
 .SH COPYRIGHT
-Copyright (C) 2000-2002 IBM, Inc. and others.
+Copyright (C) 2000-2003 IBM, Inc. and others.
 

Index: pkgdata.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/pkgdata.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pkgdata.c	10 Sep 2003 02:43:00 -0000	1.3
+++ pkgdata.c	6 Apr 2004 10:10:26 -0000	1.4
@@ -16,20 +16,28 @@
 *   (DLL, common data, etc.)
 */
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "unicode/utypes.h"
 #include "unicode/putil.h"
 #include "cmemory.h"
 #include "cstring.h"
 #include "filestrm.h"
 #include "toolutil.h"
+#include "unicode/uclean.h"
 #include "unewdata.h"
 #include "uoptions.h"
 
 #if U_HAVE_POPEN
+/*
+  We define __USE_POSIX2 so that we can get popen and pclose when
+  --enable-strict is used
+*/
+# ifndef __USE_POSIX2
+#  define __USE_POSIX2 1
+# endif
 # include <unistd.h>
 #endif
+#include <stdio.h>
+#include <stdlib.h>
 
 U_CDECL_BEGIN
 #include "pkgtypes.h"
@@ -83,13 +91,14 @@
     /*15*/    UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG),
     /*16*/    UOPTION_DEF( "revision", 'r', UOPT_REQUIRES_ARG),
     /*17*/    UOPTION_DEF( 0, 'M', UOPT_REQUIRES_ARG),
-    /*18*/    UOPTION_DEF( "force-prefix", 'f', UOPT_NO_ARG)
+    /*18*/    UOPTION_DEF( "force-prefix", 'f', UOPT_NO_ARG),
+    /*19*/    UOPTION_DEF( "numerictmp", 'N', UOPT_NO_ARG)
 };
 
 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
@@ -109,7 +118,8 @@
     "Specify a custom entrypoint name (default: short name)",
     "Specify a version when packaging in DLL or static mode",
     "Pass the next argument to make(1)",
-    "Add package to all file names if not present"
+    "Add package to all file names if not present",
+    "Use short numeric temporary file names such as t1234.c"
 };
 
 const char  *progname = "PKGDATA";
@@ -152,21 +162,28 @@
         }
 
         if(!options[1].doesOccur) {
-          /* Try to fill in from icu-config or equivalent */
-          fillInMakefileFromICUConfig(&options[1]);
+            /* Try to fill in from icu-config or equivalent */
+            fillInMakefileFromICUConfig(&options[1]);
         }
+#ifdef WIN32
+        else {
+            fprintf(stderr, "Warning: You are using the deprecated -O option\n"
+                            "\tYou can fix this warning by installing pkgdata, gencmn and genccode\n"
+                            "\tinto the same directory and not specifying the -O option to pkgdata.\n");
+        }
+#endif
         
         if(!options[1].doesOccur) {
-          fprintf(stderr, " required parameter is missing: -O is required \n");
-          fprintf(stderr, "Run '%s --help' for help.\n", progname);
-          return 1;
+            fprintf(stderr, " required parameter is missing: -O is required \n");
+            fprintf(stderr, "Run '%s --help' for help.\n", progname);
+            return 1;
         }
-
+        
         if(!options[0].doesOccur) /* -O we already have - don't report it. */
         {
-          fprintf(stderr, " required parameter -p is missing \n");
-          fprintf(stderr, "Run '%s --help' for help.\n", progname);
-          return 1;
+            fprintf(stderr, " required parameter -p is missing \n");
+            fprintf(stderr, "Run '%s --help' for help.\n", progname);
+            return 1;
         }
 
         if(argc == 1) {
@@ -234,8 +251,8 @@
     }
 
     o.shortName = options[0].value;
-    /**/ {
-        int len = uprv_strlen(o.shortName);
+    {
+        int32_t len = (int32_t)uprv_strlen(o.shortName);
         char *csname, *cp;
         const char *sp;
 
@@ -251,32 +268,36 @@
         o.cShortName = csname;
     }
 
+    o.verbose   = options[5].doesOccur;
 #ifdef WIN32 /* format is R:pathtoICU or D:pathtoICU */
     {
         char *pathstuff = (char *)options[1].value;
         if(options[1].value[uprv_strlen(options[1].value)-1] == '\\') {
             pathstuff[uprv_strlen(options[1].value)-1] = '\0';
         }
-        if(*pathstuff == 'R' || *pathstuff == 'D') {
+        if(*pathstuff == PKGDATA_DERIVED_PATH || *pathstuff == 'R' || *pathstuff == 'D') {
             o.options = pathstuff;
             pathstuff++;
             if(*pathstuff == ':') {
                 *pathstuff = '\0';
                 pathstuff++;
-            } else {
-                fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n", o.mode, progname);
+            }
+            else {
+                fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n");
                 return 1;
             }
         } else {
-            fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n", o.mode, progname);
+            fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n");
             return 1;
         }
         o.icuroot = pathstuff;
+        if (o.verbose) {
+            fprintf(stdout, "# ICUROOT is %s\n", o.icuroot);
+        }
     }
 #else /* on UNIX, we'll just include the file... */
     o.options   = options[1].value;
 #endif
-    o.verbose   = options[5].doesOccur;
     if(options[6].doesOccur) {
         o.comment = U_COPYRIGHT_STRING;
     } else if (options[7].doesOccur) {
@@ -293,6 +314,12 @@
     o.nooutput  = options[10].doesOccur;
     o.rebuild   = options[11].doesOccur;
 
+    o.numeric   = options[19].doesOccur;
+    if(o.numeric) { 
+      o.rebuild = TRUE; /* force rebuild if numeric */
+    }
+
+
     if( options[12].doesOccur ) {
         o.tmpDir    = options[12].value;
     } else {
@@ -452,7 +479,7 @@
     
     strcpy(pkgPrefix, o->shortName);
     strcat(pkgPrefix, "_");
-    pkgPrefixLen=uprv_strlen(pkgPrefix);
+    pkgPrefixLen=(int32_t)uprv_strlen(pkgPrefix);
     for(l = o->fileListFiles; l; l = l->next) {
         if(o->verbose) {
             fprintf(stdout, "# Reading %s..\n", l->str);
@@ -578,61 +605,103 @@
 }
 
 /* Try calling icu-config directly to get information */
-void fillInMakefileFromICUConfig(UOption *option)
+static void fillInMakefileFromICUConfig(UOption *option)
 {
 #if U_HAVE_POPEN
-  FILE *p;
-  size_t n;
-  static char buf[512] = "";
-  static const char cmd[] = "icu-config --incfile";
-
-  if(options[5].doesOccur)
-  {
-    /* informational */
-    fprintf(stderr, "%s: No -O option found, trying '%s'.\n", progname, cmd);
-  }
-
-  p = popen(cmd, "r");
-
-  if(p == NULL)
-  {
-    fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
-    return;
-  }
-  
-  n = fread(buf, 1, 511, p);
-
-  pclose(p);
+    FILE *p;
+    size_t n;
+    static char buf[512] = "";
+    static const char cmd[] = "icu-config --incfile";
+    
+    if(options[5].doesOccur)
+    {
+        /* informational */
+        fprintf(stderr, "%s: No -O option found, trying '%s'.\n", progname, cmd);
+    }
+    
+    p = popen(cmd, "r");
+    
+    if(p == NULL)
+    {
+        fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
+        return;
+    }
+    
+    n = fread(buf, 1, 511, p);
+    
+    pclose(p);
+    
+    if(n<=0)
+    {
+        fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
+        return;
+    }
+    
+    if(buf[strlen(buf)-1]=='\n')
+    {
+        buf[strlen(buf)-1]=0;
+    }
+    
+    if(buf[0] == 0)
+    {
+        fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
+        return;
+    }
+    
+    if(options[5].doesOccur)
+    {
+        /* informational */
+        fprintf(stderr, "%s: icu-config: using '-O %s'\n", progname, buf);
+    }
+    option->value = buf;
+    option->doesOccur = TRUE;
+#else  /* ! U_HAVE_POPEN */
 
-  if(n<=0)
-  {
-    fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
-    return;
-  }
+#ifdef WIN32
+    char pathbuffer[_MAX_PATH] = {0};
+    char *fullEXEpath = NULL;
+    char *pathstuff = NULL;
 
-  if(buf[strlen(buf)-1]=='\n')
-  {
-    buf[strlen(buf)-1]=0;
-  }
-  
-  if(buf[0] == 0)
-  {
-    fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
-    return;
-  }
+    if (strchr(progname, U_FILE_SEP_CHAR) != NULL || strchr(progname, U_FILE_ALT_SEP_CHAR) != NULL) {
+        /* pkgdata was executed with relative path */
+        fullEXEpath = _fullpath(pathbuffer, progname, sizeof(pathbuffer));
+        pathstuff = (char *)options[1].value;
 
-  if(options[5].doesOccur)
-  {
-    /* informational */
-    fprintf(stderr, "%s: icu-config: using '-O %s'\n", progname, buf);
-  }
-  option->value = buf;
-  option->doesOccur = TRUE;
-#else  /* ! U_HAVE_POPEN */
+        if (fullEXEpath) {
+            pathstuff = strrchr(fullEXEpath, U_FILE_SEP_CHAR);
+            if (pathstuff) {
+                pathstuff[1] = 0;
+                uprv_memmove(fullEXEpath + 2, fullEXEpath, uprv_strlen(fullEXEpath)+1);
+                fullEXEpath[0] = PKGDATA_DERIVED_PATH;
+                fullEXEpath[1] = ':';
+                option->value = uprv_strdup(fullEXEpath);
+                option->doesOccur = TRUE;
+            }
+        }
+    }
+    else {
+        /* pkgdata was executed from the path */
+        /* Search for file in PATH environment variable: */
+        _searchenv("pkgdata.exe", "PATH", pathbuffer );
+        if( *pathbuffer != '\0' ) {
+            fullEXEpath = pathbuffer;
+            pathstuff = strrchr(pathbuffer, U_FILE_SEP_CHAR);
+            if (pathstuff) {
+                pathstuff[1] = 0;
+                uprv_memmove(fullEXEpath + 2, fullEXEpath, uprv_strlen(fullEXEpath)+1);
+                fullEXEpath[0] = PKGDATA_DERIVED_PATH;
+                fullEXEpath[1] = ':';
+                option->value = uprv_strdup(fullEXEpath);
+                option->doesOccur = TRUE;
+            }
+        }
+    }
+    /* else can't determine the path */
+#endif
 
-  /* no popen available */
-  /* Put other OS specific ways to search for the Makefile.inc type 
-     information or else fail.. */
+    /* no popen available */
+    /* Put other OS specific ways to search for the Makefile.inc type 
+       information or else fail.. */
 
 #endif
 }

Index: pkgdata.dsp
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/pkgdata.dsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pkgdata.dsp	10 Sep 2003 02:43:00 -0000	1.3
+++ pkgdata.dsp	6 Apr 2004 10:10:27 -0000	1.4
@@ -187,7 +187,7 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\nmake.c
+SOURCE=.\make.c
 # End Source File
 # Begin Source File
 

Index: pkgdata.vcproj
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/pkgdata.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- pkgdata.vcproj	10 Sep 2003 02:43:00 -0000	1.1
+++ pkgdata.vcproj	6 Apr 2004 10:10:27 -0000	1.2
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
+<?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="7.00"
+	Version="7.10"
 	Name="pkgdata"
 	SccProjectName=""
 	SccLocalPath="">
@@ -39,9 +39,9 @@
 				CompileAs="0"/>
 			<Tool
 				Name="VCCustomBuildTool"
-				CommandLine="copy $(TargetPath) ..\..\..\bin
+				CommandLine="copy &quot;$(TargetPath)&quot; ..\..\..\bin
 "
-				Outputs="..\..\..\bin\$(InputName).exe"/>
+				Outputs="..\..\..\bin\$(TargetFileName)"/>
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
@@ -69,7 +69,13 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 		<Configuration
 			Name="Release|Win32"
@@ -98,9 +104,9 @@
 				CompileAs="0"/>
 			<Tool
 				Name="VCCustomBuildTool"
-				CommandLine="copy $(TargetPath) ..\..\..\bin
+				CommandLine="copy &quot;$(TargetPath)&quot; ..\..\..\bin
 "
-				Outputs="..\..\..\bin\$(InputName).exe"/>
+				Outputs="..\..\..\bin\$(TargetFileName)"/>
 			<Tool
 				Name="VCLinkerTool"
 				AdditionalOptions="/MACHINE:I386"
@@ -127,9 +133,17 @@
 			<Tool
 				Name="VCWebServiceProxyGeneratorTool"/>
 			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
 				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
 	</Configurations>
+	<References>
+	</References>
 	<Files>
 		<Filter
 			Name="Source Files"
@@ -138,7 +152,7 @@
 				RelativePath=".\filemode.c">
 			</File>
 			<File
-				RelativePath=".\nmake.c">
+				RelativePath=".\make.c">
 			</File>
 			<File
 				RelativePath=".\pkgdata.c">

Index: pkgtypes.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/pkgtypes.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pkgtypes.c	10 Sep 2003 02:43:00 -0000	1.3
+++ pkgtypes.c	6 Apr 2004 10:10:27 -0000	1.4
@@ -1,6 +1,6 @@
 /**************************************************************************
 *
-*   Copyright (C) 2000, International Business Machines
+*   Copyright (C) 2000-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ***************************************************************************
@@ -51,10 +51,10 @@
                     uprv_strcat(buffer, "\"");
                 }
             }
-            T_FileStream_write(s, buffer, uprv_strlen(buffer));
+            T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
         }
 
-        ln  += uprv_strlen(l->str);
+        ln += (int32_t)uprv_strlen(l->str);
 
 		ol = l;
 
@@ -62,9 +62,9 @@
         {
             if(ln > 60 && brk) {
                 ln  = 0;
-                T_FileStream_write(s, brk, uprv_strlen(brk));
+                T_FileStream_write(s, brk, (int32_t)uprv_strlen(brk));
             }
-            T_FileStream_write(s, delim, uprv_strlen(delim));
+            T_FileStream_write(s, delim, (int32_t)uprv_strlen(delim));
         }
         l = l->next;
     }
@@ -103,12 +103,12 @@
                     uprv_strcat(buffer, "\"");
                 }
             }
-            T_FileStream_write(s, buffer, uprv_strlen(buffer));
+            T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
         }
         
         if(l->next && delim)
         {
-            T_FileStream_write(s, delim, uprv_strlen(delim));
+            T_FileStream_write(s, delim, (int32_t)uprv_strlen(delim));
         }
         l = l->next;
     }

Index: pkgtypes.h
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/pkgtypes.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pkgtypes.h	10 Sep 2003 02:43:00 -0000	1.3
+++ pkgtypes.h	6 Apr 2004 10:10:27 -0000	1.4
@@ -1,6 +1,6 @@
 /**************************************************************************
 *
-*   Copyright (C) 2000, International Business Machines
+*   Copyright (C) 2000-2003, International Business Machines
 *   Corporation and others.  All Rights Reserved.
 *
 ***************************************************************************
@@ -119,6 +119,7 @@
   UBool      nooutput;
   UBool      verbose;
   UBool      hadStdin;     /* Stdin was a dependency - don't make anything depend on the file list coming in. */
+  UBool      numeric;      /* use numeric, short, temporary file names */
 
   UPKGMODE  *fcn;          /* Handler function */
 } UPKGOptions;
@@ -146,5 +147,6 @@
 #define UDATA_CMN_SUFFIX ".dat"
 #define UDATA_CMN_INTERMEDIATE_SUFFIX "_dat"
 
+#define PKGDATA_DERIVED_PATH '\t'
 
 #endif

Index: winmode.c
===================================================================
RCS file: /cvs/core/icu-sword/source/tools/pkgdata/winmode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- winmode.c	10 Sep 2003 02:43:00 -0000	1.4
+++ winmode.c	6 Apr 2004 10:10:27 -0000	1.5
@@ -16,9 +16,10 @@
 *   (DLL, common data, etc.)
 */
 
-#include <stdio.h>
-#include <stdlib.h>
 #include "unicode/utypes.h"
+
+#ifdef WIN32
+
 #include "unicode/putil.h"
 #include "cmemory.h"
 #include "cstring.h"
@@ -28,9 +29,11 @@
 #include "uoptions.h"
 #include "pkgtypes.h"
 #include "makefile.h"
+#include <stdio.h>
+#include <stdlib.h>
 
-#ifdef WIN32
-#define WINBUILDMODE (*(o->options)=='R'?"Release":"Debug")
+/*#define WINBUILDMODE (*(o->options)=='R'?"Release":"Debug")*/
+#define CONTAINS_REAL_PATH(o) (*(o->options)==PKGDATA_DERIVED_PATH)
 
 void writeCmnRules(UPKGOptions *o,  FileStream *makefile)
 {
@@ -39,8 +42,11 @@
 
     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);
@@ -74,13 +80,22 @@
     sprintf(tmp2, "ICUROOT=%s\n\n", o->icuroot);
     T_FileStream_writeLine(makefile, tmp2);
 
-    sprintf(tmp2,
-        "GENCMN = $(ICUROOT)%sbin\\gencmn.exe\n", separator);
+    if (CONTAINS_REAL_PATH(o)) {
+        sprintf(tmp2,
+            "GENCMN = $(ICUROOT)%sgencmn.exe\n", separator);
+    }
+    else {
+        sprintf(tmp2,
+            "GENCMN = $(ICUROOT)%sbin\\gencmn.exe\n", separator);
+    }
     T_FileStream_writeLine(makefile, tmp2);
 
     if(isDll) {
         uprv_strcpy(tmp, LIB_PREFIX);
         uprv_strcat(tmp, o->cShortName);
+        if (o->version) {
+            uprv_strcat(tmp, "$(TARGET_VERSION)");
+        }
         uprv_strcat(tmp, UDATA_SO_SUFFIX);
 
         if(o->nooutput || o->verbose) {
@@ -97,13 +112,22 @@
 
         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);
 
-        sprintf(tmp2,
-            "GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n",  separator);
+        if (CONTAINS_REAL_PATH(o)) {
+            sprintf(tmp2,
+                "GENCCODE = $(ICUROOT)%sgenccode.exe\n", separator);
+        }
+        else {
+            sprintf(tmp2,
+                "GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator);
+        }
         T_FileStream_writeLine(makefile, tmp2);
 
         T_FileStream_writeLine(makefile, "\n"
@@ -151,8 +175,15 @@
             );
         T_FileStream_writeLine(makefile, tmp2);
 
-        sprintf(tmp2,
-            "GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n",  separator);
+
+        if (CONTAINS_REAL_PATH(o)) {
+            sprintf(tmp2,
+                "GENCCODE = $(ICUROOT)%sgenccode.exe\n", separator);
+        }
+        else {
+            sprintf(tmp2,
+                "GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator);
+        }
         T_FileStream_writeLine(makefile, tmp2);
 
         T_FileStream_writeLine(makefile, "\n"
@@ -171,6 +202,9 @@
     }
     uprv_strcpy(tmp, UDATA_CMN_PREFIX);
     uprv_strcat(tmp, o->cShortName);
+    if (o->version) {
+        uprv_strcat(tmp, "$(TARGET_VERSION)");
+    }
     uprv_strcat(tmp, UDATA_CMN_SUFFIX);
 
     if(o->nooutput || o->verbose) {

--- gmake.c DELETED ---

--- nmake.c DELETED ---