2000-06-14 00:50:58 +00:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000, International Business Machines
|
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
*
|
|
|
|
***************************************************************************
|
|
|
|
* file name: gmake.c
|
|
|
|
* encoding: ANSI X3.4 (1968)
|
|
|
|
* tab size: 8 (not used)
|
|
|
|
* indentation:4
|
|
|
|
*
|
|
|
|
* created on: 2000may17
|
|
|
|
* created by: Steven \u24C7 Loomis
|
|
|
|
*
|
|
|
|
* Emit a GNU makefile
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "makefile.h"
|
|
|
|
#include <stdio.h>
|
2001-10-30 01:43:05 +00:00
|
|
|
#include <string.h>
|
2000-06-14 00:50:58 +00:00
|
|
|
|
|
|
|
char linebuf[2048];
|
|
|
|
|
|
|
|
/* Write any setup/initialization stuff */
|
|
|
|
void
|
|
|
|
pkg_mak_writeHeader(FileStream *f, const UPKGOptions *o)
|
|
|
|
{
|
2002-03-01 22:43:48 +00:00
|
|
|
sprintf(linebuf, "## Makefile for %s created by pkgdata\n"
|
2000-06-14 00:50:58 +00:00
|
|
|
"## from ICU Version %s\n"
|
2000-07-10 17:53:01 +00:00
|
|
|
"\n",
|
2000-06-14 00:50:58 +00:00
|
|
|
o->shortName,
|
2000-07-10 17:53:01 +00:00
|
|
|
U_ICU_VERSION);
|
2000-06-14 00:50:58 +00:00
|
|
|
T_FileStream_writeLine(f, linebuf);
|
|
|
|
|
|
|
|
sprintf(linebuf, "NAME=%s\n"
|
2002-03-16 21:16:02 +00:00
|
|
|
"CNAME=%s\n"
|
2000-07-10 17:53:01 +00:00
|
|
|
"TARGETDIR=%s\n"
|
|
|
|
"TEMP_DIR=%s\n"
|
2002-05-10 20:31:01 +00:00
|
|
|
"srcdir=$(TEMP_DIR)\n"
|
2000-07-10 17:53:01 +00:00
|
|
|
"MODE=%s\n"
|
|
|
|
"MAKEFILE=%s\n"
|
2000-12-06 06:28:08 +00:00
|
|
|
"ENTRYPOINT=%s\n"
|
2000-07-10 17:53:01 +00:00
|
|
|
"include %s\n"
|
|
|
|
"\n\n\n",
|
2000-06-14 00:50:58 +00:00
|
|
|
o->shortName,
|
2002-03-16 21:16:02 +00:00
|
|
|
o->cShortName,
|
2000-06-14 00:50:58 +00:00
|
|
|
o->targetDir,
|
|
|
|
o->tmpDir,
|
|
|
|
o->mode,
|
2000-07-10 17:53:01 +00:00
|
|
|
o->makeFile,
|
2000-12-06 06:28:08 +00:00
|
|
|
o->entryName,
|
2000-07-10 17:53:01 +00:00
|
|
|
o->options);
|
2000-06-14 00:50:58 +00:00
|
|
|
T_FileStream_writeLine(f, linebuf);
|
|
|
|
|
2002-05-10 20:31:01 +00:00
|
|
|
/* TEMP_PATH and TARG_PATH will be empty if the respective dir is . */
|
|
|
|
/* Avoid //'s and .'s which confuse make ! */
|
|
|
|
if(!strcmp(o->tmpDir,"."))
|
|
|
|
{
|
|
|
|
T_FileStream_writeLine(f, "TEMP_PATH=\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
T_FileStream_writeLine(f, "TEMP_PATH=$(TEMP_DIR)/\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!strcmp(o->targetDir,"."))
|
|
|
|
{
|
|
|
|
T_FileStream_writeLine(f, "TARG_PATH=\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
T_FileStream_writeLine(f, "TARG_PATH=$(TARGETDIR)/\n");
|
|
|
|
}
|
|
|
|
|
2000-06-14 00:50:58 +00:00
|
|
|
sprintf(linebuf, "## List files [%d] containing data files to process (note: - means stdin)\n"
|
|
|
|
"LISTFILES= ",
|
|
|
|
pkg_countCharList(o->fileListFiles));
|
|
|
|
T_FileStream_writeLine(f, linebuf);
|
|
|
|
|
2000-10-06 17:39:09 +00:00
|
|
|
pkg_writeCharListWrap(f, o->fileListFiles, " ", " \\\n",0);
|
2000-06-14 00:50:58 +00:00
|
|
|
|
|
|
|
T_FileStream_writeLine(f, "\n\n\n");
|
|
|
|
|
|
|
|
sprintf(linebuf, "## Data Files [%d]\n"
|
|
|
|
"DATAFILES= ",
|
|
|
|
pkg_countCharList(o->files));
|
|
|
|
|
|
|
|
T_FileStream_writeLine(f, linebuf);
|
|
|
|
|
2000-10-06 18:00:11 +00:00
|
|
|
pkg_writeCharListWrap(f, o->files, " ", " \\\n",-1);
|
2000-06-14 00:50:58 +00:00
|
|
|
|
|
|
|
T_FileStream_writeLine(f, "\n\n\n");
|
|
|
|
|
|
|
|
sprintf(linebuf, "## Data File Paths [%d]\n"
|
|
|
|
"DATAFILEPATHS= ",
|
|
|
|
pkg_countCharList(o->filePaths));
|
|
|
|
|
|
|
|
T_FileStream_writeLine(f, linebuf);
|
|
|
|
|
2000-10-06 18:00:11 +00:00
|
|
|
pkg_writeCharListWrap(f, o->filePaths, " ", " \\\n",0);
|
2000-06-14 00:50:58 +00:00
|
|
|
|
|
|
|
T_FileStream_writeLine(f, "\n\n\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write a stanza in the makefile, with specified "target: parents... \n\n\tcommands" [etc] */
|
|
|
|
void
|
|
|
|
pkg_mak_writeStanza(FileStream *f, const UPKGOptions *o,
|
|
|
|
const char *target,
|
|
|
|
CharList* parents,
|
|
|
|
CharList* commands)
|
|
|
|
{
|
|
|
|
T_FileStream_write(f, target, strlen(target));
|
|
|
|
T_FileStream_write(f, " : ", 3);
|
2000-10-06 18:00:11 +00:00
|
|
|
pkg_writeCharList(f, parents, " ",0);
|
2000-06-14 00:50:58 +00:00
|
|
|
T_FileStream_write(f, "\n", 1);
|
|
|
|
|
|
|
|
if(commands)
|
|
|
|
{
|
|
|
|
T_FileStream_write(f, "\t", 1);
|
2000-10-06 18:00:11 +00:00
|
|
|
pkg_writeCharList(f, commands, "\n\t",0);
|
2000-06-14 00:50:58 +00:00
|
|
|
}
|
|
|
|
T_FileStream_write(f, "\n\n", 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write any cleanup/post stuff */
|
|
|
|
void
|
|
|
|
pkg_mak_writeFooter(FileStream *f, const UPKGOptions *o)
|
|
|
|
{
|
|
|
|
/* nothing */
|
|
|
|
}
|
|
|
|
|