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