struct deps *d;
const char *tgt;
{
- char *o, *suffix;
-
/* Only if we have no targets. */
if (d->ntargets)
return;
deps_add_target (d, "-", 1);
else
{
- o = (char *) alloca (strlen (tgt) + 8);
-
- strcpy (o, tgt);
- suffix = strrchr (o, '.');
-
-#ifndef OBJECT_SUFFIX
-# define OBJECT_SUFFIX ".o"
+#ifndef TARGET_OBJECT_SUFFIX
+# define TARGET_OBJECT_SUFFIX ".o"
#endif
+ const char *start = lbasename (tgt);
+ char *o = (char *) alloca (strlen (start) + strlen (TARGET_OBJECT_SUFFIX) + 1);
+ char *suffix;
- if (suffix)
- strcpy (suffix, OBJECT_SUFFIX);
- else
- strcat (o, OBJECT_SUFFIX);
+ strcpy (o, start);
+
+ suffix = strrchr (o, '.');
+ if (!suffix)
+ suffix = o + strlen (o);
+ strcpy (suffix, TARGET_OBJECT_SUFFIX);
+
deps_add_target (d, o, 1);
}
}