loaded = allocated_variable_expand ("$(.LOADED)");
fp = strstr (loaded, *ldname);
r = fp && (fp==loaded || fp[-1]==' ') && (fp[nmlen]=='\0' || fp[nmlen]==' ');
- free (loaded);
if (r)
- return 1;
+ goto exit;
/* If we didn't find a symbol name yet, construct it from the ldname. */
if (! symname)
/* If it succeeded, add the load file to the loaded variable. */
if (r > 0)
- do_variable_definition (flocp, ".LOADED", *ldname, o_default, f_append, 0);
+ {
+ size_t loadlen = strlen (loaded);
+ char *newval = alloca (loadlen + strlen (*ldname) + 2);
+ /* Don't add a space if it's empty. */
+ if (loadlen)
+ {
+ memcpy (newval, loaded, loadlen);
+ newval[loadlen++] = ' ';
+ }
+ strcpy (&newval[loadlen], *ldname);
+ do_variable_definition (flocp, ".LOADED", newval, o_default, f_simple, 0);
+ }
+ exit:
+ free (loaded);
return r;
}
#else
int
-load_file (const gmk_floc *flocp, const char **ldname, int noerror)
+load_file (const gmk_floc *flocp, const char **ldname UNUSED, int noerror)
{
if (! noerror)
O (fatal, flocp,
}
void
-unload_file (const char *name)
+unload_file (const char *name UNUSED)
{
O (fatal, NILF, "INTERNAL: Cannot unload when load is not supported!");
}
/* define_variable_cname (".TARGETS", "", o_default, 0)->special = 1; */
define_variable_cname (".RECIPEPREFIX", "", o_default, 0)->special = 1;
define_variable_cname (".SHELLFLAGS", "-c", o_default, 0);
+ define_variable_cname (".LOADED", "", o_default, 0);
/* Set up .FEATURES
Use a separate variable because define_variable_cname() is a macro and