added non-working 'SEMAPHORE'
[k8jam.git] / jam.h
blob18511200957aad73b27357dd039930c126d9b4b2
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 */
7 /*
8 * jam.h - includes and globals for jam
10 * 04/08/94 (seiwald) - Coherent/386 support added.
11 * 04/21/94 (seiwald) - DGUX is __DGUX__, not just __DGUX.
12 * 05/04/94 (seiwald) - new globs.jobs (-j jobs)
13 * 11/01/94 (wingerd) - let us define path of Jambase at compile time.
14 * 12/30/94 (wingerd) - changed command buffer size for NT (MS-DOS shell).
15 * 02/22/95 (seiwald) - Jambase now in /usr/local/lib.
16 * 04/30/95 (seiwald) - FreeBSD added. Live Free or Die.
17 * 05/10/95 (seiwald) - SPLITPATH character set up here.
18 * 08/20/95 (seiwald) - added LINUX.
19 * 08/21/95 (seiwald) - added NCR.
20 * 10/23/95 (seiwald) - added SCO.
21 * 01/03/96 (seiwald) - SINIX (nixdorf) added.
22 * 03/13/96 (seiwald) - Jambase now compiled in; remove JAMBASE variable.
23 * 04/29/96 (seiwald) - AIX now has 31 and 42 OSVERs.
24 * 11/21/96 (peterk) - added BeOS with MW CW mwcc
25 * 12/21/96 (seiwald) - OSPLAT now defined for NT.
26 * 07/19/99 (sickel) - Mac OS X Server and Client support added
27 * 02/22/01 (seiwald) - downshift paths on case-insensitive macintosh
28 * 03/23/01 (seiwald) - VMS C++ changes.
29 * 10/29/01 (brett) - More IA64 ifdefs for MS.
30 * 02/18/00 (belmonte)- Support for Cygwin.
31 * 09/12/00 (seiwald) - OSSYMS split to OSMAJOR/OSMINOR/OSPLAT
32 * 12/29/00 (seiwald) - OSVER dropped.
33 * 01/21/02 (seiwald) - new -q to quit quickly on build failure
34 * 03/16/02 (seiwald) - support for -g (reorder builds by source time)
35 * 03/20/02 (seiwald) - MINGW porting from Max Blagai
36 * 08/16/02 (seiwald) - BEOS porting from Ingo Weinhold
37 * 09/19/02 (seiwald) - new -d displays
38 * 11/05/02 (seiwald) - OSPLAT now set to sparc on solaris.
42 * Windows NT
45 # ifdef NT
47 # include <fcntl.h>
48 # include <stdlib.h>
49 # include <stdio.h>
50 # include <ctype.h>
51 # include <malloc.h>
52 # include <memory.h>
53 # include <signal.h>
54 # include <string.h>
55 # include <time.h>
57 # define OSMAJOR "NT=true"
58 # define OSMINOR "OS=NT"
59 # define OS_NT
60 # define SPLITPATH ';'
61 # define MAXLINE 2046 /* longest 'together' actions */
62 # define USE_EXECUNIX
63 # define USE_PATHUNIX
64 /*# define USE_EXECNT*/
65 # define PATH_DELIM '\\'
66 # define DOWNSHIFT_PATHS
68 /* AS400 cross-compile from NT */
70 # ifdef AS400
71 # undef OSMINOR
72 # undef OSMAJOR
73 # define OSMAJOR "AS400=true"
74 # define OSMINOR "OS=AS400"
75 # define OS_AS400
76 # endif
78 # endif
81 * Windows MingW32
84 # ifdef MINGW
86 # include <fcntl.h>
87 # include <stdlib.h>
88 # include <stdio.h>
89 # include <ctype.h>
90 # include <malloc.h>
91 # include <memory.h>
92 # include <signal.h>
93 # include <string.h>
94 # include <time.h>
96 # define OSMAJOR "MINGW=true"
97 # define OSMINOR "OS=MINGW"
98 # define OS_NT
99 # define SPLITPATH ';'
100 # define MAXLINE 996 /* longest 'together' actions */
101 # define USE_EXECUNIX
102 # define USE_PATHUNIX
103 # define PATH_DELIM '\\'
104 # define DOWNSHIFT_PATHS
106 # endif
110 * God fearing UNIX
113 # ifndef OSMINOR
115 # define OSMAJOR "UNIX=true"
116 # define USE_EXECUNIX
117 # define USE_FILEUNIX
118 # define USE_PATHUNIX
119 # define PATH_DELIM '/'
121 # ifdef __FreeBSD__
122 # define OSMINOR "OS=FREEBSD"
123 # define OS_FREEBSD
124 # endif
125 # ifdef linux
126 # define OSMINOR "OS=LINUX"
127 # define OS_LINUX
128 # endif
129 # ifdef __NetBSD__
130 # define unix
131 # define OSMINOR "OS=NETBSD"
132 # define OS_NETBSD
133 # define NO_VFORK
134 # endif
135 # ifdef __QNX__
136 # ifdef __QNXNTO__
137 # define OSMINOR "OS=QNXNTO"
138 # define OS_QNXNTO
139 # else
140 # define unix
141 # define OSMINOR "OS=QNX"
142 # define OS_QNX
143 # define NO_VFORK
144 # define MAXLINE 996
145 # endif
146 # endif
147 # ifdef __APPLE__
148 # define unix
149 # define OSMINOR "OS=MACOSX"
150 # define OS_MACOSX
151 # endif
152 # ifndef OSMINOR
153 # define OSMINOR "OS=UNKNOWN"
154 # endif
156 /* All the UNIX includes */
158 # include <sys/types.h>
159 # include <sys/stat.h>
161 # ifndef OS_MPEIX
162 # include <sys/file.h>
163 # endif
165 # include <fcntl.h>
166 # include <stdio.h>
167 # include <ctype.h>
168 # include <signal.h>
169 # include <string.h>
170 # include <time.h>
172 # ifndef OS_QNX
173 # include <memory.h>
174 # endif
176 # ifndef OS_ULTRIX
177 # include <stdlib.h>
178 # endif
180 # if !defined(OS_BSDI) && \
181 !defined(OS_FREEBSD) && \
182 !defined(OS_NEXT) && \
183 !defined(OS_MACHTEN) && \
184 !defined(OS_MACOSX) && \
185 !defined(OS_RHAPSODY) && \
186 !defined(OS_MVS)
187 # include <malloc.h>
188 # endif
190 #include <sys/types.h>
191 #include <sys/wait.h>
192 #include <unistd.h>
194 # endif
197 * OSPLAT definitions - suppressed when it's a one-of-a-kind
200 # if defined( _M_PPC ) || \
201 defined( PPC ) || \
202 defined( ppc ) || \
203 defined( __powerpc__ ) || \
204 defined( __POWERPC__ ) || \
205 defined( __ppc__ )
206 # define OSPLAT "OSPLAT=PPC"
207 # endif
209 # if defined( _ALPHA_ ) || \
210 defined( __alpha__ )
211 # define OSPLAT "OSPLAT=AXP"
212 # endif
214 # if defined( _i386_ ) || \
215 defined( __i386__ ) || \
216 defined( _M_IX86 )
217 # if !defined( OS_FREEBSD ) && \
218 !defined( OS_OS2 ) && \
219 !defined( OS_AS400 )
220 # define OSPLAT "OSPLAT=X86"
221 # endif
222 # endif
224 # ifdef __sparc__
225 # if !defined( OS_SUNOS )
226 # define OSPLAT "OSPLAT=SPARC"
227 # endif
228 # endif
230 # ifdef __mips__
231 # if !defined( OS_SGI )
232 # define OSPLAT "OSPLAT=MIPS"
233 # endif
234 # endif
236 # ifdef __arm__
237 # define OSPLAT "OSPLAT=ARM"
238 # endif
240 # if defined( __ia64__ ) || \
241 defined( __IA64__ ) || \
242 defined( _M_IA64 )
243 # define OSPLAT "OSPLAT=IA64"
244 # endif
246 # ifdef __s390__
247 # define OSPLAT "OSPLAT=390"
248 # endif
250 # ifndef OSPLAT
251 # define OSPLAT ""
252 # endif
255 * Jam implementation misc.
258 # ifndef MAXLINE
259 # define MAXLINE 10240 /* longest 'together' actions' */
260 # endif
262 # ifndef EXITOK
263 # define EXITOK 0
264 # define EXITBAD 1
265 # endif
267 # ifndef SPLITPATH
268 # define SPLITPATH ':'
269 # endif
271 /* You probably don't need to muck with these. */
273 # define MAXSYM 1024 /* longest symbol in the environment */
274 # define MAXJPATH 1024 /* longest filename */
276 # define MAXJOBS 64 /* silently enforce -j limit */
277 # define MAXARGC 32 /* words in $(JAMSHELL) */
279 /* Jam private definitions below. */
281 # define DEBUG_MAX 15
283 struct globs {
284 int noexec;
285 int jobs;
286 int quitquick;
287 int newestfirst; /* build newest sources first */
288 char debug[DEBUG_MAX];
289 FILE *cmdout; /* print cmds, not run them */
292 extern struct globs globs;
294 # define DEBUG_MAKE ( globs.debug[1] ) /* -da show actions when executed */
295 # define DEBUG_MAKEPROG ( globs.debug[3] ) /* -dm show progress of make0 */
297 # define DEBUG_EXECCMD ( globs.debug[4] ) /* show execcmds()'s work */
299 # define DEBUG_COMPILE ( globs.debug[5] ) /* show rule invocations */
301 # define DEBUG_HEADER ( globs.debug[6] ) /* show result of header scan */
302 # define DEBUG_BINDSCAN ( globs.debug[6] ) /* show result of dir scan */
303 # define DEBUG_SEARCH ( globs.debug[6] ) /* show attempts at binding */
305 # define DEBUG_VARSET ( globs.debug[7] ) /* show variable settings */
306 # define DEBUG_VARGET ( globs.debug[8] ) /* show variable fetches */
307 # define DEBUG_VAREXP ( globs.debug[8] ) /* show variable expansions */
308 # define DEBUG_IF ( globs.debug[8] ) /* show 'if' calculations */
309 # define DEBUG_LISTS ( globs.debug[9] ) /* show list manipulation */
310 # define DEBUG_SCAN ( globs.debug[9] ) /* show scanner tokens */
311 # define DEBUG_MEM ( globs.debug[9] ) /* show memory use */
313 # define DEBUG_MAKEQ ( globs.debug[11] ) /* -da show even quiet actions */
314 # define DEBUG_EXEC ( globs.debug[12] ) /* -dx show text of actions */
315 # define DEBUG_DEPENDS ( globs.debug[13] ) /* -dd show dependency graph */
316 # define DEBUG_CAUSES ( globs.debug[14] ) /* -dc show dependency graph */