]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/pkgdata/cmnmode.c
1 /******************************************************************************
3 * Copyright (C) 2000-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
6 *******************************************************************************
8 * encoding: ANSI X3.4 (1968)
9 * tab size: 8 (not used)
12 * created on: 2000may15
13 * created by: Steven \u24C7 Loomis
15 * This program packages the ICU data into different forms
16 * (DLL, common data, etc.)
21 #include "unicode/utypes.h"
22 #include "unicode/putil.h"
32 void pkg_mode_common(UPKGOptions
*o
, FileStream
*makefile
, UErrorCode
*status
)
35 CharList
*tail
= NULL
;
37 uprv_strcpy(tmp
, UDATA_CMN_PREFIX
);
38 uprv_strcat(tmp
, o
->shortName
);
39 uprv_strcat(tmp
, UDATA_CMN_SUFFIX
);
41 if(!uprv_strcmp(o
->mode
, "common")) {
42 /* If we're not the main mode.. don't change the output file list */
44 /* We should be the only item. So we don't care about the order. */
45 o
->outFiles
= pkg_appendToList(o
->outFiles
, &tail
, uprv_strdup(tmp
));
47 if(o
->nooutput
|| o
->verbose
) {
48 fprintf(stdout
, "# Output file: %s%s%s\n", o
->targetDir
, U_FILE_SEP_STRING
, tmp
);
52 *status
= U_ZERO_ERROR
;
56 sprintf(tmp
, "# File to make:\nTARGET=%s%s%s\n\nTARGETNAME=%s\n", o
->targetDir
,
60 T_FileStream_writeLine(makefile
, tmp
);
62 /* We're in another mode. but, set the target so they can find us.. */
63 T_FileStream_writeLine(makefile
, "TARGET=");
64 T_FileStream_writeLine(makefile
, tmp
);
65 T_FileStream_writeLine(makefile
, "\n\n");
67 } /* end [check to make sure we are in mode 'common' ] */
69 sprintf(tmp
, "# List file for gencmn:\n"
70 "CMNLIST=%s%s%s_common.lst\n\n",
74 T_FileStream_writeLine(makefile
, tmp
);
76 sprintf(tmp
, "all: $(TARGET)\n\n");
77 T_FileStream_writeLine(makefile
, tmp
);
79 T_FileStream_writeLine(makefile
, "$(TARGET): $(CMNLIST) $(DATAFILEPATHS)\n"
80 "\t$(INVOKE) $(GENCMN) -n $(CNAME) -c -s $(SRCDIR) -d $(TARGETDIR) 0 $(CMNLIST)\n\n");
82 if(o
->hadStdin
== FALSE
) { /* shortcut */
83 T_FileStream_writeLine(makefile
, "$(CMNLIST): $(LISTFILES)\n"
84 "\tcat $(LISTFILES) > $(CMNLIST)\n\n");
86 T_FileStream_writeLine(makefile
, "$(CMNLIST): \n"
87 "\t@echo \"generating $@ (list of data files)\"\n"
89 "\t@for file in $(DATAFILEPATHS); do \\\n"
90 "\t echo $$file >> $@; \\\n"
94 if(!uprv_strcmp(o
->mode
, "common")) { /* only install/clean in our own mode */
95 T_FileStream_writeLine(makefile
, "CLEANFILES= $(CMNLIST) $(TARGET)\n\nclean:\n\t-$(RMV) $(CLEANFILES) $(MAKEFILE)");
96 T_FileStream_writeLine(makefile
, "\n\n");
98 sprintf(tmp
, "install: $(TARGET)\n"
99 "\t$(INSTALL_DATA) $(TARGET) $(INSTALLTO)%s$(TARGETNAME)\n\n",
102 T_FileStream_writeLine(makefile
, tmp
);