Changeset 3140 in kBuild for trunk/src/kmk/dep.h
- Timestamp:
- Mar 14, 2018 9:28:10 PM (7 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
-
Property svn:mergeinfo
set to
/vendor/gnumake/current merged eligible
-
Property svn:mergeinfo
set to
-
trunk/src/kmk/dep.h
r2591 r3140 1 1 /* Definitions of dependency data structures for GNU Make. 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 2 Copyright (C) 1988-2016 Free Software Foundation, Inc. 5 3 This file is part of GNU Make. 6 4 … … 17 15 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 16 19 /* Flag bits for the second argument to `read_makefile'.20 These flags are saved in the `changed' field of each21 `struct dep' in the chain returned by `read_all_makefiles'. */22 17 23 #define RM_NO_DEFAULT_GOAL (1 << 0) /* Do not set default goal. */ 24 #define RM_INCLUDED (1 << 1) /* Search makefile search path. */ 25 #define RM_DONTCARE (1 << 2) /* No error if it doesn't exist. */ 26 #define RM_NO_TILDE (1 << 3) /* Don't expand ~ in file name. */ 27 #define RM_NOFLAG 0 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 28 38 29 39 /* Structure representing one dependency of a file. 30 Each struct file's `deps' points to a chain of these, 31 chained through the `next'. `stem' is the stem for this 32 dep line of static pattern rule or NULL. 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. */ 33 42 34 Note that the first two words of this match a struct nameseq. */ 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 35 65 36 66 struct dep 37 67 { 38 struct dep *next; 39 const char *name; 40 const char *stem; 41 struct file *file; 42 unsigned int changed : 8; 43 unsigned int ignore_mtime : 1; 44 unsigned int staticpattern : 1; 45 unsigned int need_2nd_expansion : 1; 46 unsigned int dontcare : 1; 47 48 #ifdef CONFIG_WITH_INCLUDEDEP 49 unsigned int includedep : 1; 50 #endif 68 DEP (struct dep); 51 69 }; 52 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. */ 53 74 54 /* Structure used in chains of names, for parsing and globbing. */ 55 56 struct nameseq 75 struct goaldep 57 76 { 58 struct nameseq *next; 59 const char *name; 77 DEP (struct goaldep); 78 unsigned short error; 79 floc floc; 60 80 }; 61 81 82 /* Options for parsing lists of filenames. */ 62 83 63 #define PARSEFS_NONE (0x0000)64 #define PARSEFS_NOSTRIP (0x0001)65 #define PARSEFS_NOAR (0x0002)66 #define PARSEFS_NOGLOB (0x0004)67 #define PARSEFS_EXISTS (0x0008)68 #define PARSEFS_NOCACHE (0x0010)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 69 90 70 91 #ifndef CONFIG_WITH_ALLOC_CACHES 71 92 #define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \ 72 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) 73 96 #else 74 97 # define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \ 75 98 (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f), \ 76 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) 77 103 # define PARSE_FILE_SEQ_IGNORE_struct 78 104 #endif 105 79 106 80 107 #ifdef VMS … … 82 109 #else 83 110 void *parse_file_seq (char **stringp, unsigned int size, 84 int stop char, const char *prefix, int flags111 int stopmap, const char *prefix, int flags 85 112 IF_WITH_ALLOC_CACHES_PARAM(struct alloccache *cache)); 86 113 #endif … … 92 119 #endif 93 120 94 #define dep_name(d) ((d)->name == 0 ? (d)->file->name : (d)->name) 95 121 #define dep_name(d) ((d)->name ? (d)->name : (d)->file->name) 96 122 97 123 #ifndef CONFIG_WITH_ALLOC_CACHES 98 #define alloc_dep() (xcalloc (sizeof (struct dep))) 99 #define free_ns(_n) free (_n) 100 #define free_dep(_d) free_ns (_d) 124 125 #define alloc_seq_elt(_t) xcalloc (sizeof (_t)) 126 void 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 131 SI struct nameseq *alloc_ns() { return alloc_seq_elt (struct nameseq); } 132 SI struct dep *alloc_dep() { return alloc_seq_elt (struct dep); } 133 SI struct goaldep *alloc_goaldep() { return alloc_seq_elt (struct goaldep); } 134 135 SI void free_ns(struct nameseq *n) { free (n); } 136 SI void free_dep(struct dep *d) { free_ns ((struct nameseq *)d); } 137 SI void free_goaldep(struct goaldep *g) { free_dep ((struct dep *)g); } 138 139 SI void free_dep_chain(struct dep *d) { free_ns_chain((struct nameseq *)d); } 140 SI void free_goal_chain(struct goaldep *g) { free_dep_chain((struct dep *)g); } 101 141 #else 102 #define alloc_dep() alloccache_calloc (&dep_cache) 103 #define free_ns(_n) alloccache_free (&nameseq_cache, _n) 104 #define free_dep(_d) alloccache_free (&dep_cache, _d) 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)) 105 152 #endif 106 153 154 #else /* CONFIG_WITH_ALLOC_CACHES */ 155 156 # include <k/kDefs.h> 157 158 K_INLINE struct nameseq *alloc_ns (void) { return (struct nameseq *)alloccache_calloc (&nameseq_cache); } 159 K_INLINE void free_ns (struct nameseq *n) { alloccache_free (&nameseq_cache, n); } 160 void free_ns_chain (struct nameseq *n); 161 162 K_INLINE struct dep *alloc_dep (void) { return (struct dep *)alloccache_calloc (&dep_cache); } 163 K_INLINE void free_dep (struct dep *d) { alloccache_free (&dep_cache, d); } 164 void free_dep_chain (struct dep *d); 165 166 K_INLINE struct goaldep *alloc_goaldep (void) { return (struct goaldep *)alloccache_calloc (&goaldep_cache); } 167 K_INLINE void free_goaldep (struct goaldep *g) { alloccache_free (&goaldep_cache, g); } 168 void free_goal_chain (struct goaldep *g); 169 170 #endif /* CONFIG_WITH_ALLOC_CACHES */ 171 107 172 struct dep *copy_dep_chain (const struct dep *d); 108 void free_dep_chain (struct dep *d); 109 void free_ns_chain (struct nameseq *n); 110 struct dep *read_all_makefiles (const char **makefiles); 111 void eval_buffer (char *buffer IF_WITH_VALUE_LENGTH(COMMA char *eos)); 112 int update_goal_chain (struct dep *goals); 173 174 struct goaldep *read_all_makefiles (const char **makefiles); 175 void eval_buffer (char *buffer, const floc *floc IF_WITH_VALUE_LENGTH(COMMA char *eos)); 176 enum update_status update_goal_chain (struct goaldep *goals); 113 177 114 178 #ifdef CONFIG_WITH_INCLUDEDEP 115 179 /* incdep.c */ 116 180 enum incdep_op { incdep_read_it, incdep_queue, incdep_flush }; 117 void eval_include_dep (const char *name, structfloc *f, enum incdep_op op);181 void eval_include_dep (const char *name, floc *f, enum incdep_op op); 118 182 void incdep_flush_and_term (void); 119 183 #endif
Note:
See TracChangeset
for help on using the changeset viewer.