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