+ char tmp[1024], tmp2[1024], srcPath[1024];
+ char stanza[3072];
+
+ CharList *tail = NULL, *infiles = 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 *copyDirs = NULL; /* list of dirs to create for copying */
+ CharList *installDirs = NULL; /* list of dirs to create for installation */
+
+ /* CharList *copyCommands = NULL;*/
+
+ const char *baseName;
+
+#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");
+
+ 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);
+ 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));
+ }
+ }