X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..d5d484b0fbe924d3663b177965538d517ee412c1:/icuSources/tools/pkgdata/winmode.c diff --git a/icuSources/tools/pkgdata/winmode.c b/icuSources/tools/pkgdata/winmode.c index f2e5bc14..d5b59874 100644 --- a/icuSources/tools/pkgdata/winmode.c +++ b/icuSources/tools/pkgdata/winmode.c @@ -1,6 +1,6 @@ /****************************************************************************** * -* Copyright (C) 2000-2003, International Business Machines +* Copyright (C) 2000-2006, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -16,9 +16,10 @@ * (DLL, common data, etc.) */ -#include -#include #include "unicode/utypes.h" + +#ifdef U_MAKE_IS_NMAKE + #include "unicode/putil.h" #include "cmemory.h" #include "cstring.h" @@ -28,19 +29,24 @@ #include "uoptions.h" #include "pkgtypes.h" #include "makefile.h" +#include +#include -#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) { char tmp[1024]; CharList *infiles; - infiles = o->filePaths; - - sprintf(tmp, "\"$(TARGETDIR)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n\t@\"$(GENCMN)\" -C \"%s\" -d \"%s\" -n \"$(NAME)\" 0 <<\n", - o->comment, o->targetDir); + infiles = o->files; + sprintf(tmp, "\"$(TARGETDIR)\\$(CMNTARGET)\" : $(DATAFILEPATHS)\n" + "\t%s\"$(GENCMN)\" %s%s%s-d \"$(TARGETDIR)\" -s \"$(SRCDIR)\" -n \"$(NAME)\" 0 <<\n", + (o->verbose ? "" : "@"), + (o->comment ? "-C \"" : ""), + (o->comment ? o->comment : ""), + (o->comment ? "\" " : "")); T_FileStream_writeLine(makefile, tmp); pkg_writeCharList(makefile, infiles, "\n", -1); @@ -74,13 +80,22 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) 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); + uprv_strcat(tmp, o->libName); + if (o->version) { + uprv_strcat(tmp, "$(TARGET_VERSION)"); + } uprv_strcat(tmp, UDATA_SO_SUFFIX); if(o->nooutput || o->verbose) { @@ -97,19 +112,29 @@ 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 $(LDFLAGS) $(PKGDATA_LDFLAGS) /implib:\"$(TARGETDIR)\\$(LIBNAME).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); + /* If you modify this, remember to modify makedata.mak too. */ T_FileStream_writeLine(makefile, "\n" "# Windows specific DLL version information.\n" - "!IF EXISTS(\".\\$(NAME)_icudata.res\")\n" - "DATA_VER_INFO=\".\\$(NAME)_icudata.res\"\n" + "!IF EXISTS(\"$(TEMP_DIR)\\icudata.res\")\n" + "DATA_VER_INFO=\"$(TEMP_DIR)\\icudata.res\"\n" "!ELSE\n" "DATA_VER_INFO=\n" "!ENDIF\n\n"); @@ -123,10 +148,12 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) else if (isStatic) { uprv_strcpy(tmp, LIB_PREFIX); - uprv_strcat(tmp, o->cShortName); + uprv_strcat(tmp, o->libName); uprv_strcat(tmp, UDATA_LIB_SUFFIX); - pkg_sttc_writeReadme(o, tmp, status); + if (!o->quiet) { + pkg_sttc_writeReadme(o, tmp, status); + } if(U_FAILURE(*status)) { return; @@ -147,30 +174,31 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) sprintf(tmp2, "LINK32 = LIB.exe\n" "LINK32_FLAGS = /nologo /out:\"$(TARGETDIR)\\$(DLLTARGET)\" /EXPORT:\"%s\"\n", - o->cShortName + o->libName ); T_FileStream_writeLine(makefile, tmp2); - sprintf(tmp2, - "GENCCODE = $(ICUROOT)%sbin\\genccode.exe\n", separator); - T_FileStream_writeLine(makefile, tmp2); - - T_FileStream_writeLine(makefile, "\n" - "# Windows specific LIB version information.\n" - "!IF EXISTS(\".\\$(NAME)_icudata.res\")\n" - "DATA_VER_INFO=\".\\$(NAME)_icudata.res\"\n" - "!ELSE\n" - "DATA_VER_INFO=\n" - "!ENDIF\n\n"); + 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); uprv_strcpy(tmp, UDATA_CMN_PREFIX "$(NAME)" UDATA_CMN_INTERMEDIATE_SUFFIX OBJ_SUFFIX); - sprintf(tmp2, "# intermediate obj file:\nCMNOBJTARGET=%s\n\n", tmp); + sprintf(tmp2, "# intermediate obj file\nCMNOBJTARGET=%s\n\n", tmp); T_FileStream_writeLine(makefile, tmp2); } uprv_strcpy(tmp, UDATA_CMN_PREFIX); uprv_strcat(tmp, o->cShortName); + if (o->version && !uprv_strstr(o->shortName,o->version)) { + uprv_strcat(tmp, "$(TARGET_VERSION)"); + } uprv_strcat(tmp, UDATA_CMN_SUFFIX); if(o->nooutput || o->verbose) { @@ -190,11 +218,11 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) sprintf(tmp, "all: \"$(TARGETDIR)\\$(DLLTARGET)\"\n\n"); T_FileStream_writeLine(makefile, tmp); - sprintf(tmp, "\"$(TARGETDIR)\\$(DLLTARGET)\": \"$(TARGETDIR)\\$(CMNOBJTARGET)\"\n" - "\t$(LINK32) $(LINK32_FLAGS) \"$(TARGETDIR)\\$(CMNOBJTARGET)\" $(DATA_VER_INFO)\n\n"); + sprintf(tmp, "\"$(TARGETDIR)\\$(DLLTARGET)\": \"$(TEMP_DIR)\\$(CMNOBJTARGET)\"\n" + "\t$(LINK32) $(LINK32_FLAGS) \"$(TEMP_DIR)\\$(CMNOBJTARGET)\" $(DATA_VER_INFO)\n\n"); T_FileStream_writeLine(makefile, tmp); - sprintf(tmp, "\"$(TARGETDIR)\\$(CMNOBJTARGET)\": \"$(TARGETDIR)\\$(CMNTARGET)\"\n" - "\t@\"$(GENCCODE)\" $(GENCOPTIONS) -e $(ENTRYPOINT) -o -d \"$(TARGETDIR)\" \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n"); + sprintf(tmp, "\"$(TEMP_DIR)\\$(CMNOBJTARGET)\": \"$(TARGETDIR)\\$(CMNTARGET)\"\n" + "\t@\"$(GENCCODE)\" $(GENCOPTIONS) -e $(ENTRYPOINT) -o -d \"$(TEMP_DIR)\" \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n"); T_FileStream_writeLine(makefile, tmp); sprintf(tmp2, @@ -203,6 +231,9 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) "\t-@erase \"$(TARGETDIR)\\$(CMNOBJTARGET)\"\n" "\t-@erase \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n"); T_FileStream_writeLine(makefile, tmp2); + + T_FileStream_writeLine(makefile, "install: \"$(TARGETDIR)\\$(DLLTARGET)\"\n" + "\tcopy \"$(TARGETDIR)\\$(DLLTARGET)\" \"$(INSTALLTO)\\$(DLLTARGET)\"\n\n"); } else { /* common */ sprintf(tmp, "all: \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n"); T_FileStream_writeLine(makefile, tmp); @@ -211,10 +242,12 @@ void pkg_mode_windows(UPKGOptions *o, FileStream *makefile, UErrorCode *status) "clean:\n" "\t-@erase \"$(TARGETDIR)\\$(CMNTARGET)\"\n\n"); T_FileStream_writeLine(makefile, tmp2); + + T_FileStream_writeLine(makefile, "install: \"$(TARGETDIR)\\$(CMNTARGET)\"\n" + "\tcopy \"$(TARGETDIR)\\$(CMNTARGET)\" \"$(INSTALLTO)\\$(CMNTARGET)\"\n\n"); } - sprintf(tmp2, "rebuild: clean all\n\n"); - T_FileStream_writeLine(makefile, tmp2); + T_FileStream_writeLine(makefile, "rebuild: clean all\n\n"); /* Write compile rules */ writeCmnRules(o, makefile);