1 | /* Definitions of dependency data structures for GNU Make.
|
---|
2 | Copyright (C) 1988-2016 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 |
|
---|
18 | /* Structure used in chains of names, for parsing and globbing. */
|
---|
19 |
|
---|
20 | #define NAMESEQ(_t) \
|
---|
21 | _t *next; \
|
---|
22 | const char *name
|
---|
23 |
|
---|
24 | struct nameseq
|
---|
25 | {
|
---|
26 | NAMESEQ (struct nameseq);
|
---|
27 | };
|
---|
28 |
|
---|
29 | /* Flag bits for the second argument to 'read_makefile'.
|
---|
30 | These flags are saved in the 'flags' field of each
|
---|
31 | 'struct goaldep' in the chain returned by 'read_all_makefiles'. */
|
---|
32 |
|
---|
33 | #define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */
|
---|
34 | #define RM_INCLUDED (1 << 1) /* Search makefile search path. */
|
---|
35 | #define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */
|
---|
36 | #define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */
|
---|
37 | #define RM_NOFLAG 0
|
---|
38 |
|
---|
39 | /* Structure representing one dependency of a file.
|
---|
40 | Each struct file's 'deps' points to a chain of these, through 'next'.
|
---|
41 | 'stem' is the stem for this dep line of static pattern rule or NULL. */
|
---|
42 |
|
---|
43 | #define DEP(_t) \
|
---|
44 | NAMESEQ (_t); \
|
---|
45 | struct file *file; \
|
---|
46 | const char *stem; \
|
---|
47 | unsigned short flags : 8; \
|
---|
48 | unsigned short changed : 1; \
|
---|
49 | unsigned short ignore_mtime : 1; \
|
---|
50 | unsigned short staticpattern : 1; \
|
---|
51 | unsigned short need_2nd_expansion : 1
|
---|
52 |
|
---|
53 | struct dep
|
---|
54 | {
|
---|
55 | DEP (struct dep);
|
---|
56 | };
|
---|
57 |
|
---|
58 | /* Structure representing one goal.
|
---|
59 | The goals to be built constitute a chain of these, chained through 'next'.
|
---|
60 | 'stem' is not used, but it's simpler to include and ignore it. */
|
---|
61 |
|
---|
62 | struct goaldep
|
---|
63 | {
|
---|
64 | DEP (struct goaldep);
|
---|
65 | unsigned short error;
|
---|
66 | floc floc;
|
---|
67 | };
|
---|
68 |
|
---|
69 | /* Options for parsing lists of filenames. */
|
---|
70 |
|
---|
71 | #define PARSEFS_NONE 0x0000
|
---|
72 | #define PARSEFS_NOSTRIP 0x0001
|
---|
73 | #define PARSEFS_NOAR 0x0002
|
---|
74 | #define PARSEFS_NOGLOB 0x0004
|
---|
75 | #define PARSEFS_EXISTS 0x0008
|
---|
76 | #define PARSEFS_NOCACHE 0x0010
|
---|
77 |
|
---|
78 | #define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
|
---|
79 | (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
|
---|
80 | #define PARSE_SIMPLE_SEQ(_s,_t) \
|
---|
81 | (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE)
|
---|
82 |
|
---|
83 | #ifdef VMS
|
---|
84 | void *parse_file_seq ();
|
---|
85 | #else
|
---|
86 | void *parse_file_seq (char **stringp, unsigned int size,
|
---|
87 | int stopmap, const char *prefix, int flags);
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | char *tilde_expand (const char *name);
|
---|
91 |
|
---|
92 | #ifndef NO_ARCHIVES
|
---|
93 | struct nameseq *ar_glob (const char *arname, const char *member_pattern, unsigned int size);
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
|
---|
97 |
|
---|
98 | #define alloc_seq_elt(_t) xcalloc (sizeof (_t))
|
---|
99 | void free_ns_chain (struct nameseq *n);
|
---|
100 |
|
---|
101 | #if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__)
|
---|
102 | /* Use inline to get real type-checking. */
|
---|
103 | #define SI static inline
|
---|
104 | SI struct nameseq *alloc_ns() { return alloc_seq_elt (struct nameseq); }
|
---|
105 | SI struct dep *alloc_dep() { return alloc_seq_elt (struct dep); }
|
---|
106 | SI struct goaldep *alloc_goaldep() { return alloc_seq_elt (struct goaldep); }
|
---|
107 |
|
---|
108 | SI void free_ns(struct nameseq *n) { free (n); }
|
---|
109 | SI void free_dep(struct dep *d) { free_ns ((struct nameseq *)d); }
|
---|
110 | SI void free_goaldep(struct goaldep *g) { free_dep ((struct dep *)g); }
|
---|
111 |
|
---|
112 | SI void free_dep_chain(struct dep *d) { free_ns_chain((struct nameseq *)d); }
|
---|
113 | SI void free_goal_chain(struct goaldep *g) { free_dep_chain((struct dep *)g); }
|
---|
114 | #else
|
---|
115 | # define alloc_ns() alloc_seq_elt (struct nameseq)
|
---|
116 | # define alloc_dep() alloc_seq_elt (struct dep)
|
---|
117 | # define alloc_goaldep() alloc_seq_elt (struct goaldep)
|
---|
118 |
|
---|
119 | # define free_ns(_n) free (_n)
|
---|
120 | # define free_dep(_d) free_ns (_d)
|
---|
121 | # define free_goaldep(_g) free_dep (_g)
|
---|
122 |
|
---|
123 | # define free_dep_chain(_d) free_ns_chain ((struct nameseq *)(_d))
|
---|
124 | # define free_goal_chain(_g) free_ns_chain ((struct nameseq *)(_g))
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | struct dep *copy_dep_chain (const struct dep *d);
|
---|
128 |
|
---|
129 | struct goaldep *read_all_makefiles (const char **makefiles);
|
---|
130 | void eval_buffer (char *buffer, const floc *floc);
|
---|
131 | enum update_status update_goal_chain (struct goaldep *goals);
|
---|