packaging: Initial packaging
[platform/upstream/make.git] / dep.h
1 /* Definitions of dependency data structures for GNU Make.
2 Copyright (C) 1988-2013 Free Software Foundation, Inc.
3 This file is part of GNU Make.
4
5 GNU Make is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3 of the License, or (at your option) any later
8 version.
9
10 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17 /* Flag bits for the second argument to 'read_makefile'.
18    These flags are saved in the 'changed' field of each
19    'struct dep' in the chain returned by 'read_all_makefiles'.  */
20
21 #define RM_NO_DEFAULT_GOAL      (1 << 0) /* Do not set default goal.  */
22 #define RM_INCLUDED             (1 << 1) /* Search makefile search path.  */
23 #define RM_DONTCARE             (1 << 2) /* No error if it doesn't exist.  */
24 #define RM_NO_TILDE             (1 << 3) /* Don't expand ~ in file name.  */
25 #define RM_NOFLAG               0
26
27 /* Structure representing one dependency of a file.
28    Each struct file's 'deps' points to a chain of these,
29    chained through the 'next'. 'stem' is the stem for this
30    dep line of static pattern rule or NULL.
31
32    Note that the first two words of this match a struct nameseq.  */
33
34 struct dep
35   {
36     struct dep *next;
37     const char *name;
38     const char *stem;
39     struct file *file;
40     unsigned int changed : 8;
41     unsigned int ignore_mtime : 1;
42     unsigned int staticpattern : 1;
43     unsigned int need_2nd_expansion : 1;
44     unsigned int dontcare : 1;
45   };
46
47
48 /* Structure used in chains of names, for parsing and globbing.  */
49
50 struct nameseq
51   {
52     struct nameseq *next;
53     const char *name;
54   };
55
56 #define PARSEFS_NONE    0x0000
57 #define PARSEFS_NOSTRIP 0x0001
58 #define PARSEFS_NOAR    0x0002
59 #define PARSEFS_NOGLOB  0x0004
60 #define PARSEFS_EXISTS  0x0008
61 #define PARSEFS_NOCACHE 0x0010
62
63 #define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
64             (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
65 #define PARSE_SIMPLE_SEQ(_s,_t) \
66             (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE)
67
68 #ifdef VMS
69 void *parse_file_seq ();
70 #else
71 void *parse_file_seq (char **stringp, unsigned int size,
72                       int stopmap, const char *prefix, int flags);
73 #endif
74
75 char *tilde_expand (const char *name);
76
77 #ifndef NO_ARCHIVES
78 struct nameseq *ar_glob (const char *arname, const char *member_pattern, unsigned int size);
79 #endif
80
81 #define dep_name(d)     ((d)->name == 0 ? (d)->file->name : (d)->name)
82
83 #define alloc_dep()     (xcalloc (sizeof (struct dep)))
84 #define free_ns(_n)     free (_n)
85 #define free_dep(_d)    free_ns (_d)
86
87 struct dep *copy_dep_chain (const struct dep *d);
88 void free_dep_chain (struct dep *d);
89 void free_ns_chain (struct nameseq *n);
90 struct dep *read_all_makefiles (const char **makefiles);
91 void eval_buffer (char *buffer, const gmk_floc *floc);
92 enum update_status update_goal_chain (struct dep *goals);