*** empty log message ***
[make.git] / variable.h
bloba0c79de207608fd2a431e0c946f640725aa1225a
1 /* Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
2 This file is part of GNU Make.
4 GNU Make is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 GNU Make is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with GNU Make; see the file COPYING. If not, write to
16 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
18 /* Codes in a variable definition saying where the definition came from.
19 Increasing numeric values signify less-overridable definitions. */
20 enum variable_origin
22 o_default, /* Variable from the default set. */
23 o_env, /* Variable from environment. */
24 o_file, /* Variable given in a makefile. */
25 o_env_override, /* Variable from environment, if -e. */
26 o_command, /* Variable given by user. */
27 o_override, /* Variable from an `override' directive. */
28 o_automatic, /* Automatic variable -- cannot be set. */
29 o_invalid /* Core dump time. */
32 /* Structure that represents one variable definition.
33 Each bucket of the hash table is a chain of these,
34 chained through `next'. */
36 struct variable
38 struct variable *next; /* Link in the chain. */
39 char *name; /* Variable name. */
40 char *value; /* Variable value. */
41 enum variable_origin
42 origin ENUM_BITFIELD (3); /* Variable origin. */
43 unsigned int recursive:1; /* Gets recursively re-evaluated. */
44 unsigned int expanding:1; /* Nonzero if currently being expanded. */
45 enum
47 v_export, /* Export this variable. */
48 v_noexport, /* Don't export this variable. */
49 v_ifset, /* Export it if it has a non-default value. */
50 v_default /* Decide in target_environment. */
51 } export ENUM_BITFIELD (2);
54 /* Structure that represents a variable set. */
56 struct variable_set
58 struct variable **table; /* Hash table of variables. */
59 unsigned int buckets; /* Number of hash buckets in `table'. */
62 /* Structure that represents a list of variable sets. */
64 struct variable_set_list
66 struct variable_set_list *next; /* Link in the chain. */
67 struct variable_set *set; /* Variable set. */
70 extern struct variable_set_list *current_variable_set_list;
73 extern void push_new_variable_scope (), pop_variable_scope ();
75 extern int handle_function ();
77 extern char *variable_buffer_output ();
78 extern char *variable_expand (), *variable_expand_for_file ();
79 extern char *allocated_variable_expand_for_file ();
80 #define allocated_variable_expand(line) \
81 allocated_variable_expand_for_file (line, (struct file *) 0)
82 extern char *expand_argument ();
84 extern void define_automatic_variables ();
85 extern void initialize_file_variables ();
86 extern void print_file_variables ();
88 extern void merge_variable_set_lists ();
90 extern struct variable *try_variable_definition ();
92 extern struct variable *lookup_variable (), *define_variable ();
93 extern struct variable *define_variable_for_file ();
95 extern int pattern_matches ();
96 extern char *subst_expand (), *patsubst_expand (), *recursively_expand ();
98 extern char **target_environment ();
99 extern int export_all_variables;