static struct dep *read_makefiles = 0;
static int eval_makefile (const char *filename, int flags);
-static int eval (struct ebuffer *buffer, int flags);
+static void eval (struct ebuffer *buffer, int flags);
static long readline (struct ebuffer *ebuf);
static void do_undefine (char *name, enum variable_origin origin,
/* Create *_LIST variables, to hold the makefiles, targets, and variables
we will be reading. */
- define_variable ("MAKEFILE_LIST", sizeof ("MAKEFILE_LIST")-1, "", o_file, 0);
+ define_variable_cname ("MAKEFILE_LIST", "", o_file, 0);
DB (DB_BASIC, (_("Reading makefiles...\n")));
const struct floc *curfile;
char *expanded = 0;
int makefile_errno;
- int r;
filename = strcache_add (filename);
ebuf.floc.filenm = filename;
curfile = reading_file;
reading_file = &ebuf.floc;
- r = eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL));
+ eval (&ebuf, !(flags & RM_NO_DEFAULT_GOAL));
reading_file = curfile;
free (ebuf.bufstart);
alloca (0);
- return r;
+
+ return 1;
}
-int
+void
eval_buffer (char *buffer)
{
struct ebuffer ebuf;
struct conditionals *saved;
struct conditionals new;
const struct floc *curfile;
- int r;
/* Evaluate the buffer */
saved = install_conditionals (&new);
- r = eval (&ebuf, 1);
+ eval (&ebuf, 1);
restore_conditionals (saved);
reading_file = curfile;
alloca (0);
- return r;
}
\f
/* Check LINE to see if it's a variable assignment or undefine.
vmod->assign_v = 1;
return (char *)p;
}
-
\f
/* Read file FILENAME as a makefile and add its contents to the data base.
SET_DEFAULT is true if we are allowed to set the default goal. */
-
-static int
+static void
eval (struct ebuffer *ebuf, int set_default)
{
char *collapsed = 0;
if (collapsed)
free (collapsed);
free (commands);
-
- return 1;
}
\f
char buf[200];
sprintf (buf, "%u", makelevel);
- (void) define_variable (MAKELEVEL_NAME, MAKELEVEL_LENGTH, buf, o_env, 0);
+ define_variable_cname (MAKELEVEL_NAME, buf, o_env, 0);
sprintf (buf, "%s%s%s",
version_string,
? "" : "-",
(remote_description == 0 || remote_description[0] == '\0')
? "" : remote_description);
- (void) define_variable ("MAKE_VERSION", 12, buf, o_default, 0);
+ define_variable_cname ("MAKE_VERSION", buf, o_default, 0);
#ifdef __MSDOS__
/* Allow to specify a special shell just for Make,
struct variable *mshp = lookup_variable ("MAKESHELL", 9);
struct variable *comp = lookup_variable ("COMSPEC", 7);
- /* Make $MAKESHELL override $SHELL even if -e is in effect. */
+ /* $(MAKESHELL) overrides $(SHELL) even if -e is in effect. */
if (mshp)
(void) define_variable (shell_str, shlen,
mshp->value, o_env_override, 0);
else if (comp)
{
- /* $COMSPEC shouldn't override $SHELL. */
+ /* $(COMSPEC) shouldn't override $(SHELL). */
struct variable *shp = lookup_variable (shell_str, shlen);
if (!shp)
/* This won't override any definition, but it will provide one if there
isn't one there. */
- v = define_variable ("SHELL", 5, default_shell, o_default, 0);
+ v = define_variable_cname ("SHELL", default_shell, o_default, 0);
#ifdef __MSDOS__
v->export = v_export; /* Export always SHELL. */
#endif
#endif
/* Make sure MAKEFILES gets exported if it is set. */
- v = define_variable ("MAKEFILES", 9, "", o_default, 0);
+ v = define_variable_cname ("MAKEFILES", "", o_default, 0);
v->export = v_ifset;
/* Define the magic D and F variables in terms of
the automatic variables they are variations of. */
#ifdef VMS
- define_variable ("@D", 2, "$(dir $@)", o_automatic, 1);
- define_variable ("%D", 2, "$(dir $%)", o_automatic, 1);
- define_variable ("*D", 2, "$(dir $*)", o_automatic, 1);
- define_variable ("<D", 2, "$(dir $<)", o_automatic, 1);
- define_variable ("?D", 2, "$(dir $?)", o_automatic, 1);
- define_variable ("^D", 2, "$(dir $^)", o_automatic, 1);
- define_variable ("+D", 2, "$(dir $+)", o_automatic, 1);
+ define_variable_cname ("@D", "$(dir $@)", o_automatic, 1);
+ define_variable_cname ("%D", "$(dir $%)", o_automatic, 1);
+ define_variable_cname ("*D", "$(dir $*)", o_automatic, 1);
+ define_variable_cname ("<D", "$(dir $<)", o_automatic, 1);
+ define_variable_cname ("?D", "$(dir $?)", o_automatic, 1);
+ define_variable_cname ("^D", "$(dir $^)", o_automatic, 1);
+ define_variable_cname ("+D", "$(dir $+)", o_automatic, 1);
#else
- define_variable ("@D", 2, "$(patsubst %/,%,$(dir $@))", o_automatic, 1);
- define_variable ("%D", 2, "$(patsubst %/,%,$(dir $%))", o_automatic, 1);
- define_variable ("*D", 2, "$(patsubst %/,%,$(dir $*))", o_automatic, 1);
- define_variable ("<D", 2, "$(patsubst %/,%,$(dir $<))", o_automatic, 1);
- define_variable ("?D", 2, "$(patsubst %/,%,$(dir $?))", o_automatic, 1);
- define_variable ("^D", 2, "$(patsubst %/,%,$(dir $^))", o_automatic, 1);
- define_variable ("+D", 2, "$(patsubst %/,%,$(dir $+))", o_automatic, 1);
+ define_variable_cname ("@D", "$(patsubst %/,%,$(dir $@))", o_automatic, 1);
+ define_variable_cname ("%D", "$(patsubst %/,%,$(dir $%))", o_automatic, 1);
+ define_variable_cname ("*D", "$(patsubst %/,%,$(dir $*))", o_automatic, 1);
+ define_variable_cname ("<D", "$(patsubst %/,%,$(dir $<))", o_automatic, 1);
+ define_variable_cname ("?D", "$(patsubst %/,%,$(dir $?))", o_automatic, 1);
+ define_variable_cname ("^D", "$(patsubst %/,%,$(dir $^))", o_automatic, 1);
+ define_variable_cname ("+D", "$(patsubst %/,%,$(dir $+))", o_automatic, 1);
#endif
- define_variable ("@F", 2, "$(notdir $@)", o_automatic, 1);
- define_variable ("%F", 2, "$(notdir $%)", o_automatic, 1);
- define_variable ("*F", 2, "$(notdir $*)", o_automatic, 1);
- define_variable ("<F", 2, "$(notdir $<)", o_automatic, 1);
- define_variable ("?F", 2, "$(notdir $?)", o_automatic, 1);
- define_variable ("^F", 2, "$(notdir $^)", o_automatic, 1);
- define_variable ("+F", 2, "$(notdir $+)", o_automatic, 1);
+ define_variable_cname ("@F", "$(notdir $@)", o_automatic, 1);
+ define_variable_cname ("%F", "$(notdir $%)", o_automatic, 1);
+ define_variable_cname ("*F", "$(notdir $*)", o_automatic, 1);
+ define_variable_cname ("<F", "$(notdir $<)", o_automatic, 1);
+ define_variable_cname ("?F", "$(notdir $?)", o_automatic, 1);
+ define_variable_cname ("^F", "$(notdir $^)", o_automatic, 1);
+ define_variable_cname ("+F", "$(notdir $+)", o_automatic, 1);
}
\f
int export_all_variables;