cosmetix
[k8jam.git] / src / jam.h
blobe0ae172d90e5cf19bf1b85f82573ff3e19c2d7e8
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
43 /* Windows NT */
44 #ifdef NT
45 # include <fcntl.h>
46 # include <stdlib.h>
47 # include <stdio.h>
48 # include <ctype.h>
49 # include <malloc.h>
50 # include <memory.h>
51 # include <signal.h>
52 # include <string.h>
53 # include <time.h>
54 # define OSMAJOR "NT=true"
55 # define OSMINOR "OS=NT"
56 # define OS_NT
57 # define SPLITPATH ';'
58 # define MAXLINE 2046 /* longest 'together' actions */
59 /*# define USE_EXECNT*/
60 # define PATH_DELIM '\\'
61 # define DOWNSHIFT_PATHS
62 #endif
65 /* Windows MingW32 */
66 #ifdef MINGW
67 # include <fcntl.h>
68 # include <stdlib.h>
69 # include <stdio.h>
70 # include <ctype.h>
71 # include <malloc.h>
72 # include <memory.h>
73 # include <signal.h>
74 # include <string.h>
75 # include <time.h>
76 # define OSMAJOR "MINGW=true"
77 # define OSMINOR "OS=MINGW"
78 # define OS_NT
79 # define SPLITPATH ';'
80 # define MAXLINE 996 /* longest 'together' actions */
81 # define PATH_DELIM '\\'
82 # define DOWNSHIFT_PATHS
83 #endif
86 /* God fearing UNIX */
87 #ifndef OSMINOR
88 # define OSMAJOR "UNIX=true"
89 # define USE_FILEUNIX
90 # define PATH_DELIM '/'
91 # ifdef __FreeBSD__
92 # define OSMINOR "OS=FREEBSD"
93 # define OS_FREEBSD
94 # endif
95 # ifdef linux
96 # define OSMINOR "OS=LINUX"
97 # define OS_LINUX
98 # endif
99 # ifdef __NetBSD__
100 # define unix
101 # define OSMINOR "OS=NETBSD"
102 # define OS_NETBSD
103 # define NO_VFORK
104 # endif
105 # ifdef __QNX__
106 # ifdef __QNXNTO__
107 # define OSMINOR "OS=QNXNTO"
108 # define OS_QNXNTO
109 # else
110 # define unix
111 # define OSMINOR "OS=QNX"
112 # define OS_QNX
113 # define NO_VFORK
114 # define MAXLINE 996
115 # endif
116 # endif
117 # ifdef __APPLE__
118 # define unix
119 # define OSMINOR "OS=MACOSX"
120 # define OS_MACOSX
121 # endif
122 # ifndef OSMINOR
123 # define OSMINOR "OS=UNKNOWN"
124 # endif
125 /* All the UNIX includes */
126 # include <sys/types.h>
127 # include <sys/stat.h>
128 # ifndef OS_MPEIX
129 # include <sys/file.h>
130 # endif
131 # include <fcntl.h>
132 # include <stdio.h>
133 # include <ctype.h>
134 # include <signal.h>
135 # include <string.h>
136 # include <time.h>
137 # ifndef OS_QNX
138 # include <memory.h>
139 # endif
140 # ifndef OS_ULTRIX
141 # include <stdlib.h>
142 # endif
143 # if !defined(OS_BSDI) && \
144 !defined(OS_FREEBSD) && \
145 !defined(OS_NEXT) && \
146 !defined(OS_MACHTEN) && \
147 !defined(OS_MACOSX) && \
148 !defined(OS_RHAPSODY) && \
149 !defined(OS_MVS)
150 # include <malloc.h>
151 # endif
152 # include <sys/types.h>
153 # include <sys/wait.h>
154 # include <unistd.h>
155 #endif
158 /* OSPLAT definitions - suppressed when it's a one-of-a-kind */
159 #if defined(_M_PPC) || \
160 defined(PPC) || \
161 defined(ppc) || \
162 defined(__powerpc__) || \
163 defined(__POWERPC__) || \
164 defined(__ppc__)
165 # define OSPLAT "OSPLAT=PPC"
166 #endif
168 #if defined(_i386_) || \
169 defined(__i386__) || \
170 defined(_M_IX86)
171 # if !defined(OS_FREEBSD) && \
172 !defined(OS_OS2)
173 # define OSPLAT "OSPLAT=X86"
174 # endif
175 #endif
177 #ifdef __sparc__
178 # if !defined( OS_SUNOS )
179 # define OSPLAT "OSPLAT=SPARC"
180 # endif
181 #endif
183 #ifdef __mips__
184 # if !defined( OS_SGI )
185 # define OSPLAT "OSPLAT=MIPS"
186 # endif
187 #endif
189 #ifdef __arm__
190 # define OSPLAT "OSPLAT=ARM"
191 #endif
193 #if defined(__ia64__) || defined(__IA64__) || defined(_M_IA64)
194 # define OSPLAT "OSPLAT=IA64"
195 #endif
197 #ifdef __s390__
198 # define OSPLAT "OSPLAT=390"
199 #endif
201 #ifndef OSPLAT
202 # define OSPLAT ""
203 #endif
206 /* Jam implementation misc. */
207 /* longest 'together' actions' */
208 #ifndef MAXLINE
209 # define MAXLINE (10240)
210 #endif
212 #ifndef EXITOK
213 # define EXITOK (0)
214 # define EXITBAD (1)
215 #endif
217 #ifndef SPLITPATH
218 # define SPLITPATH ':'
219 #endif
222 /* You probably don't need to muck with these. */
223 #define MAXSYM (1024) /* longest symbol in the environment */
224 #define MAXJPATH (1024) /* longest filename */
226 #define MAXJOBS (64) /* silently enforce -j limit */
227 #define MAXARGC (32) /* words in $(JAMSHELL) */
230 /* Jam private definitions below. */
231 #define DEBUG_MAX (15)
233 struct globs {
234 int noexec;
235 int jobs;
236 int quitquick;
237 int newestfirst; /* build newest sources first */
238 char debug[DEBUG_MAX];
239 FILE *cmdout; /* print cmds, not run them */
240 //#ifdef OPT_IMPROVED_PROGRESS_EXT
241 int updating; /* # targets we are updating */
242 void *progress; /* progress data (progress.h) */
243 //#endif
246 extern struct globs globs;
249 #define DEBUG_MAKE (globs.debug[1]) /* -da show actions when executed */
250 #define DEBUG_MAKEPROG (globs.debug[3]) /* -dm show progress of make0 */
252 #define DEBUG_EXECCMD (globs.debug[4]) /* show execcmds()'s work */
254 #define DEBUG_COMPILE (globs.debug[5]) /* show rule invocations */
256 #define DEBUG_HEADER (globs.debug[6]) /* show result of header scan */
257 #define DEBUG_BINDSCAN (globs.debug[6]) /* show result of dir scan */
258 #define DEBUG_SEARCH (globs.debug[6]) /* show attempts at binding */
260 #define DEBUG_VARSET (globs.debug[7]) /* show variable settings */
261 #define DEBUG_VARGET (globs.debug[8]) /* show variable fetches */
262 #define DEBUG_VAREXP (globs.debug[8]) /* show variable expansions */
263 #define DEBUG_IF (globs.debug[8]) /* show 'if' calculations */
264 #define DEBUG_LISTS (globs.debug[9]) /* show list manipulation */
265 #define DEBUG_SCAN (globs.debug[9]) /* show scanner tokens */
266 #define DEBUG_MEM (globs.debug[9]) /* show memory use */
268 #define DEBUG_MAKEQ (globs.debug[11]) /* -da show even quiet actions */
269 #define DEBUG_EXEC (globs.debug[12]) /* -dx show text of actions */
270 #define DEBUG_DEPENDS (globs.debug[13]) /* -dd show dependency graph */
271 #define DEBUG_CAUSES (globs.debug[14]) /* -dc show dependency graph */
274 #endif