]> git.saurik.com Git - apple/icu.git/blob - icuSources/tools/pkgdata/nmake.c
ICU-3.13.tar.gz
[apple/icu.git] / icuSources / tools / pkgdata / nmake.c
1 /**************************************************************************
2 *
3 * Copyright (C) 2000, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 *
6 ***************************************************************************
7 * file name: nmake.c
8 * encoding: ANSI X3.4 (1968)
9 * tab size: 8 (not used)
10 * indentation:4
11 *
12 * created on: 2000jul18
13 * created by: Vladimir Weinstein
14 *
15 * Emit a NMAKE makefile
16 */
17
18 #include "makefile.h"
19 #include "cstring.h"
20 #include <stdio.h>
21
22 char linebuf[2048];
23
24 /* Write any setup/initialization stuff */
25 void
26 pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
27 {
28 sprintf(linebuf, "## Makefile for %s created by pkgdata\n"
29 "## from ICU Version %s\n"
30 "\n",
31 o->shortName,
32 U_ICU_VERSION);
33 T_FileStream_writeLine(f, linebuf);
34
35 sprintf(linebuf, "NAME=%s\n"
36 "CNAME=%s\n"
37 "TARGETDIR=%s\n"
38 "TEMP_DIR=%s\n"
39 "MODE=%s\n"
40 "MAKEFILE=%s\n"
41 "ENTRYPOINT=%s\n"
42 "\n\n\n",
43 o->shortName,
44 o->cShortName,
45 o->targetDir,
46 o->tmpDir,
47 o->mode,
48 o->makeFile,
49 o->entryName);
50 T_FileStream_writeLine(f, linebuf);
51
52 sprintf(linebuf, "## List files [%d] containing data files to process (note: - means stdin)\n"
53 "LISTFILES= ",
54 pkg_countCharList(o->fileListFiles));
55 T_FileStream_writeLine(f, linebuf);
56
57 pkg_writeCharListWrap(f, o->fileListFiles, " ", " \\\n", 0);
58
59 T_FileStream_writeLine(f, "\n\n\n");
60
61 sprintf(linebuf, "## Data Files [%d]\n"
62 "DATAFILES= ",
63 pkg_countCharList(o->files));
64
65 T_FileStream_writeLine(f, linebuf);
66
67 pkg_writeCharListWrap(f, o->files, " ", " \\\n", -1);
68
69 T_FileStream_writeLine(f, "\n\n\n");
70
71 sprintf(linebuf, "## Data File Paths [%d]\n"
72 "DATAFILEPATHS= ",
73 pkg_countCharList(o->filePaths));
74
75 T_FileStream_writeLine(f, linebuf);
76
77 pkg_writeCharListWrap(f, o->filePaths, " ", " \\\n", 1);
78
79 T_FileStream_writeLine(f, "\n\n\n");
80
81 }
82
83 /* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */
84 void
85 pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
86 const char *target,
87 CharList* parents,
88 CharList* commands )
89 {
90 T_FileStream_write(f, target, uprv_strlen(target));
91 T_FileStream_write(f, " : ", 3);
92 pkg_writeCharList(f, parents, " ",1);
93 T_FileStream_write(f, "\n", 1);
94
95 if(commands)
96 {
97 T_FileStream_write(f, "\t", 1);
98 pkg_writeCharList(f, commands, "\n\t",0);
99 }
100 T_FileStream_write(f, "\n\n", 2);
101 }
102
103 /* write any cleanup/post stuff */
104 void
105 pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
106 {
107 char buf[256];
108 sprintf(buf, "\n\n# End of makefile for %s [%s mode]\n\n", o->shortName, o->mode);
109 T_FileStream_write(f, buf, uprv_strlen(buf));
110 }