VirtualBox

source: kBuild/trunk/src/kmk/dep.h@ 3387

Last change on this file since 3387 was 3140, checked in by bird, 6 years ago

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

  • Property svn:eol-style set to native
File size: 6.8 KB
Line 
1/* Definitions of dependency data structures for GNU Make.
2Copyright (C) 1988-2016 Free Software Foundation, Inc.
3This file is part of GNU Make.
4
5GNU Make is free software; you can redistribute it and/or modify it under the
6terms of the GNU General Public License as published by the Free Software
7Foundation; either version 3 of the License, or (at your option) any later
8version.
9
10GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
11WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License along with
15this 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
24struct 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#ifndef CONFIG_WITH_INCLUDEDEP
44#define DEP(_t) \
45 NAMESEQ (_t); \
46 struct file *file; \
47 const char *stem; \
48 unsigned short flags : 8; \
49 unsigned short changed : 1; \
50 unsigned short ignore_mtime : 1; \
51 unsigned short staticpattern : 1; \
52 unsigned short need_2nd_expansion : 1
53#else
54# define DEP(_t) \
55 NAMESEQ (_t); \
56 struct file *file; \
57 const char *stem; \
58 unsigned short flags : 8; \
59 unsigned short changed : 1; \
60 unsigned short ignore_mtime : 1; \
61 unsigned short staticpattern : 1; \
62 unsigned short need_2nd_expansion : 1; \
63 unsigned short includedep : 1
64#endif
65
66struct dep
67 {
68 DEP (struct dep);
69 };
70
71/* Structure representing one goal.
72 The goals to be built constitute a chain of these, chained through 'next'.
73 'stem' is not used, but it's simpler to include and ignore it. */
74
75struct goaldep
76 {
77 DEP (struct goaldep);
78 unsigned short error;
79 floc floc;
80 };
81
82/* Options for parsing lists of filenames. */
83
84#define PARSEFS_NONE 0x0000
85#define PARSEFS_NOSTRIP 0x0001
86#define PARSEFS_NOAR 0x0002
87#define PARSEFS_NOGLOB 0x0004
88#define PARSEFS_EXISTS 0x0008
89#define PARSEFS_NOCACHE 0x0010
90
91#ifndef CONFIG_WITH_ALLOC_CACHES
92#define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
93 (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
94#define PARSE_SIMPLE_SEQ(_s,_t) \
95 (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE)
96#else
97# define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
98 (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f), \
99 &PARSE_FILE_SEQ_IGNORE_ ## _t ## _cache)
100# define PARSE_SIMPLE_SEQ(_s,_t) \
101 (_t *)parse_file_seq ((_s),sizeof (_t),MAP_NUL,NULL,PARSEFS_NONE, \
102 &PARSE_FILE_SEQ_IGNORE_ ## _t ## _cache)
103# define PARSE_FILE_SEQ_IGNORE_struct
104#endif
105
106
107#ifdef VMS
108void *parse_file_seq ();
109#else
110void *parse_file_seq (char **stringp, unsigned int size,
111 int stopmap, const char *prefix, int flags
112 IF_WITH_ALLOC_CACHES_PARAM(struct alloccache *cache));
113#endif
114
115char *tilde_expand (const char *name);
116
117#ifndef NO_ARCHIVES
118struct nameseq *ar_glob (const char *arname, const char *member_pattern, unsigned int size);
119#endif
120
121#define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
122
123#ifndef CONFIG_WITH_ALLOC_CACHES
124
125#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
126void free_ns_chain (struct nameseq *n);
127
128#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__)
129/* Use inline to get real type-checking. */
130#define SI static inline
131SI struct nameseq *alloc_ns() { return alloc_seq_elt (struct nameseq); }
132SI struct dep *alloc_dep() { return alloc_seq_elt (struct dep); }
133SI struct goaldep *alloc_goaldep() { return alloc_seq_elt (struct goaldep); }
134
135SI void free_ns(struct nameseq *n) { free (n); }
136SI void free_dep(struct dep *d) { free_ns ((struct nameseq *)d); }
137SI void free_goaldep(struct goaldep *g) { free_dep ((struct dep *)g); }
138
139SI void free_dep_chain(struct dep *d) { free_ns_chain((struct nameseq *)d); }
140SI void free_goal_chain(struct goaldep *g) { free_dep_chain((struct dep *)g); }
141#else
142# define alloc_ns() alloc_seq_elt (struct nameseq)
143# define alloc_dep() alloc_seq_elt (struct dep)
144# define alloc_goaldep() alloc_seq_elt (struct goaldep)
145
146# define free_ns(_n) free (_n)
147# define free_dep(_d) free_ns (_d)
148# define free_goaldep(_g) free_dep (_g)
149
150# define free_dep_chain(_d) free_ns_chain ((struct nameseq *)(_d))
151# define free_goal_chain(_g) free_ns_chain ((struct nameseq *)(_g))
152#endif
153
154#else /* CONFIG_WITH_ALLOC_CACHES */
155
156# include <k/kDefs.h>
157
158K_INLINE struct nameseq *alloc_ns (void) { return (struct nameseq *)alloccache_calloc (&nameseq_cache); }
159K_INLINE void free_ns (struct nameseq *n) { alloccache_free (&nameseq_cache, n); }
160void free_ns_chain (struct nameseq *n);
161
162K_INLINE struct dep *alloc_dep (void) { return (struct dep *)alloccache_calloc (&dep_cache); }
163K_INLINE void free_dep (struct dep *d) { alloccache_free (&dep_cache, d); }
164void free_dep_chain (struct dep *d);
165
166K_INLINE struct goaldep *alloc_goaldep (void) { return (struct goaldep *)alloccache_calloc (&goaldep_cache); }
167K_INLINE void free_goaldep (struct goaldep *g) { alloccache_free (&goaldep_cache, g); }
168void free_goal_chain (struct goaldep *g);
169
170#endif /* CONFIG_WITH_ALLOC_CACHES */
171
172struct dep *copy_dep_chain (const struct dep *d);
173
174struct goaldep *read_all_makefiles (const char **makefiles);
175void eval_buffer (char *buffer, const floc *floc IF_WITH_VALUE_LENGTH(COMMA char *eos));
176enum update_status update_goal_chain (struct goaldep *goals);
177
178#ifdef CONFIG_WITH_INCLUDEDEP
179/* incdep.c */
180enum incdep_op { incdep_read_it, incdep_queue, incdep_flush };
181void eval_include_dep (const char *name, floc *f, enum incdep_op op);
182void incdep_flush_and_term (void);
183#endif
184
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use