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