1 /* RCS $Id: dmake.h,v 1.8 2007-10-15 15:38:34 ihi Exp $
4 -- Global defines for dmake.
7 -- All the interesting bits and flags that dmake uses are defined here.
10 -- Dennis Vadura, dvadura@dmake.wticorp.com
13 -- http://dmake.wticorp.com/
16 -- Copyright (c) 1996,1997 by WTI Corp. All rights reserved.
18 -- This program is NOT free software; you can redistribute it and/or
19 -- modify it under the terms of the Software License Agreement Provided
20 -- in the file <distribution-root>/readme/license.txt.
23 -- Use cvs log to obtain detailed change logs.
26 #ifndef _DMAKE_INCLUDED_
27 #define _DMAKE_INCLUDED_
29 #define MAX_INC_DEPTH 10 /* max of ten nested include files */
30 #define MAX_COND_DEPTH 20 /* max nesting level of conditionals */
31 #define ERROR_ABORT_VALUE 254 /* return code of aborted make */
32 #define ERROR_EXIT_VALUE 255 /* return code of failed make */
33 #define CONTINUATION_CHAR '\\' /* line continuation \<nl> */
34 #define DEF_ESCAPE_CHAR '\\' /* escape char for used chars */
35 #define ESCAPE_CHAR *Escape_char
36 #define COMMENT_CHAR '#' /* start of comment chars */
37 #define TGT_DEP_SEP ':' /* separator for targets and dependents */
38 #define CONDSTART '.' /* start of conditional token eg .IF */
39 #define DEF_MAKE_PNAME "dmake"/* default name to use as name of make */
42 /* ............... Hashing function constants ......................... */
43 #define HASH_TABLE_SIZE 200 /* See hash.c for description */
46 /* Bit flags for cells and macro definitions. */
47 #define M_DEFAULT 0x0000 /* default flag value */
48 #define M_MARK 0x0001 /* mark for circularity checks */
49 #define M_PRECIOUS 0x0002 /* keep macro, same as A_PRE... */
50 #define M_MULTI 0x0004 /* multiple redefinitions ok! */
51 #define M_EXPANDED 0x0008 /* macro has been assigned after
52 * being completely expanded */
53 #define M_USED 0x0010 /* macro has been used in the
54 * makefile. (From another macro
55 * or target definition.) */
56 #define M_LITERAL 0x0020 /* don't strip w/s on macro def */
57 #define M_NOEXPORT 0x0040 /* don't export macro for -x */
58 #define M_FORCE 0x0080 /* Force a macro redefinition */
59 #define M_PUSH 0x0100 /* Push previous macro defintn */
60 #define M_INIT 0x0200 /* Macro is defined initially or
61 * an empty macro implicitly
62 * defined when expanding it. */
63 #define M_VAR_BIT 0x1000 /* macro bit variable */
64 #define M_VAR_CHAR 0x2000 /* macro char variable */
65 #define M_VAR_STRING 0x4000 /* macro string variable */
66 #define M_VAR_INT 0x8000 /* macro integer variable */
68 #define M_VAR_MASK 0xf000 /* macro variable mask */
72 /* Global and target attribute flag definitions.
73 * If you change the values of these or re-order them make appropriate changes
74 * in dmdump.c so that the output of dmake -p matches the attribute info for a
77 #define A_DEFAULT 0x00000 /* default flag value */
78 #define A_PRECIOUS 0x00001 /* object is precious */
79 #define A_SILENT 0x00002 /* don't echo commands */
80 #define A_LIBRARY 0x00004 /* target is an archive */
81 #define A_EPILOG 0x00008 /* insert shell epilog code */
82 #define A_PROLOG 0x00010 /* insert shell prolog code */
83 #define A_IGNORE 0x00020 /* ignore errors */
84 #define A_SYMBOL 0x00040 /* lib member is a symbol */
85 #define A_NOINFER 0x00080 /* no trans closure from cell */
86 #define A_UPDATEALL 0x00100 /* all targets of rule modified */
87 #define A_SEQ 0x00200 /* sequential make attribute */
88 /* Reuse the sequential flag to signal Wait_for_completion to Do_cmnd()
89 * and related methods of executing a sub process. */
91 #define A_SETDIR 0x00400 /* cd to dir when making target */
92 #define A_SHELL 0x00800 /* run the recipe using a shell */
93 #define A_SWAP 0x01000 /* Use swap on MSDOS */
94 /* Reuse A_SWAP for the .WINPATH attribute to convert cygwin POSIX paths
95 * into DOS style paths. */
96 #define A_WINPATH 0x01000 /* Enable dos paths on cygwin */
97 #define A_MKSARGS 0x02000 /* use MKS argument swapping */
98 #define A_PHONY 0x04000 /* .PHONY attribute */
99 #define A_NOSTATE 0x08000 /* don't track state for me */
100 #define A_IGNOREGROUP 0x10000 /* Ignore group recipe */
101 #define A_EXECUTE 0x20000 /* execute this recipe under -n */
102 #define A_ERRREMOVE 0x40000 /* remove this target if error */
103 #define MAX_ATTR A_ERRREMOVE /* highest valid attribute */
104 #define A_LIBRARYM 0x80000 /* target is an archive member */
105 #define A_FRINGE 0x100000 /* cell is on the fringe */
106 #define A_COMPOSITE 0x200000 /* member of lib(targ) name */
107 #define A_FFNAME 0x400000 /* if set, free ce_fname in stat*/
108 #define A_UPDATED 0x800000 /* Used to mark cell as updated */
109 #define A_ROOT 0x01000000 /* True if it is a root prereq */
110 #define A_GROUP 0x02000000 /* True if rule is to be a group*/
111 #define A_WHATIF 0x04000000 /* used for WHATIF tests */
112 #define A_POOL 0x08000000 /* used for directory pool */
113 #define A_ERROR 0x10000000 /* used to halt construction */
114 #define A_FIRST 0x20000000 /* used for .INCLUDE termination*/
115 #define A_SHELLESC 0x40000000 /* used for shell escape target */
116 #define A_MUTE 0x80000000 /* silence a recipe line */
119 /* Global and target bit flag definitions */
121 #define F_DEFAULT 0x0000 /* default flag value */
122 #define F_MARK 0x0001 /* circularity check mark */
123 #define F_MULTI 0x0002 /* multiple rules for target */
124 #define F_SINGLE 0x0004 /* exec recipes for each out of
125 * date prerequisite (! ruleop) */
126 #define F_TARGET 0x0008 /* is set if a rule for a target exists.
127 * Prerequisites do not necessarily need
128 * to have a rule, in which case F_TARGET
130 #define F_RULES 0x0010 /* indicates target has rules */
131 #define F_GROUP 0x0020 /* indicates that rules are to */
132 /* fed to the shell as a group */
134 #define F_TRANS 0x0040 /* same as F_STAT not used tgthr*/
135 #define F_STAT 0x0040 /* target already stated */
136 #define F_VISITED 0x0080 /* Used for two different purposes:
137 make.c: Mark that a target is scheduled
139 rulparse.c: Detect circular
141 #define F_SPECIAL 0x0100 /* marks a special target */
142 #define F_DFA 0x0200 /* bit for marking added DFA */
143 #define F_EXPLICIT 0x0400 /* explicit target in makefile */
144 #define F_PERCENT 0x0800 /* marks a target as a % rule */
145 #define F_REMOVE 0x1000 /* marks an intermediate target */
146 #define F_MAGIC 0x2000 /* marks a magic target */
147 #define F_INFER 0x4000 /* target is result of inference*/
148 #define F_MADE 0x8000 /* target is currently made */
151 /* Definitions for the Parser states */
152 #define NORMAL_SCAN 0 /* normal processing state */
153 #define RULE_SCAN 1 /* scan of rule text */
155 /* definitions for macro operator types */
156 #define M_OP_EQ 1 /* macro operation is '=' 0000 0001 */
157 #define M_OP_CL 3 /* macro operation is ':=' 0000 0011 */
158 #define M_OP_PL 5 /* macro operation is '+=' 0000 0101 */
159 #define M_OP_DF 9 /* macro operation is '*=' 0000 1001 */
160 #define M_OP_PLCL 7 /* macro operation is '+:=' 0000 0111 */
161 #define M_OP_DFCL 11 /* macro operation is '*:=' 0000 1011 */
162 #define M_OP_CM 17 /* macro operation is '?=' 0001 0001 */
163 #define M_OP_SI 32 /* macro operation is '!' 0010 ---- */
165 /* definitions for rule operator types */
166 #define R_OP_CL 1 /* rule operation is ':' */
167 #define R_OP_DCL 2 /* rule operation is '::' */
168 #define R_OP_BG 4 /* rule operation is ':!' */
169 #define R_OP_UP 8 /* rule operation is ':^' */
170 #define R_OP_MI 16 /* rule operation is ':-' */
171 #define R_OP_OR 32 /* rule operation is ':|' */
173 /* definitions for modifier application in Apply_modifiers in expand.c */
174 #define SUFFIX_FLAG 1 /* defines for macro modifier code */
175 #define DIRECTORY_FLAG 2
177 #define WHOLENAME_FLAGS 7
178 #define TOLOWER_FLAG 8
179 #define TOUPPER_FLAG 16
180 #define INFNAME_FLAG 32
181 #define JUST_FIRST_FLAG 64
182 #define NORMPATH_FLAG 128
184 /* special target definitions for use inside dmake */
188 #define ST_REST 4 /* remaining special targets */
199 /* Flags for controling use of -v switch */
200 #define V_NOFLAG 0x00 /* V_NONE is used in MinGW w32api/oleauto.h */
201 #define V_LEAVE_TMP 0x01
202 #define V_DIR_SET 0x02
203 #define V_DIR_CACHE 0x04
206 #define V_FILE_IO 0x20
207 #define V_WARNALL 0x40
208 #define V_FORCEECHO 0x80
209 #define V_ALL (V_LEAVE_TMP | V_DIR_SET | V_INFER | V_MAKE |\
210 V_FILE_IO | V_DIR_CACHE | V_WARNALL | V_FORCEECHO)
212 /* Flags for controling use of -m switch */
213 #define M_NOFLAG 0x00
214 #define M_TARGET 0x01
215 #define M_RECIPE 0x02
216 #define M_ABSPATH 0x04
217 #define M_SHELLESC 0x08
218 #define M_ALL (M_TARGET | M_RECIPE | M_ABSPATH | M_SHELLESC)
220 /* Macro definitions for use inside dmake */
221 #define SET_TOKEN(A, B) (A)->tk_str = (B);\
222 (A)->tk_cchar = *(B);\
225 #define CLEAR_TOKEN(A) *(A)->tk_str = (A)->tk_cchar
226 #define GET_MACRO(A) Get_name(A, Macs, FALSE)
227 #define iswhite(C) ((C == ' ') || (C == '\t'))
228 #define STOBOOL(A) (A && ((*A | 0x20) == 'y'))