X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=variable.h;h=dec75b1c584732c8cf21e83a710df802b9186f33;hb=e15597c3e85dedc015ff923a88febd46a1551f71;hp=c2158672eee38dee85395dbe57dea03470590668;hpb=9789b4dba120180760ec948089fc98ebab6eb28b;p=platform%2Fupstream%2Fmake.git diff --git a/variable.h b/variable.h index c215867..dec75b1 100644 --- a/variable.h +++ b/variable.h @@ -1,7 +1,5 @@ /* Definitions for using variables in GNU Make. -Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, -1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, -2010 Free Software Foundation, Inc. +Copyright (C) 1988-2013 Free Software Foundation, Inc. This file is part of GNU Make. GNU Make is free software; you can redistribute it and/or modify it under the @@ -22,62 +20,63 @@ this program. If not, see . */ Increasing numeric values signify less-overridable definitions. */ enum variable_origin { - o_default, /* Variable from the default set. */ - o_env, /* Variable from environment. */ - o_file, /* Variable given in a makefile. */ - o_env_override, /* Variable from environment, if -e. */ - o_command, /* Variable given by user. */ - o_override, /* Variable from an `override' directive. */ - o_automatic, /* Automatic variable -- cannot be set. */ - o_invalid /* Core dump time. */ + o_default, /* Variable from the default set. */ + o_env, /* Variable from environment. */ + o_file, /* Variable given in a makefile. */ + o_env_override, /* Variable from environment, if -e. */ + o_command, /* Variable given by user. */ + o_override, /* Variable from an 'override' directive. */ + o_automatic, /* Automatic variable -- cannot be set. */ + o_invalid /* Core dump time. */ }; enum variable_flavor { f_bogus, /* Bogus (error) */ - f_simple, /* Simple definition (:=) */ + f_simple, /* Simple definition (:= or ::=) */ f_recursive, /* Recursive definition (=) */ f_append, /* Appending definition (+=) */ - f_conditional /* Conditional definition (?=) */ + f_conditional, /* Conditional definition (?=) */ + f_shell /* Shell assignment (!=) */ }; /* Structure that represents one variable definition. Each bucket of the hash table is a chain of these, - chained through `next'. */ + chained through 'next'. */ #define EXP_COUNT_BITS 15 /* This gets all the bitfields into 32 bits */ #define EXP_COUNT_MAX ((1<1, allow this many self-referential expansions. */ enum variable_flavor - flavor ENUM_BITFIELD (3); /* Variable flavor. */ + flavor ENUM_BITFIELD (3); /* Variable flavor. */ enum variable_origin - origin ENUM_BITFIELD (3); /* Variable origin. */ + origin ENUM_BITFIELD (3); /* Variable origin. */ enum variable_export { - v_export, /* Export this variable. */ - v_noexport, /* Don't export this variable. */ - v_ifset, /* Export it if it has a non-default value. */ - v_default /* Decide in target_environment. */ + v_export, /* Export this variable. */ + v_noexport, /* Don't export this variable. */ + v_ifset, /* Export it if it has a non-default value. */ + v_default /* Decide in target_environment. */ } export ENUM_BITFIELD (2); }; @@ -85,15 +84,15 @@ struct variable struct variable_set { - struct hash_table table; /* Hash table of variables. */ + struct hash_table table; /* Hash table of variables. */ }; /* Structure that represents a list of variable sets. */ struct variable_set_list { - struct variable_set_list *next; /* Link in the chain. */ - struct variable_set *set; /* Variable set. */ + struct variable_set_list *next; /* Link in the chain. */ + struct variable_set *set; /* Variable set. */ int next_is_parent; /* True if next is a parent target. */ }; @@ -117,7 +116,7 @@ char *variable_buffer_output (char *ptr, const char *string, unsigned int length char *variable_expand (const char *line); char *variable_expand_for_file (const char *line, struct file *file); char *allocated_variable_expand_for_file (const char *line, struct file *file); -#define allocated_variable_expand(line) \ +#define allocated_variable_expand(line) \ allocated_variable_expand_for_file (line, (struct file *) 0) char *expand_argument (const char *str, const char *end); char *variable_expand_string (char *line, const char *string, long length); @@ -134,6 +133,8 @@ char *patsubst_expand_pat (char *o, const char *text, const char *pattern, const char *replace, const char *pattern_percent, const char *replace_percent); char *patsubst_expand (char *o, const char *text, char *pattern, char *replace); +char *func_shell_base (char *o, char **argv, int trim_newlines); + /* expand.c */ char *recursively_expand_for_file (struct variable *v, struct file *file); @@ -147,22 +148,26 @@ void pop_variable_scope (void); void define_automatic_variables (void); void initialize_file_variables (struct file *file, int reading); void print_file_variables (const struct file *file); -void print_variable_set (struct variable_set *set, char *prefix); +void print_file_variables (const struct file *file); +void print_target_variables (const struct file *file); void merge_variable_set_lists (struct variable_set_list **to_list, struct variable_set_list *from_list); -struct variable *do_variable_definition (const struct floc *flocp, +struct variable *do_variable_definition (const gmk_floc *flocp, const char *name, const char *value, enum variable_origin origin, enum variable_flavor flavor, int target_var); char *parse_variable_definition (const char *line, - enum variable_flavor *flavor); + struct variable *v); struct variable *assign_variable_definition (struct variable *v, char *line); -struct variable *try_variable_definition (const struct floc *flocp, char *line, +struct variable *try_variable_definition (const gmk_floc *flocp, char *line, enum variable_origin origin, int target_var); void init_hash_global_variable_set (void); void hash_init_function_table (void); +void define_new_function(const gmk_floc *flocp, const char *name, + unsigned int min, unsigned int max, unsigned int flags, + gmk_func_ptr func); struct variable *lookup_variable (const char *name, unsigned int length); struct variable *lookup_variable_in_set (const char *name, unsigned int length, const struct variable_set *set); @@ -172,7 +177,7 @@ struct variable *define_variable_in_set (const char *name, unsigned int length, enum variable_origin origin, int recursive, struct variable_set *set, - const struct floc *flocp); + const gmk_floc *flocp); /* Define a variable in the current variable set. */ @@ -216,7 +221,7 @@ void undefine_variable_in_set (const char *name, unsigned int length, #define warn_undefined(n,l) do{\ if (warn_undefined_variables_flag) \ error (reading_file, \ - _("warning: undefined variable `%.*s'"), \ + _("warning: undefined variable '%.*s'"), \ (int)(l), (n)); \ }while(0) @@ -228,4 +233,4 @@ struct pattern_var *create_pattern_var (const char *target, extern int export_all_variables; #define MAKELEVEL_NAME "MAKELEVEL" -#define MAKELEVEL_LENGTH (sizeof (MAKELEVEL_NAME) - 1) +#define MAKELEVEL_LENGTH (CSTRLEN (MAKELEVEL_NAME))