X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..d5d484b0fbe924d3663b177965538d517ee412c1:/icuSources/tools/pkgdata/make.c?ds=inline diff --git a/icuSources/tools/pkgdata/make.c b/icuSources/tools/pkgdata/make.c index 0d794ecc..53e9c03a 100644 --- a/icuSources/tools/pkgdata/make.c +++ b/icuSources/tools/pkgdata/make.c @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (C) 2000-2004, International Business Machines +* Copyright (C) 2000-2006, International Business Machines * Corporation and others. All Rights Reserved. * *************************************************************************** @@ -24,6 +24,7 @@ #include "unicode/putil.h" #include "makefile.h" #include "cstring.h" +#include "cmemory.h" #include #ifdef U_MAKE_IS_NMAKE @@ -35,6 +36,8 @@ void pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o) { const char *appendVersion = NULL; + char *srcDir = convertToNativePathSeparators(uprv_strdup(o->srcDir)); + if(o->version && !uprv_strstr(o->shortName,o->version)) { /* do not append version if already contained in the name */ appendVersion = o->version; @@ -59,12 +62,14 @@ pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o) "ENTRYPOINT=%s\n" "TARGET_VERSION=%s\n" "MKINSTALLDIRS=mkdir\n" + "INSTALL_DATA=copy\n" + "RMV=del /F" "\n\n\n", o->shortName, (appendVersion ? appendVersion : ""), o->cShortName, o->libName, - o->srcDir, + srcDir, o->targetDir, o->tmpDir, o->mode, @@ -102,6 +107,7 @@ pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o) T_FileStream_writeLine(f, "\n\n\n"); + uprv_free(srcDir); } /* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */ @@ -133,7 +139,7 @@ pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o) T_FileStream_write(f, buf, (int32_t)uprv_strlen(buf)); } -#else /* #ifdef WIN32 */ +#else /* #ifdef U_MAKE_IS_NMAKE */ #include "cmemory.h" #include "filestrm.h" @@ -271,14 +277,11 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, 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]; + char *parentPath; + const char *tchar; + char tree[1024]; - if(o->embed) { - infiles = o->filePaths; - } else { - infiles = o->files; /* raw files - no paths other than tree paths */ - } + infiles = o->files; /* raw files - no paths other than tree paths */ #if defined (OS400) if(infiles != NULL) { @@ -291,36 +294,26 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, #endif for(;infiles;infiles = infiles->next) { - if(o->embed) { - baseName = findBasename(infiles->str); - } else { - baseName = infiles->str; /* skip the icudt28b/ part */ - } + baseName = infiles->str; /* skip the icudt28b/ part */ 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 == U_FILE_SEP_CHAR ) { /* map tree names with underscores */ - *tmpPtr = '_'; - } - if ( *tmpPtr == '-' ) { - *tmpPtr = '_'; - } + 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 == U_FILE_SEP_CHAR ) { /* map tree names with underscores */ + *tmpPtr = '_'; + } + if ( *tmpPtr == '-' ) { + *tmpPtr = '_'; } } @@ -331,20 +324,12 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, uprv_strcpy(cfile+uprv_strlen(cfile)-uprv_strlen(objSuffix), ".c" ); /* replace .o with .c */ /* Make up parents.. */ - if(!o->embed) { - char *parentPath; - parentPath = uprv_malloc(1+uprv_strlen(baseName) + uprv_strlen("$(SRCDIR)/")); - sprintf(parentPath, "$(SRCDIR)/%s", baseName); - parents = pkg_appendToList(parents, NULL, parentPath); - } else { - parents = pkg_appendToList(parents, NULL, uprv_strdup(infiles->str)); - } + parentPath = uprv_malloc(1+uprv_strlen(baseName) + uprv_strlen("$(SRCDIR)/")); + sprintf(parentPath, "$(SRCDIR)/%s", baseName); + parents = pkg_appendToList(parents, NULL, parentPath); /* make up commands.. */ - if(!o->embed) { /* search for tree.. */ - const char *tchar; - char tree[1024]; if((tchar=uprv_strchr(baseName, '/'))) { tree[0]='_'; strncpy(tree+1,baseName,tchar-baseName); @@ -357,18 +342,8 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, #else sprintf(stanza, "$(INVOKE) $(GENCCODE) -n $(CNAME)%s -d $(TEMP_DIR) $<", tree); #endif - } else { -#ifdef OS400 - sprintf(stanza, "$(INVOKE) $(GENCCODE) -d $(TEMP_DIR) %s", infiles->str); -#else - sprintf(stanza, "$(INVOKE) $(GENCCODE) -d $(TEMP_DIR) $<"); -#endif - } - if(o->numeric) { - strcat(stanza, " -f "); - strcat(stanza,serName); - } else if(!o->embed && uprv_strchr(baseName, '/')) { + if(uprv_strchr(baseName, '/')) { /* append actual file - ex: coll_en_res otherwise the tree name will be lost */ strcat(stanza, " -f "); strncat(stanza, tmp, (strlen(tmp)-strlen(objSuffix))); @@ -393,7 +368,7 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, commands = pkg_appendToList(commands, NULL, uprv_strdup(stanza)); } - sprintf(stanza, "@$(COMPILE.c) -o $@ $(TEMP_DIR)/%s", cfile+genFileOffset); /* for AS/400 */ + sprintf(stanza, "@$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -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); @@ -410,7 +385,7 @@ pkg_mak_writeObjRules(UPKGOptions *o, FileStream *makefile, CharList **objects, } } -#endif /* #ifdef WIN32 */ +#endif /* #ifdef U_MAKE_IS_NMAKE */ void pkg_mak_writeAssemblyHeader(FileStream *f, const UPKGOptions *o) @@ -421,11 +396,7 @@ pkg_mak_writeAssemblyHeader(FileStream *f, const UPKGOptions *o) T_FileStream_writeLine(f, "BASE_OBJECTS=$(NAME)_dat.o\n"); T_FileStream_writeLine(f, "\n"); T_FileStream_writeLine(f, "$(TEMP_DIR)/$(NAME).dat: $(CMNLIST) $(DATAFILEPATHS)\n"); - if(!o->embed) { - T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCMN) -c -e $(ENTRYPOINT) -n $(NAME) -s $(SRCDIR) -t dat -d $(TEMP_DIR) 0 $(CMNLIST)\n"); - } else { - T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCMN) -c -e $(ENTRYPOINT) -n $(NAME) -E -t dat -d $(TEMP_DIR) 0 $(CMNLIST)\n"); - } + T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCMN) -c -e $(ENTRYPOINT) -n $(NAME) -s $(SRCDIR) -t dat -d $(TEMP_DIR) 0 $(CMNLIST)\n"); T_FileStream_writeLine(f, "\n"); T_FileStream_writeLine(f, "$(TEMP_DIR)/$(NAME)_dat.o : $(TEMP_DIR)/$(NAME).dat\n"); T_FileStream_writeLine(f, "\t$(INVOKE) $(GENCCODE) $(GENCCODE_ASSEMBLY) -n $(NAME) -e $(ENTRYPOINT) -d $(TEMP_DIR) $<\n");