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