]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | * Copyright 1993, 1995 Christopher Seiwald. | |
3 | * | |
4 | * This file is part of Jam - see jam.c for Copyright information. | |
5 | */ | |
6 | ||
7 | /* This file is ALSO: | |
8 | * Copyright 2001-2004 David Abrahams. | |
9 | * Distributed under the Boost Software License, Version 1.0. | |
10 | * (See accompanying file LICENSE_1_0.txt or copy at | |
11 | * http://www.boost.org/LICENSE_1_0.txt) | |
12 | */ | |
13 | ||
14 | /* | |
15 | * jam.h - includes and globals for jam | |
16 | */ | |
17 | ||
18 | #ifndef JAM_H_VP_2003_08_01 | |
19 | #define JAM_H_VP_2003_08_01 | |
20 | ||
21 | #ifdef HAVE_PYTHON | |
22 | #include <Python.h> | |
23 | #endif | |
24 | ||
25 | /* Assume popen support is available unless known otherwise. */ | |
26 | #define HAVE_POPEN 1 | |
27 | ||
28 | /* | |
29 | * VMS, OPENVMS | |
30 | */ | |
31 | ||
32 | #ifdef VMS | |
33 | ||
34 | #include <types.h> | |
35 | #include <file.h> | |
36 | #include <stat.h> | |
37 | #include <stdio.h> | |
38 | #include <ctype.h> | |
39 | #include <stdlib.h> | |
40 | #include <signal.h> | |
41 | #include <string.h> | |
42 | #include <time.h> | |
43 | #include <unistd.h> | |
44 | #include <unixlib.h> | |
45 | ||
46 | #define OSMINOR "OS=VMS" | |
47 | #define OSMAJOR "VMS=true" | |
48 | #define OS_VMS | |
49 | #define MAXLINE 1024 /* longest 'together' actions */ | |
50 | #define PATH_DELIM '/' /* use CRTL POSIX-style handling */ | |
51 | #define SPLITPATH ',' | |
52 | #define EXITOK EXIT_SUCCESS | |
53 | #define EXITBAD EXIT_FAILURE | |
54 | #define DOWNSHIFT_PATHS | |
55 | ||
56 | /* This may be inaccurate. */ | |
57 | #ifndef __DECC | |
58 | #define OSPLAT "OSPLAT=VAX" | |
59 | #endif | |
60 | ||
61 | #define glob jam_glob /* use jam's glob, not CRTL's */ | |
62 | ||
63 | #endif | |
64 | ||
65 | /* | |
66 | * Windows NT | |
67 | */ | |
68 | ||
69 | #ifdef NT | |
70 | ||
71 | #include <ctype.h> | |
72 | #include <fcntl.h> | |
73 | #include <malloc.h> | |
74 | #ifndef __MWERKS__ | |
75 | #include <memory.h> | |
76 | #endif | |
77 | #include <stdio.h> | |
78 | #include <stdlib.h> | |
79 | #include <signal.h> | |
80 | #include <string.h> | |
81 | #include <time.h> | |
82 | ||
83 | #define OSMAJOR "NT=true" | |
84 | #define OSMINOR "OS=NT" | |
85 | #define OS_NT | |
86 | #define SPLITPATH ';' | |
87 | #define MAXLINE (undefined__see_execnt_c) /* max chars per command line */ | |
88 | #define USE_EXECNT | |
89 | #define PATH_DELIM '\\' | |
90 | ||
91 | /* AS400 cross-compile from NT. */ | |
92 | ||
93 | #ifdef AS400 | |
94 | #undef OSMINOR | |
95 | #undef OSMAJOR | |
96 | #define OSMAJOR "AS400=true" | |
97 | #define OSMINOR "OS=AS400" | |
98 | #define OS_AS400 | |
99 | #endif | |
100 | ||
101 | /* Metrowerks Standard Library on Windows. */ | |
102 | ||
103 | #ifdef __MSL__ | |
104 | #undef HAVE_POPEN | |
105 | #endif | |
106 | ||
107 | #endif /* #ifdef NT */ | |
108 | ||
109 | ||
110 | /* | |
111 | * Windows MingW32 | |
112 | */ | |
113 | ||
114 | #ifdef MINGW | |
115 | ||
116 | #include <fcntl.h> | |
117 | #include <stdlib.h> | |
118 | #include <stdio.h> | |
119 | #include <ctype.h> | |
120 | #include <malloc.h> | |
121 | #include <memory.h> | |
122 | #include <signal.h> | |
123 | #include <string.h> | |
124 | #include <time.h> | |
125 | ||
126 | #define OSMAJOR "MINGW=true" | |
127 | #define OSMINOR "OS=MINGW" | |
128 | #define OS_NT | |
129 | #define SPLITPATH ';' | |
130 | #define MAXLINE 996 /* max chars per command line */ | |
131 | #define USE_EXECUNIX | |
132 | #define PATH_DELIM '\\' | |
133 | ||
134 | #endif /* #ifdef MINGW */ | |
135 | ||
136 | ||
137 | /* | |
138 | * God fearing UNIX. | |
139 | */ | |
140 | ||
141 | #ifndef OSMINOR | |
142 | ||
143 | #define OSMAJOR "UNIX=true" | |
144 | #define USE_EXECUNIX | |
145 | #define USE_FILEUNIX | |
146 | #define PATH_DELIM '/' | |
147 | ||
148 | #ifdef _AIX | |
149 | #define unix | |
150 | #define MAXLINE 23552 /* 24k - 1k, max chars per command line */ | |
151 | #define OSMINOR "OS=AIX" | |
152 | #define OS_AIX | |
153 | #define NO_VFORK | |
154 | #endif | |
155 | #ifdef AMIGA | |
156 | #define OSMINOR "OS=AMIGA" | |
157 | #define OS_AMIGA | |
158 | #endif | |
159 | #ifdef __BEOS__ | |
160 | #define unix | |
161 | #define OSMINOR "OS=BEOS" | |
162 | #define OS_BEOS | |
163 | #define NO_VFORK | |
164 | #endif | |
165 | #ifdef __bsdi__ | |
166 | #define OSMINOR "OS=BSDI" | |
167 | #define OS_BSDI | |
168 | #endif | |
169 | #if defined (COHERENT) && defined (_I386) | |
170 | #define OSMINOR "OS=COHERENT" | |
171 | #define OS_COHERENT | |
172 | #define NO_VFORK | |
173 | #endif | |
174 | #if defined(__cygwin__) || defined(__CYGWIN__) | |
175 | #define OSMINOR "OS=CYGWIN" | |
176 | #define OS_CYGWIN | |
177 | #endif | |
178 | #if defined(__FreeBSD__) && !defined(__DragonFly__) | |
179 | #define OSMINOR "OS=FREEBSD" | |
180 | #define OS_FREEBSD | |
181 | #endif | |
182 | #ifdef __DragonFly__ | |
183 | #define OSMINOR "OS=DRAGONFLYBSD" | |
184 | #define OS_DRAGONFLYBSD | |
185 | #endif | |
186 | #ifdef __DGUX__ | |
187 | #define OSMINOR "OS=DGUX" | |
188 | #define OS_DGUX | |
189 | #endif | |
190 | #ifdef __hpux | |
191 | #define OSMINOR "OS=HPUX" | |
192 | #define OS_HPUX | |
193 | #endif | |
194 | #ifdef __HAIKU__ | |
195 | #define unix | |
196 | #define OSMINOR "OS=HAIKU" | |
197 | #define OS_HAIKU | |
198 | #endif | |
199 | #ifdef __OPENNT | |
200 | #define unix | |
201 | #define OSMINOR "OS=INTERIX" | |
202 | #define OS_INTERIX | |
203 | #define NO_VFORK | |
204 | #endif | |
205 | #ifdef __sgi | |
206 | #define OSMINOR "OS=IRIX" | |
207 | #define OS_IRIX | |
208 | #define NO_VFORK | |
209 | #endif | |
210 | #ifdef __ISC | |
211 | #define OSMINOR "OS=ISC" | |
212 | #define OS_ISC | |
213 | #define NO_VFORK | |
214 | #endif | |
215 | #ifdef linux | |
216 | #define OSMINOR "OS=LINUX" | |
217 | #define OS_LINUX | |
218 | #endif | |
219 | #ifdef __Lynx__ | |
220 | #define OSMINOR "OS=LYNX" | |
221 | #define OS_LYNX | |
222 | #define NO_VFORK | |
223 | #define unix | |
224 | #endif | |
225 | #ifdef __MACHTEN__ | |
226 | #define OSMINOR "OS=MACHTEN" | |
227 | #define OS_MACHTEN | |
228 | #endif | |
229 | #ifdef mpeix | |
230 | #define unix | |
231 | #define OSMINOR "OS=MPEIX" | |
232 | #define OS_MPEIX | |
233 | #define NO_VFORK | |
234 | #endif | |
235 | #ifdef __MVS__ | |
236 | #define unix | |
237 | #define OSMINOR "OS=MVS" | |
238 | #define OS_MVS | |
239 | #endif | |
240 | #ifdef _ATT4 | |
241 | #define OSMINOR "OS=NCR" | |
242 | #define OS_NCR | |
243 | #endif | |
244 | #ifdef __NetBSD__ | |
245 | #define unix | |
246 | #define OSMINOR "OS=NETBSD" | |
247 | #define OS_NETBSD | |
248 | #define NO_VFORK | |
249 | #endif | |
250 | #ifdef __QNX__ | |
251 | #define unix | |
252 | #ifdef __QNXNTO__ | |
253 | #define OSMINOR "OS=QNXNTO" | |
254 | #define OS_QNXNTO | |
255 | #else | |
256 | #define OSMINOR "OS=QNX" | |
257 | #define OS_QNX | |
258 | #define NO_VFORK | |
259 | #define MAXLINE 996 /* max chars per command line */ | |
260 | #endif | |
261 | #endif | |
262 | #ifdef NeXT | |
263 | #ifdef __APPLE__ | |
264 | #define OSMINOR "OS=RHAPSODY" | |
265 | #define OS_RHAPSODY | |
266 | #else | |
267 | #define OSMINOR "OS=NEXT" | |
268 | #define OS_NEXT | |
269 | #endif | |
270 | #endif | |
271 | #ifdef __APPLE__ | |
272 | #define unix | |
273 | #define OSMINOR "OS=MACOSX" | |
274 | #define OS_MACOSX | |
275 | #endif | |
276 | #ifdef __osf__ | |
277 | #ifndef unix | |
278 | #define unix | |
279 | #endif | |
280 | #define OSMINOR "OS=OSF" | |
281 | #define OS_OSF | |
282 | #endif | |
283 | #ifdef _SEQUENT_ | |
284 | #define OSMINOR "OS=PTX" | |
285 | #define OS_PTX | |
286 | #endif | |
287 | #ifdef M_XENIX | |
288 | #define OSMINOR "OS=SCO" | |
289 | #define OS_SCO | |
290 | #define NO_VFORK | |
291 | #endif | |
292 | #ifdef sinix | |
293 | #define unix | |
294 | #define OSMINOR "OS=SINIX" | |
295 | #define OS_SINIX | |
296 | #endif | |
297 | #ifdef sun | |
298 | #if defined(__svr4__) || defined(__SVR4) | |
299 | #define OSMINOR "OS=SOLARIS" | |
300 | #define OS_SOLARIS | |
301 | #else | |
302 | #define OSMINOR "OS=SUNOS" | |
303 | #define OS_SUNOS | |
304 | #endif | |
305 | #endif | |
306 | #ifdef ultrix | |
307 | #define OSMINOR "OS=ULTRIX" | |
308 | #define OS_ULTRIX | |
309 | #endif | |
310 | #ifdef _UNICOS | |
311 | #define OSMINOR "OS=UNICOS" | |
312 | #define OS_UNICOS | |
313 | #endif | |
314 | #if defined(__USLC__) && !defined(M_XENIX) | |
315 | #define OSMINOR "OS=UNIXWARE" | |
316 | #define OS_UNIXWARE | |
317 | #endif | |
318 | #ifdef __OpenBSD__ | |
319 | #define OSMINOR "OS=OPENBSD" | |
320 | #define OS_OPENBSD | |
321 | #define unix | |
322 | #endif | |
323 | #if defined (__FreeBSD_kernel__) && !defined(__FreeBSD__) | |
324 | #define OSMINOR "OS=KFREEBSD" | |
325 | #define OS_KFREEBSD | |
326 | #endif | |
327 | #ifndef OSMINOR | |
328 | #define OSMINOR "OS=UNKNOWN" | |
329 | #endif | |
330 | ||
331 | /* All the UNIX includes */ | |
332 | ||
333 | #include <sys/types.h> | |
334 | ||
335 | #ifndef OS_MPEIX | |
336 | #include <sys/file.h> | |
337 | #endif | |
338 | ||
339 | #include <fcntl.h> | |
340 | #include <stdio.h> | |
341 | #include <ctype.h> | |
342 | #include <signal.h> | |
343 | #include <string.h> | |
344 | #include <time.h> | |
345 | #include <unistd.h> | |
346 | ||
347 | #ifndef OS_QNX | |
348 | #include <memory.h> | |
349 | #endif | |
350 | ||
351 | #ifndef OS_ULTRIX | |
352 | #include <stdlib.h> | |
353 | #endif | |
354 | ||
355 | #if !defined( OS_BSDI ) && \ | |
356 | !defined( OS_FREEBSD ) && \ | |
357 | !defined( OS_DRAGONFLYBSD ) && \ | |
358 | !defined( OS_NEXT ) && \ | |
359 | !defined( OS_MACHTEN ) && \ | |
360 | !defined( OS_MACOSX ) && \ | |
361 | !defined( OS_RHAPSODY ) && \ | |
362 | !defined( OS_MVS ) && \ | |
363 | !defined( OS_OPENBSD ) | |
364 | #include <malloc.h> | |
365 | #endif | |
366 | ||
367 | #endif /* #ifndef OSMINOR */ | |
368 | ||
369 | ||
370 | /* | |
371 | * OSPLAT definitions - suppressed when it is a one-of-a-kind. | |
372 | */ | |
373 | ||
374 | #if defined( _M_PPC ) || \ | |
375 | defined( PPC ) || \ | |
376 | defined( ppc ) || \ | |
377 | defined( __powerpc__ ) || \ | |
378 | defined( __ppc__ ) | |
379 | #define OSPLAT "OSPLAT=PPC" | |
380 | #endif | |
381 | ||
382 | #if defined( _ALPHA_ ) || \ | |
383 | defined( __alpha__ ) | |
384 | #define OSPLAT "OSPLAT=AXP" | |
385 | #endif | |
386 | ||
387 | #if defined( _i386_ ) || \ | |
388 | defined( __i386__ ) || \ | |
389 | defined( __i386 ) || \ | |
390 | defined( _M_IX86 ) | |
391 | #define OSPLAT "OSPLAT=X86" | |
392 | #endif | |
393 | ||
394 | #if defined( __ia64__ ) || \ | |
395 | defined( __IA64__ ) || \ | |
396 | defined( __ia64 ) | |
397 | #define OSPLAT "OSPLAT=IA64" | |
398 | #endif | |
399 | ||
400 | #if defined( __x86_64__ ) || \ | |
401 | defined( __amd64__ ) || \ | |
402 | defined( _M_AMD64 ) | |
403 | #define OSPLAT "OSPLAT=X86_64" | |
404 | #endif | |
405 | ||
406 | #if defined( __sparc__ ) || \ | |
407 | defined( __sparc ) | |
408 | #define OSPLAT "OSPLAT=SPARC" | |
409 | #endif | |
410 | ||
411 | #ifdef __mips__ | |
412 | #define OSPLAT "OSPLAT=MIPS" | |
413 | #endif | |
414 | ||
415 | #if defined( __arm__ ) || \ | |
416 | defined( __aarch64__ ) | |
417 | #define OSPLAT "OSPLAT=ARM" | |
418 | #endif | |
419 | ||
420 | #ifdef __s390__ | |
421 | #define OSPLAT "OSPLAT=390" | |
422 | #endif | |
423 | ||
424 | #ifdef __hppa | |
425 | #define OSPLAT "OSPLAT=PARISC" | |
426 | #endif | |
427 | ||
428 | #ifndef OSPLAT | |
429 | #define OSPLAT "" | |
430 | #endif | |
431 | ||
432 | ||
433 | /* | |
434 | * Jam implementation misc. | |
435 | */ | |
436 | ||
437 | #ifndef MAXLINE | |
438 | #define MAXLINE 102400 /* max chars per command line */ | |
439 | #endif | |
440 | ||
441 | #ifndef EXITOK | |
442 | #define EXITOK 0 | |
443 | #define EXITBAD 1 | |
444 | #endif | |
445 | ||
446 | #ifndef SPLITPATH | |
447 | #define SPLITPATH ':' | |
448 | #endif | |
449 | ||
450 | /* You probably do not need to muck with these. */ | |
451 | ||
452 | #define MAXSYM 1024 /* longest symbol in the environment */ | |
453 | #define MAXJPATH 1024 /* longest filename */ | |
454 | ||
7c673cae FG |
455 | #define MAXARGC 32 /* words in $(JAMSHELL) */ |
456 | ||
457 | /* Jam private definitions below. */ | |
458 | ||
459 | #define DEBUG_MAX 14 | |
460 | ||
461 | ||
462 | struct globs | |
463 | { | |
464 | int noexec; | |
465 | int jobs; | |
466 | int quitquick; | |
467 | int newestfirst; /* build newest sources first */ | |
468 | int pipe_action; | |
469 | char debug[ DEBUG_MAX ]; | |
470 | FILE * out; /* mirror output here */ | |
471 | long timeout; /* number of seconds to limit actions to, | |
472 | * default 0 for no limit. | |
473 | */ | |
474 | int dart; /* output build and test results formatted for | |
475 | * Dart | |
476 | */ | |
477 | int max_buf; /* maximum amount of output saved from target | |
478 | * (kb) | |
479 | */ | |
480 | }; | |
481 | ||
482 | extern struct globs globs; | |
483 | ||
484 | #define DEBUG_MAKE ( globs.debug[ 1 ] ) /* show actions when executed */ | |
485 | #define DEBUG_MAKEQ ( globs.debug[ 2 ] ) /* show even quiet actions */ | |
486 | #define DEBUG_EXEC ( globs.debug[ 2 ] ) /* show text of actons */ | |
487 | #define DEBUG_MAKEPROG ( globs.debug[ 3 ] ) /* show make0 progress */ | |
488 | #define DEBUG_BIND ( globs.debug[ 3 ] ) /* show when files bound */ | |
489 | ||
490 | #define DEBUG_EXECCMD ( globs.debug[ 4 ] ) /* show execcmds()'s work */ | |
491 | ||
492 | #define DEBUG_COMPILE ( globs.debug[ 5 ] ) /* show rule invocations */ | |
493 | ||
494 | #define DEBUG_HEADER ( globs.debug[ 6 ] ) /* show result of header scan */ | |
495 | #define DEBUG_BINDSCAN ( globs.debug[ 6 ] ) /* show result of dir scan */ | |
496 | #define DEBUG_SEARCH ( globs.debug[ 6 ] ) /* show binding attempts */ | |
497 | ||
498 | #define DEBUG_VARSET ( globs.debug[ 7 ] ) /* show variable settings */ | |
499 | #define DEBUG_VARGET ( globs.debug[ 8 ] ) /* show variable fetches */ | |
500 | #define DEBUG_VAREXP ( globs.debug[ 8 ] ) /* show variable expansions */ | |
501 | #define DEBUG_IF ( globs.debug[ 8 ] ) /* show 'if' calculations */ | |
502 | #define DEBUG_LISTS ( globs.debug[ 9 ] ) /* show list manipulation */ | |
503 | #define DEBUG_SCAN ( globs.debug[ 9 ] ) /* show scanner tokens */ | |
504 | #define DEBUG_MEM ( globs.debug[ 9 ] ) /* show memory use */ | |
505 | ||
506 | #define DEBUG_PROFILE ( globs.debug[ 10 ] ) /* dump rule execution times */ | |
507 | #define DEBUG_PARSE ( globs.debug[ 11 ] ) /* debug parsing */ | |
508 | #define DEBUG_GRAPH ( globs.debug[ 12 ] ) /* debug dependencies */ | |
509 | #define DEBUG_FATE ( globs.debug[ 13 ] ) /* show fate changes in make0() */ | |
510 | ||
511 | /* Everyone gets the memory definitions. */ | |
512 | #include "mem.h" | |
513 | ||
514 | /* They also get the profile functions. */ | |
515 | #include "debug.h" | |
516 | ||
517 | #endif |