X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..d5d484b0fbe924d3663b177965538d517ee412c1:/icuSources/tools/pkgdata/filemode.c diff --git a/icuSources/tools/pkgdata/filemode.c b/icuSources/tools/pkgdata/filemode.c index 0bf94c77..6710a83c 100644 --- a/icuSources/tools/pkgdata/filemode.c +++ b/icuSources/tools/pkgdata/filemode.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. * ******************************************************************************* @@ -51,143 +51,141 @@ install: all */ - +#ifdef U_MAKE_IS_NMAKE +#define DEPENDENT_FILE_RULE "$?" +#else +#define DEPENDENT_FILE_RULE "$<" +#endif void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status) { - char tmp[1024], tmp2[1024], srcPath[1024]; - char stanza[3072]; + char tmp[1024], tmp2[1024], srcPath[1024]; + char stanza[3072]; - CharList *tail = NULL, *infiles = NULL; + CharList *tail = NULL, *infiles = NULL; - CharList *copyFilesLeft = NULL; /* left hand side of the copy rule*/ - CharList *copyFilesRight = NULL; /* rhs "" "" */ - CharList *copyFilesInstall = NULL; + CharList *copyFilesLeft = NULL; /* left hand side of the copy rule*/ + CharList *copyFilesRight = NULL; /* rhs "" "" */ + CharList *copyFilesInstall = NULL; - CharList *copyFilesLeftTail = NULL; - CharList *copyFilesRightTail = NULL; - CharList *copyFilesInstallTail = NULL; + CharList *copyFilesLeftTail = NULL; + CharList *copyFilesRightTail = NULL; + CharList *copyFilesInstallTail = NULL; - CharList *copyDirs = NULL; /* list of dirs to create for copying */ - CharList *installDirs = NULL; /* list of dirs to create for installation */ + CharList *copyDirs = NULL; /* list of dirs to create for copying */ + CharList *installDirs = NULL; /* list of dirs to create for installation */ -/* CharList *copyCommands = NULL;*/ + /* CharList *copyCommands = NULL;*/ - const char *baseName; + const char *baseName; - T_FileStream_writeLine(makefile, "\n.PHONY: $(NAME) all install clean\n\nall: $(NAME)\n\n"); +#ifndef U_MAKE_IS_NMAKE + T_FileStream_writeLine(makefile, "\n.PHONY: $(NAME) all install clean\n"); +#endif + T_FileStream_writeLine(makefile, "\nall: $(NAME)\n\n"); - if(o->embed) { - infiles = o->filePaths; - } else { infiles = o->files; /* raw files - no paths other than tree paths */ - } - - /* Dont' copy files already in tmp */ - for(;infiles;infiles = infiles->next) - { - uprv_strcpy(tmp, o->targetDir); - uprv_strcat(tmp, U_FILE_SEP_STRING); - if(o->embed) { - baseName = findBasename(infiles->str); - uprv_strcpy(srcPath, baseName); - } else { - baseName = infiles->str; - uprv_strcat(tmp, o->shortName); - uprv_strcat(tmp, U_FILE_SEP_STRING); - uprv_strcpy(srcPath, "$(SRCDIR)/"); - uprv_strcat(srcPath, infiles->str); - } - uprv_strcat(tmp, baseName); - - copyDirs = pkg_appendUniqueDirToList(copyDirs, NULL, tmp); - o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp)); - - if(strcmp(tmp, infiles->str) == 0) - { - /* fprintf(stderr, "### NOT copying: %s\n", tmp); */ - /* no copy needed.. */ - } else { - sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) $< $@\n", tmp, srcPath); - T_FileStream_writeLine(makefile, stanza); + /* Dont' copy files already in tmp */ + for(;infiles;infiles = infiles->next) + { + uprv_strcpy(tmp, o->targetDir); + uprv_strcat(tmp, U_FILE_SEP_STRING); + baseName = infiles->str; + uprv_strcat(tmp, o->shortName); + uprv_strcat(tmp, U_FILE_SEP_STRING); + uprv_strcpy(srcPath, "$(SRCDIR)/"); + uprv_strcat(srcPath, infiles->str); + uprv_strcat(tmp, baseName); + + copyDirs = pkg_appendUniqueDirToList(copyDirs, NULL, tmp); + + o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp)); + + if(strcmp(tmp, infiles->str) == 0) + { + /* fprintf(stderr, "### NOT copying: %s\n", tmp); */ + /* no copy needed.. */ + } else { + sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) "DEPENDENT_FILE_RULE" $@\n", tmp, srcPath); + convertToNativePathSeparators(stanza); + T_FileStream_writeLine(makefile, stanza); + } + + uprv_strcpy(tmp2, "$(INSTALLTO)" U_FILE_SEP_STRING); + uprv_strcat(tmp2, o->shortName); + uprv_strcat(tmp2, U_FILE_SEP_STRING); + uprv_strcat(tmp2, baseName); + + installDirs = pkg_appendUniqueDirToList(installDirs, NULL, tmp2); + + if(strcmp(tmp2, infiles->str) == 0) { + /* fprintf(stderr, "### NOT copying: %s\n", tmp2); */ + /* no copy needed.. */ + } else { + sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) "DEPENDENT_FILE_RULE" $@\n", tmp2, tmp); + convertToNativePathSeparators(stanza); + T_FileStream_writeLine(makefile, stanza); + + /* left hand side: target path, target name */ + copyFilesLeft = pkg_appendToList(copyFilesLeft, ©FilesLeftTail, uprv_strdup(tmp)); + + /* fprintf(stderr, "##### COPY %s from %s\n", tmp, infiles->str); */ + /* rhs: source path */ + copyFilesRight = pkg_appendToList(copyFilesRight, ©FilesRightTail, uprv_strdup(infiles->str)); + + /* install: installed path */ + copyFilesInstall = pkg_appendToList(copyFilesInstall, ©FilesInstallTail, uprv_strdup(tmp2)); + } } - uprv_strcpy(tmp2, "$(INSTALLTO)" U_FILE_SEP_STRING); - if(!o->embed) { - uprv_strcat(tmp2, o->shortName); - uprv_strcat(tmp2, U_FILE_SEP_STRING); + if(o->nooutput || o->verbose) { + CharList *i; + fprintf(stdout, "# Output files: "); + for(i = o->outFiles; i; i=i->next) { + printf("%s ", i->str); + } + printf("\n"); } - uprv_strcat(tmp2, baseName); - - installDirs = pkg_appendUniqueDirToList(installDirs, NULL, tmp2); - - if(strcmp(tmp2, infiles->str) == 0) { - /* fprintf(stderr, "### NOT copying: %s\n", tmp2); */ - /* no copy needed.. */ - } else { - sprintf(stanza, "%s: %s\n\t$(INSTALL_DATA) $< $@\n", tmp2, tmp); - T_FileStream_writeLine(makefile, stanza); - - /* left hand side: target path, target name */ - copyFilesLeft = pkg_appendToList(copyFilesLeft, ©FilesLeftTail, uprv_strdup(tmp)); - - /* fprintf(stderr, "##### COPY %s from %s\n", tmp, infiles->str); */ - /* rhs: source path */ - copyFilesRight = pkg_appendToList(copyFilesRight, ©FilesRightTail, uprv_strdup(infiles->str)); - - /* install: installed path */ - copyFilesInstall = pkg_appendToList(copyFilesInstall, ©FilesInstallTail, uprv_strdup(tmp2)); - } - } - - if(o->nooutput || o->verbose) { - CharList *i; - fprintf(stdout, "# Output files: "); - for(i = o->outFiles; i; i=i->next) { - printf("%s ", i->str); - } - printf("\n"); - } - if(o->nooutput) { - *status = U_ZERO_ERROR; - return; - } + if(o->nooutput) { + *status = U_ZERO_ERROR; + return; + } - /* these are also the files to delete */ - T_FileStream_writeLine(makefile, "COPIEDDEST= "); - pkg_writeCharListWrap(makefile, copyFilesLeft, " ", " \\\n", 0); - T_FileStream_writeLine(makefile, "\n\n"); + /* these are also the files to delete */ + T_FileStream_writeLine(makefile, "COPIEDDEST= "); + pkg_writeCharListWrap(makefile, copyFilesLeft, " ", " \\\n", 0); + T_FileStream_writeLine(makefile, "\n\n"); - T_FileStream_writeLine(makefile, "INSTALLEDDEST= "); - pkg_writeCharListWrap(makefile, copyFilesInstall, " ", " \\\n", 0); - T_FileStream_writeLine(makefile, "\n\n"); + T_FileStream_writeLine(makefile, "INSTALLEDDEST= "); + pkg_writeCharListWrap(makefile, copyFilesInstall, " ", " \\\n", 0); + T_FileStream_writeLine(makefile, "\n\n"); - T_FileStream_writeLine(makefile, "COPYDIRS= "); - pkg_writeCharListWrap(makefile, copyDirs, " ", " \\\n", 0); - T_FileStream_writeLine(makefile, "\n\n"); + T_FileStream_writeLine(makefile, "COPYDIRS= "); + pkg_writeCharListWrap(makefile, copyDirs, " ", " \\\n", 0); + T_FileStream_writeLine(makefile, "\n\n"); - T_FileStream_writeLine(makefile, "INSTALLDIRS= "); - pkg_writeCharListWrap(makefile, installDirs, " ", " \\\n", 0); - T_FileStream_writeLine(makefile, "\n\n"); + T_FileStream_writeLine(makefile, "INSTALLDIRS= "); + pkg_writeCharListWrap(makefile, installDirs, " ", " \\\n", 0); + T_FileStream_writeLine(makefile, "\n\n"); - if(copyFilesRight != NULL) - { - T_FileStream_writeLine(makefile, "$(NAME): copy-dirs $(COPIEDDEST)\n\n"); + if(copyFilesRight != NULL) + { + T_FileStream_writeLine(makefile, "$(NAME): copy-dirs $(COPIEDDEST)\n\n"); - T_FileStream_writeLine(makefile, "clean:\n\t-$(RMV) $(COPIEDDEST) $(MAKEFILE)"); - T_FileStream_writeLine(makefile, "\n\n"); + T_FileStream_writeLine(makefile, "clean:\n\t-$(RMV) $(COPIEDDEST) $(MAKEFILE)"); + T_FileStream_writeLine(makefile, "\n\n"); - } - else - { - T_FileStream_writeLine(makefile, "clean:\n\n"); - } - T_FileStream_writeLine(makefile, "install: install-dirs $(INSTALLEDDEST)\n\n"); - T_FileStream_writeLine(makefile, "install-dirs:\n\t$(MKINSTALLDIRS) $(INSTALLDIRS)\n\n"); - T_FileStream_writeLine(makefile, "copy-dirs:\n\t$(MKINSTALLDIRS) $(COPYDIRS)\n\n"); + } + else + { + T_FileStream_writeLine(makefile, "clean:\n\n"); + } + T_FileStream_writeLine(makefile, "install: install-dirs $(INSTALLEDDEST)\n\n"); + T_FileStream_writeLine(makefile, "install-dirs:\n\t$(MKINSTALLDIRS) $(INSTALLDIRS)\n\n"); + T_FileStream_writeLine(makefile, "copy-dirs:\n\t$(MKINSTALLDIRS) $(COPYDIRS)\n\n"); }