+2005-11-27 Borut Razem <borut.razem AT siol.net>
+
+ *support/cpp2/,
+
2005-11-26 Borut Razem <borut.razem AT siol.net>
* support/scripts/sdcc.nsi: added small-stack-auto libraries,
}
/* Use the first in the list */
- port = _ports[0];
+ port = _ports[0];
}
/* search through the command line options for the processor */
const char *s;
set *inclList = NULL;
+ if (NULL != port->linker.rel_ext)
+ {
+#define OBJ_EXT_STR "-obj-ext="
+#define OBJ_EXT_LEN ((sizeof OBJ_EXT_STR) - 1)
+ char *buf = Safe_alloc(strlen(port->linker.rel_ext) + (OBJ_EXT_LEN + 1));
+ strcpy(buf, OBJ_EXT_STR);
+ strcpy(&buf[OBJ_EXT_LEN], port->linker.rel_ext);
+ addSet(&preArgvSet, buf);
+ }
+
/* if using external stack define the macro */
if (options.useXstack)
addSet(&preArgvSet, Safe_strdup("-DSDCC_USE_XSTACK"));
if (options.verbose)
printf ("sdcc: Calling preprocessor...\n");
-
buildCmdLine2 (buffer, sizeof(buffer), _preCmd);
if (preProcOnly) {
#ifdef JAMIN_DS390
if (strcmp(port->target, "mcs51") == 0) {
printf("DS390 jammed in A\n");
- _setPort ("ds390");
+ _setPort ("ds390");
ds390_jammed = 1;
}
#endif
if (CPP_OPTION (pfile, print_deps))
/* Set the default target (if there is none already). */
- deps_add_default_target (pfile->deps, fname);
+ deps_add_default_target (pfile, fname);
/* Open the main input file. This must be done early, so we have a
buffer to stand on. */
DEF_OPT("nostdinc", 0, OPT_nostdinc) \
DEF_OPT("nostdinc++", 0, OPT_nostdincplusplus) \
DEF_OPT("o", no_fil, OPT_o) \
+ /* SDCC specific */ \
+ DEF_OPT("obj-ext=", no_arg, OPT_obj_ext) \
DEF_OPT("pedantic", 0, OPT_pedantic) \
DEF_OPT("pedantic-errors", 0, OPT_pedantic_errors) \
DEF_OPT("remap", 0, OPT_remap) \
else if (!strcmp (argv[i], "-Wno-system-headers"))
CPP_OPTION (pfile, warn_system_headers) = 0;
break;
- }
+ /* SDCC specific */
+ case OPT_obj_ext:
+ CPP_OPTION (pfile, obj_ext) = arg;
+ break;
+ }
}
return i + 1;
}
-MG Treat missing header file as generated files\n\
"), stdout);
fputs (_("\
- -MP Generate phony targets for all headers\n\
+ -MP Generate phony targets for all headers\n\
-MQ <target> Add a MAKE-quoted target\n\
-MT <target> Add an unquoted target\n\
+"), stdout);
+ /* SDCC specific */
+ fputs (_("\
+ -obj-ext=<extension> Define object file externion, used for generation\n\
+ of make dependencies\n\
"), stdout);
fputs (_("\
-D<macro> Define a <macro> with string '1' as its value\n\
/* SDCC _asm specific
switch _asm block preprocessing on / off */
unsigned char preproc_asm;
+
+ /* SDCC specific
+ object file exetnsion */
+ const char *obj_ext;
};
/* This structure is passed to the call back when changing file. */
#include "config.h"
#include "system.h"
#include "mkdeps.h"
+#include "cpplib.h"
+#include "cpphash.h"
/* Keep this structure local to this file, so clients don't find it
easy to start making assumptions. */
string as the default target in interpreted as stdin. The string
is quoted for MAKE. */
void
-deps_add_default_target (d, tgt)
- struct deps *d;
- const char *tgt;
+deps_add_default_target (pfile, tgt)
+ cpp_reader *pfile;
+ const char *tgt;
{
/* Only if we have no targets. */
- if (d->ntargets)
+ if (pfile->deps->ntargets)
return;
if (tgt[0] == '\0')
- deps_add_target (d, "-", 1);
+ deps_add_target (pfile->deps, "-", 1);
else
{
#ifndef TARGET_OBJECT_SUFFIX
# define TARGET_OBJECT_SUFFIX ".o"
#endif
char *start = lbasename (tgt);
- char *o = (char *) alloca (strlen (start) + strlen (TARGET_OBJECT_SUFFIX) + 1);
+ char *o;
char *suffix;
+ if (NULL == CPP_OPTION (pfile, obj_ext))
+ {
+ printf("obj_ext = --NULL--\n");
+ CPP_OPTION (pfile, obj_ext) = TARGET_OBJECT_SUFFIX;
+ }
+ else if (CPP_OPTION (pfile, obj_ext)[0] != '.')
+ {
+ char *t = (char *) alloca (strlen (CPP_OPTION (pfile, obj_ext)) + 2);
+ t[0] = '.';
+ strcpy (&t[1], CPP_OPTION (pfile, obj_ext));
+ CPP_OPTION (pfile, obj_ext) = t;
+ printf("obj_ext = %s\n", CPP_OPTION (pfile, obj_ext));
+ }
+
+ o = (char *) alloca (strlen (start) + strlen (CPP_OPTION (pfile, obj_ext)) + 1);
+
strcpy (o, start);
-
+
suffix = strrchr (o, '.');
if (!suffix)
suffix = o + strlen (o);
- strcpy (suffix, TARGET_OBJECT_SUFFIX);
-
- deps_add_target (d, o, 1);
+ strcpy (suffix, CPP_OPTION (pfile, obj_ext));
+
+ deps_add_target (pfile->deps, o, 1);
}
}
It's quite straightforward, but should be treated as opaque. */
struct deps;
+struct cpp_reader;
/* Create a deps buffer. */
extern struct deps *deps_init PARAMS ((void));
/* Sets the default target if none has been given already. An empty
string as the default target in interpreted as stdin. */
-extern void deps_add_default_target PARAMS ((struct deps *, const char *));
+extern void deps_add_default_target PARAMS ((struct cpp_reader *, const char *));
/* Add a dependency (appears on the right side of the colon) to the
deps list. Dependencies will be printed in the order that they