cosmetic renamings (glob() --> matchglob())
[k8jam.git] / src / jam.h
blob57ca9f99e73783aa5133cee84ad88b1044c11ac5
1 /*
2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6 /*
7 * jam.h - includes and globals for jam
9 * 04/08/94 (seiwald) - Coherent/386 support added.
10 * 04/21/94 (seiwald) - DGUX is __DGUX__, not just __DGUX.
11 * 05/04/94 (seiwald) - new globs.jobs (-j jobs)
12 * 11/01/94 (wingerd) - let us define path of Jambase at compile time.
13 * 12/30/94 (wingerd) - changed command buffer size for NT (MS-DOS shell).
14 * 02/22/95 (seiwald) - Jambase now in /usr/local/lib.
15 * 04/30/95 (seiwald) - FreeBSD added. Live Free or Die.
16 * 05/10/95 (seiwald) - SPLITPATH character set up here.
17 * 08/20/95 (seiwald) - added LINUX.
18 * 08/21/95 (seiwald) - added NCR.
19 * 10/23/95 (seiwald) - added SCO.
20 * 01/03/96 (seiwald) - SINIX (nixdorf) added.
21 * 03/13/96 (seiwald) - Jambase now compiled in; remove JAMBASE variable.
22 * 04/29/96 (seiwald) - AIX now has 31 and 42 OSVERs.
23 * 11/21/96 (peterk) - added BeOS with MW CW mwcc
24 * 12/21/96 (seiwald) - OSPLAT now defined for NT.
25 * 07/19/99 (sickel) - Mac OS X Server and Client support added
26 * 02/22/01 (seiwald) - downshift paths on case-insensitive macintosh
27 * 03/23/01 (seiwald) - VMS C++ changes.
28 * 10/29/01 (brett) - More IA64 ifdefs for MS.
29 * 02/18/00 (belmonte)- Support for Cygwin.
30 * 09/12/00 (seiwald) - OSSYMS split to OSMAJOR/OSMINOR/OSPLAT
31 * 12/29/00 (seiwald) - OSVER dropped.
32 * 01/21/02 (seiwald) - new -q to quit quickly on build failure
33 * 03/16/02 (seiwald) - support for -g (reorder builds by source time)
34 * 03/20/02 (seiwald) - MINGW porting from Max Blagai
35 * 08/16/02 (seiwald) - BEOS porting from Ingo Weinhold
36 * 09/19/02 (seiwald) - new -d displays
37 * 11/05/02 (seiwald) - OSPLAT now set to sparc on solaris.
39 #ifndef JAMH_MAIN_H
40 #define JAMH_MAIN_H
42 #if __GNUC__ > 2
43 # define JAMFA_PURE __attribute__((pure))
44 # define JAMFA_CONST __attribute__((const))
45 # define JAMFA_NORETURN __attribute__((noreturn))
46 # define JAMFA_PRINTF(m,n) __attribute__((format(printf, m, n)))
47 #else
48 # define JAMFA_PURE
49 # define JAMFA_CONST
50 # define JAMFA_NORETURN
51 # define JAMFA_PRINTF(m,n)
52 #endif
55 /* Windows NT */
56 #ifdef NT
57 # include <fcntl.h>
58 # include <stdlib.h>
59 # include <stdio.h>
60 # include <ctype.h>
61 # include <malloc.h>
62 # include <memory.h>
63 # include <signal.h>
64 # include <string.h>
65 # include <time.h>
66 # define OSMAJOR "NT=true"
67 # define OSMINOR "OS=NT"
68 # define OS_NT
69 # define SPLITPATH ';'
70 # define MAXLINE 2046 /* longest 'together' actions */
71 /*# define USE_EXECNT*/
72 # define PATH_DELIM '\\'
73 # define DOWNSHIFT_PATHS
74 #endif
77 /* Windows MingW32 */
78 #ifdef MINGW
79 # include <fcntl.h>
80 # include <stdlib.h>
81 # include <stdio.h>
82 # include <ctype.h>
83 # include <malloc.h>
84 # include <memory.h>
85 # include <signal.h>
86 # include <string.h>
87 # include <time.h>
88 # define OSMAJOR "MINGW=true"
89 # define OSMINOR "OS=MINGW"
90 # define OS_NT
91 # define SPLITPATH ';'
92 # define MAXLINE 996 /* longest 'together' actions */
93 # define PATH_DELIM '\\'
94 # define DOWNSHIFT_PATHS
95 #endif
98 /* God fearing UNIX */
99 #ifndef OSMINOR
100 # define OSMAJOR "UNIX=true"
101 # define USE_FILEUNIX
102 # define PATH_DELIM '/'
103 # ifdef __FreeBSD__
104 # define OSMINOR "OS=FREEBSD"
105 # define OS_FREEBSD
106 # endif
107 # ifdef linux
108 # define OSMINOR "OS=LINUX"
109 # define OS_LINUX
110 # endif
111 # ifdef __NetBSD__
112 # define unix
113 # define OSMINOR "OS=NETBSD"
114 # define OS_NETBSD
115 # define NO_VFORK
116 # endif
117 # ifdef __QNX__
118 # ifdef __QNXNTO__
119 # define OSMINOR "OS=QNXNTO"
120 # define OS_QNXNTO
121 # else
122 # define unix
123 # define OSMINOR "OS=QNX"
124 # define OS_QNX
125 # define NO_VFORK
126 # define MAXLINE 996
127 # endif
128 # endif
129 # ifdef __APPLE__
130 # define unix
131 # define OSMINOR "OS=MACOSX"
132 # define OS_MACOSX
133 # endif
134 # ifndef OSMINOR
135 # define OSMINOR "OS=UNKNOWN"
136 # endif
137 /* All the UNIX includes */
138 # include <sys/types.h>
139 # include <sys/stat.h>
140 # ifndef OS_MPEIX
141 # include <sys/file.h>
142 # endif
143 # include <fcntl.h>
144 # include <stdio.h>
145 # include <ctype.h>
146 # include <signal.h>
147 # include <string.h>
148 # include <time.h>
149 # ifndef OS_QNX
150 # include <memory.h>
151 # endif
152 # ifndef OS_ULTRIX
153 # include <stdlib.h>
154 # endif
155 # if !defined(OS_BSDI) && \
156 !defined(OS_FREEBSD) && \
157 !defined(OS_NEXT) && \
158 !defined(OS_MACHTEN) && \
159 !defined(OS_MACOSX) && \
160 !defined(OS_RHAPSODY) && \
161 !defined(OS_MVS)
162 # include <malloc.h>
163 # endif
164 # include <sys/types.h>
165 # include <sys/wait.h>
166 # include <unistd.h>
167 #endif
170 /* OSPLAT definitions - suppressed when it's a one-of-a-kind */
171 #if defined(_M_PPC) || \
172 defined(PPC) || \
173 defined(ppc) || \
174 defined(__powerpc__) || \
175 defined(__POWERPC__) || \
176 defined(__ppc__)
177 # define OSPLAT "OSPLAT=PPC"
178 #endif
180 #if defined(_i386_) || \
181 defined(__i386__) || \
182 defined(_M_IX86)
183 # if !defined(OS_FREEBSD) && \
184 !defined(OS_OS2)
185 # define OSPLAT "OSPLAT=X86"
186 # endif
187 #endif
189 #ifdef __sparc__
190 # if !defined( OS_SUNOS )
191 # define OSPLAT "OSPLAT=SPARC"
192 # endif
193 #endif
195 #ifdef __mips__
196 # if !defined( OS_SGI )
197 # define OSPLAT "OSPLAT=MIPS"
198 # endif
199 #endif
201 #ifdef __arm__
202 # define OSPLAT "OSPLAT=ARM"
203 #endif
205 #if defined(__ia64__) || defined(__IA64__) || defined(_M_IA64)
206 # define OSPLAT "OSPLAT=IA64"
207 #endif
209 #ifdef __s390__
210 # define OSPLAT "OSPLAT=390"
211 #endif
213 #ifndef OSPLAT
214 # define OSPLAT ""
215 #endif
218 /* Jam implementation misc. */
219 /* longest 'together' actions' */
220 #ifndef MAXLINE
221 # define MAXLINE (10240)
222 #endif
224 #ifndef EXITOK
225 # define EXITOK (0)
226 # define EXITBAD (1)
227 #endif
229 #ifndef SPLITPATH
230 # define SPLITPATH ':'
231 #endif
234 /* You probably don't need to muck with these. */
235 #define MAXSYM (1024) /* longest symbol in the environment */
236 #define MAXJPATH (1024) /* longest filename */
238 #define MAXJOBS (64) /* silently enforce -j limit */
239 #define MAXARGC (32) /* words in $(JAMSHELL) */
242 /* Jam private definitions below. */
243 #define DEBUG_MAX (15)
245 struct globs {
246 int noexec;
247 int jobs;
248 int quitquick;
249 int newestfirst; /* build newest sources first */
250 char debug[DEBUG_MAX];
251 FILE *cmdout; /* print cmds, not run them */
252 //#ifdef OPT_IMPROVED_PROGRESS_EXT
253 int updating; /* # targets we are updating */
254 void *progress; /* progress data (progress.h) */
255 //#endif
258 extern struct globs globs;
261 #define DEBUG_MAKE (globs.debug[1]) /* -da show actions when executed */
262 #define DEBUG_MAKEPROG (globs.debug[3]) /* -dm show progress of make0 */
264 #define DEBUG_EXECCMD (globs.debug[4]) /* show execcmds()'s work */
266 #define DEBUG_COMPILE (globs.debug[5]) /* show rule invocations */
268 #define DEBUG_HEADER (globs.debug[6]) /* show result of header scan */
269 #define DEBUG_BINDSCAN (globs.debug[6]) /* show result of dir scan */
270 #define DEBUG_SEARCH (globs.debug[6]) /* show attempts at binding */
272 #define DEBUG_VARSET (globs.debug[7]) /* show variable settings */
273 #define DEBUG_VARGET (globs.debug[8]) /* show variable fetches */
274 #define DEBUG_VAREXP (globs.debug[8]) /* show variable expansions */
275 #define DEBUG_IF (globs.debug[8]) /* show 'if' calculations */
276 #define DEBUG_LISTS (globs.debug[9]) /* show list manipulation */
277 #define DEBUG_SCAN (globs.debug[9]) /* show scanner tokens */
278 #define DEBUG_MEM (globs.debug[9]) /* show memory use */
280 #define DEBUG_MAKEQ (globs.debug[11]) /* -da show even quiet actions */
281 #define DEBUG_EXEC (globs.debug[12]) /* -dx show text of actions */
282 #define DEBUG_DEPENDS (globs.debug[13]) /* -dd show dependency graph */
283 #define DEBUG_CAUSES (globs.debug[14]) /* -dc show dependency graph */
286 #endif