+2003-06-19 Borut Razem <borut.razem@siol.net>
+
+ * src/SDCCutil.h, src/SDCCutil.c, src/SDCCglobl.h, src/SDCCmain.c, src/z80/main.c:
+ fixed Z80 port - crt0.o: cannot open.
+
2003-06-19 Bernhard Held <bernhard@bernhardheld.de>
* support/Util/MySystem.c (merge_command): revert bad fix
extern set *relFilesSet;
extern set *libFilesSet;
extern set *libPathsSet;
+extern set *libDirsSet; /* list of lib search directories */
void setParseWithComma (set **, char *);
/* VR 030517 - gplink needs linker options to set the linker script,*/
buildCmdLine (buffer2, port->linker.cmd, dstFileName, scratchFileName, NULL, linkOptionsSet);
- buildCmdLine2 (buffer, buffer2, sizeof(buffer));
+ buildCmdLine2 (buffer, sizeof(buffer), buffer2);
}
else
{
- buildCmdLine2 (buffer, port->linker.mcmd, sizeof(buffer));
+ buildCmdLine2 (buffer, sizeof(buffer), port->linker.mcmd);
}
/* if (options.verbose)fprintf(stderr, "linker command line: %s\n", buffer); */
options.debug ? port->assembler.debug_opts : port->assembler.plain_opts,
asmOptionsSet);
} else {
- buildCmdLine2 (buffer, port->assembler.mcmd, sizeof(buffer));
+ buildCmdLine2 (buffer, sizeof(buffer), port->assembler.mcmd);
}
if (my_system (buffer)) {
if (options.verbose)
printf ("sdcc: Calling preprocessor...\n");
- buildCmdLine2 (buffer, _preCmd, sizeof(buffer));
+ buildCmdLine2 (buffer, sizeof(buffer), _preCmd);
if (preProcOnly) {
if (my_system (buffer)) {
}
void
-buildCmdLine2 (char *pbuffer, const char *pcmd, size_t len)
+buildCmdLine2 (char *pbuffer, size_t len, const char *pcmd, ...)
{
+ va_list ap;
char *poutcmd;
+
assert(pbuffer && pcmd);
assert(_mainValues);
- poutcmd = msprintf(_mainValues, pcmd);
+ va_start(ap, pcmd);
+
+ poutcmd = mvsprintf(_mainValues, pcmd, ap);
+
+ va_end(ap);
+
strncpyz(pbuffer, poutcmd, len);
+ Safe_free(poutcmd);
}
void
void populateMainValues (const char **ppin);
-void buildCmdLine2 (char *pbuffer, const char *pcmd, size_t len);
+void buildCmdLine2 (char *pbuffer, size_t len, const char *pcmd, ...);
/** Returns true if sz starts with the string given in key.
*/
what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
+#include <sys/stat.h>
#include "z80.h"
#include "MySystem.h"
#include "BuildCmd.h"
if (options.nostdlib == FALSE)
{
+ const char *s;
+ char path[PATH_MAX];
+
setMainValue ("z80libspec", "-l\"{port}.lib\"");
- setMainValue ("z80crt0", "\"crt0{objext}\"");
+
+ for (s = setFirstItem(libDirsSet); s != NULL; s = setNextItem(libDirsSet))
+ {
+ struct stat stat_buf;
+
+ buildCmdLine2(path, sizeof path, "%s" DIR_SEPARATOR_STRING "{port}" DIR_SEPARATOR_STRING "crt0{objext}", s);
+ if (stat(path, &stat_buf) == 0)
+ break;
+ }
+
+ if (s == NULL)
+ setMainValue ("z80crt0", "\"crt0{objext}\"");
+ else
+ {
+ char *buf;
+ size_t len = strlen(path) + 3;
+
+ buf = Safe_alloc(len);
+ SNPRINTF(buf, len, "\"%s\"", path);
+ setMainValue("z80crt0", buf);
+ Safe_free(buf);
+ }
}
else
{