1 |
# |
2 |
# /+\ |
3 |
# +\ Copyright 1993, 2000 Christopher Seiwald. |
4 |
# \+/ |
5 |
# |
6 |
# This file is part of Jam - see jam.c for Copyright information. |
7 |
# |
8 |
|
9 |
# |
10 |
# JAMBASE - jam 2.3 ruleset providing make(1)-like functionality |
11 |
# |
12 |
# Supports UNIX, NT, and VMS. |
13 |
# |
14 |
# 12/27/93 (seiwald) - purturb library sources with SOURCE_GRIST |
15 |
# 04/18/94 (seiwald) - use '?=' when setting OS specific vars |
16 |
# 04/21/94 (seiwald) - do RmTemps together |
17 |
# 05/05/94 (seiwald) - all supported C compilers support -o: relegate |
18 |
# RELOCATE as an option; set Ranlib to "" to disable it |
19 |
# 06/01/94 (seiwald) - new 'actions existing' to do existing sources |
20 |
# 08/25/94 (seiwald) - new ObjectCcFlags rule to append to per-target CCFLAGS |
21 |
# 08/29/94 (seiwald) - new ObjectHdrs rule to append to per-target HDRS |
22 |
# 09/19/94 (seiwald) - LinkLibraries and Undefs now append |
23 |
# - Rule names downshifted. |
24 |
# 10/06/94 (seiwald) - Dumb yyacc stuff moved into Jamfile. |
25 |
# 10/14/94 (seiwald) - (Crude) support for .s, .C, .cc, .cpp, and .f files. |
26 |
# 01/08/95 (seiwald) - Shell now handled with awk, not sed |
27 |
# 01/09/95 (seiwald) - Install* now take dest directory as target |
28 |
# 01/10/95 (seiwald) - All entries sorted. |
29 |
# 01/10/95 (seiwald) - NT support moved in, with LauraW's help. |
30 |
# 01/10/95 (seiwald) - VMS support moved in. |
31 |
# 02/06/95 (seiwald) - ObjectC++Flags and SubDirC++Flags added. |
32 |
# 02/07/95 (seiwald) - Iron out when HDRSEARCH uses "" or SEARCH_SOURCE. |
33 |
# 02/08/95 (seiwald) - SubDir works on VMS. |
34 |
# 02/14/95 (seiwald) - MkDir and entourage. |
35 |
# 04/30/95 (seiwald) - Use install -c flag so that it copies, not moves. |
36 |
# 07/10/95 (taylor) - Support for Microsoft C++. |
37 |
# 11/21/96 (peterk) - Support for BeOS |
38 |
# 07/19/99 (sickel) - Support for Mac OS X Server (and maybe client) |
39 |
# 02/18/00 (belmonte)- Support for Cygwin. |
40 |
# 11/05/04 (st.clair)- Modified MinGW variables and actions |
41 |
|
42 |
# Special targets defined in this file: |
43 |
# |
44 |
# all - parent of first, shell, files, lib, exe |
45 |
# first - first dependent of 'all', for potential initialization |
46 |
# shell - parent of all Shell targets |
47 |
# files - parent of all File targets |
48 |
# lib - parent of all Library targets |
49 |
# exe - parent of all Main targets |
50 |
# dirs - parent of all MkDir targets |
51 |
# clean - removes all Shell, File, Library, and Main targets |
52 |
# uninstall - removes all Install targets |
53 |
# |
54 |
|
55 |
# Rules defined by this file: |
56 |
# |
57 |
# as obj.o : source.s ; .s -> .o |
58 |
# Bulk dir : files ; populate directory with many files |
59 |
# Cc obj.o : source.c ; .c -> .o |
60 |
# C++ obj.o : source.cc ; .cc -> .o |
61 |
# Clean clean : sources ; remove sources with 'jam clean' |
62 |
# File dest : source ; copy file |
63 |
# Fortran obj.o : source.f ; .f -> .o |
64 |
# GenFile source.c : program args ; make custom file |
65 |
# Hardlink target : source ; make link from source to target |
66 |
# HdrRule source : headers ; handle #includes |
67 |
# InstallInto dir : sources ; install any files |
68 |
# InstallBin dir : sources ; install binaries |
69 |
# InstallLib dir : sources ; install files |
70 |
# InstallFile dir : sources ; install files |
71 |
# InstallMan dir : sources ; install man pages |
72 |
# InstallShell dir : sources ; install shell scripts |
73 |
# Lex source.c : source.l ; .l -> .c |
74 |
# Library lib : source ; archive library from compiled sources |
75 |
# LibraryFromObjects lib : objects ; archive library from objects |
76 |
# LinkLibraries images : libraries ; bag libraries onto Mains |
77 |
# Main image : source ; link executable from compiled sources |
78 |
# MainFromObjects image : objects ; link executable from objects |
79 |
# MkDir dir ; make a directory, if not there |
80 |
# Object object : source ; compile object from source |
81 |
# ObjectCcFlags source : flags ; add compiler flags for object |
82 |
# ObjectC++Flags source : flags ; add compiler flags for object |
83 |
# ObjectHdrs source : dirs ; add include directories for object |
84 |
# Objects sources ; compile sources |
85 |
# RmTemps target : sources ; remove temp sources after target made |
86 |
# Setuid images ; mark executables Setuid |
87 |
# SubDir TOP d1 d2 ... ; start a subdirectory Jamfile |
88 |
# SubDirCcFlags flags ; add compiler flags until next SubDir |
89 |
# SubDirC++Flags flags ; add compiler flags until next SubDir |
90 |
# SubDirHdrs dirs ; add include dirs until next SubDir |
91 |
# SubInclude TOP d1 d2 ... ; include a subdirectory Jamfile |
92 |
# Shell exe : source ; make a shell executable |
93 |
# Undefines images : symbols ; save undef's for linking |
94 |
# UserObject object : source ; handle unknown suffixes for Object |
95 |
# Yacc source.c : source.y ; .y -> .c |
96 |
# |
97 |
# Utility rules that have no side effects (not supported): |
98 |
# |
99 |
# FAppendSuffix f1 f2 ... : $(SUF) ; return $(<) with suffixes |
100 |
# FConcat value ... ; return contatenated values |
101 |
# FDirName d1 d2 ... ; return path from root to dir |
102 |
# FGrist d1 d2 ... ; return d1!d2!... |
103 |
# FGristFiles value ; return $(value:G=$(SOURCE_GRIST)) |
104 |
# FGristSourceFiles value ; return $(value:G=$(SOURCE_GRIST)) |
105 |
# FRelPath d1 : d2 ; return rel path from d1 to d2 |
106 |
# FSubDir d1 d2 ... ; return path to root |
107 |
# |
108 |
|
109 |
|
110 |
# Brief review of the jam language: |
111 |
# |
112 |
# Statements: |
113 |
# rule RULE - statements to process a rule |
114 |
# actions RULE - system commands to carry out target update |
115 |
# |
116 |
# Modifiers on actions: |
117 |
# together - multiple instances of same rule on target get executed |
118 |
# once with their sources ($(>)) concatenated |
119 |
# updated - refers to updated sources ($(>)) only |
120 |
# ignore - ignore return status of command |
121 |
# quietly - don't trace its execution unless verbose |
122 |
# piecemeal - iterate command each time with a small subset of $(>) |
123 |
# existing - refers to currently existing sources ($(>)) only |
124 |
# bind vars - subject to binding before expanding in actions |
125 |
# |
126 |
# Special rules: |
127 |
# ALWAYS - always build a target |
128 |
# DEPENDS - builds the dependency graph |
129 |
# ECHO - blurt out targets on stdout |
130 |
# EXIT - blurt out targets and exit |
131 |
# INCLUDES - marks sources as headers for target (a codependency) |
132 |
# NOCARE - don't panic if the target can't be built |
133 |
# NOUPDATE - create the target if needed but never update it |
134 |
# NOTFILE - ignore the timestamp of the target (it's not a file) |
135 |
# TEMPORARY - target need not be present if sources haven't changed |
136 |
# |
137 |
# Special variables set by jam: |
138 |
# $(<) - targets of a rule (to the left of the :) |
139 |
# $(>) - sources of a rule (to the right of the :) |
140 |
# $(xxx) - true on xxx (UNIX, VMS, NT, OS2, MAC) |
141 |
# $(OS) - name of OS - varies wildly |
142 |
# $(JAMVERSION) - version number (2.3) |
143 |
# |
144 |
# Special variables used by jam: |
145 |
# SEARCH - where to find something (used during binding and actions) |
146 |
# LOCATE - where to plop something not found with SEARCH |
147 |
# HDRRULE - rule to call to handle include files |
148 |
# HDRSCAN - egrep regex to extract include files |
149 |
# |
150 |
# Special targets: |
151 |
# all - default if none given on command line |
152 |
# |
153 |
|
154 |
# Initialize variables |
155 |
# |
156 |
|
157 |
# |
158 |
# OS specific variable settings |
159 |
# |
160 |
|
161 |
if $(NT) |
162 |
{ |
163 |
# the list of supported toolsets on Windows NT and Windows 95/98 |
164 |
# |
165 |
local SUPPORTED_TOOLSETS = |
166 |
"BORLANDC" |
167 |
"VISUALC" |
168 |
"VISUALC16" |
169 |
"INTELC" |
170 |
"WATCOM" |
171 |
"MINGW" |
172 |
"LCC" |
173 |
; |
174 |
|
175 |
# this variable holds the current toolset |
176 |
# |
177 |
TOOLSET = "" ; |
178 |
|
179 |
# if the JAM_TOOLSET environment variable is defined, check that it is |
180 |
# one of our supported values |
181 |
# |
182 |
if $(JAM_TOOLSET) |
183 |
{ |
184 |
local t ; |
185 |
|
186 |
for t in $(SUPPORTED_TOOLSETS) |
187 |
{ |
188 |
if $(t) = $(JAM_TOOLSET) { TOOLSET = $(t) ; } |
189 |
} |
190 |
|
191 |
if ! $(TOOLSET) |
192 |
{ |
193 |
ECHO "The JAM_TOOLSET environment variable is defined but its value" ; |
194 |
ECHO "is invalid, please use one of the following:" ; |
195 |
ECHO ; |
196 |
|
197 |
for t in $(SUPPORTED_TOOLSETS) { ECHO " " $(t) ; } |
198 |
EXIT ; |
199 |
} |
200 |
} |
201 |
|
202 |
# if TOOLSET is empty, we'll try to detect the toolset from other |
203 |
# environment variables to remain backwards compatible with Jam 2.3 |
204 |
# |
205 |
if ! $(TOOLSET) |
206 |
{ |
207 |
if $(BCCROOT) |
208 |
{ |
209 |
TOOLSET = BORLANDC ; |
210 |
BORLANDC = $(BCCROOT) ; |
211 |
} |
212 |
else if $(MSVC) |
213 |
{ |
214 |
TOOLSET = VISUALC16 ; |
215 |
VISUALC16 = $(MSVC) ; |
216 |
} |
217 |
else if $(MSVCNT) |
218 |
{ |
219 |
TOOLSET = VISUALC ; |
220 |
VISUALC = $(MSVCNT) ; |
221 |
} |
222 |
else if $(MINGW) |
223 |
{ |
224 |
TOOLSET = MINGW ; |
225 |
} |
226 |
else |
227 |
{ |
228 |
ECHO "Jam cannot be run because you didn't indicate which compilation toolset" ; |
229 |
ECHO "to use. To do so, follow these simple instructions:" ; |
230 |
ECHO ; |
231 |
ECHO " - define one of the following environment variable, with the" ; |
232 |
ECHO " appropriate value according to this list:" ; |
233 |
ECHO ; |
234 |
ECHO " Variable Toolset Description" ; |
235 |
ECHO ; |
236 |
ECHO " BORLANDC Borland C++ BC++ install path" ; |
237 |
ECHO " VISUALC Microsoft Visual C++ VC++ install path" ; |
238 |
ECHO " VISUALC16 Microsoft Visual C++ 16 bit VC++ 16 bit install" ; |
239 |
ECHO " INTELC Intel C/C++ IC++ install path" ; |
240 |
ECHO " WATCOM Watcom C/C++ Watcom install path" ; |
241 |
ECHO " MINGW MinGW (gcc) MinGW install path" ; |
242 |
ECHO " LCC Win32-LCC LCC-Win32 install path" ; |
243 |
ECHO ; |
244 |
ECHO " - define the JAM_TOOLSET environment variable with the *name*" ; |
245 |
ECHO " of the toolset variable you want to use." ; |
246 |
ECHO ; |
247 |
ECHO " e.g.: set VISUALC=C:\Visual6" ; |
248 |
ECHO " set JAM_TOOLSET=VISUALC" ; |
249 |
ECHO ; |
250 |
EXIT ; |
251 |
} |
252 |
} |
253 |
|
254 |
CP ?= copy ; |
255 |
RM ?= del ; |
256 |
MV ?= move /Y ; |
257 |
SLASH ?= \\ ; |
258 |
SUFLIB ?= .lib ; |
259 |
SUFOBJ ?= .obj ; |
260 |
SUFEXE ?= .exe ; |
261 |
|
262 |
if $(TOOLSET) = BORLANDC |
263 |
{ |
264 |
ECHO "Compiler is Borland C++" ; |
265 |
|
266 |
AR ?= tlib /C /P64 ; |
267 |
CC ?= bcc32 ; |
268 |
CCFLAGS ?= -q -y -d -v -w-par -w-ccc -w-rch -w-pro -w-aus ; |
269 |
C++ ?= bcc32 ; |
270 |
C++FLAGS ?= -q -y -d -v -w-par -w-ccc -w-rch -w-pro -w-aus -P ; |
271 |
STDLIBPATH ?= $(BORLANDC)\\lib ; |
272 |
STDHDRS ?= $(BORLANDC)\\include ; |
273 |
LINK ?= $(CC) ; |
274 |
LINKFLAGS ?= $(CCFLAGS) -L$(STDLIBPATH) ; |
275 |
NOARSCAN ?= true ; |
276 |
} |
277 |
else if $(TOOLSET) = VISUALC16 |
278 |
{ |
279 |
ECHO "Compiler is Microsoft Visual C++ 16 bit" ; |
280 |
|
281 |
AR ?= lib /nologo ; |
282 |
CC ?= cl /nologo ; |
283 |
CCFLAGS ?= /D \"WIN\" ; |
284 |
C++ ?= $(CC) ; |
285 |
C++FLAGS ?= $(CCFLAGS) ; |
286 |
LINK ?= $(CC) ; |
287 |
LINKFLAGS ?= $(CCFLAGS) ; |
288 |
LINKLIBS ?= |
289 |
#$(VISUALC16)\\lib\\advapi32.lib |
290 |
#$(VISUALC16)\\lib\\libcmt.lib |
291 |
$(VISUALC16)\\lib\\mlibce.lib |
292 |
#$(VISUALC16)\\lib\\slibce.lib |
293 |
$(VISUALC16)\\lib\\oldnames.lib |
294 |
#$(VISUALC16)\\lib\\kernel32.lib |
295 |
; |
296 |
LINKLIBS ?= ; |
297 |
NOARSCAN ?= true ; |
298 |
OPTIM ?= "" ; |
299 |
STDHDRS ?= $(VISUALC16)\\include ; |
300 |
UNDEFFLAG ?= "/u _" ; |
301 |
} |
302 |
else if $(TOOLSET) = VISUALC |
303 |
{ |
304 |
ECHO "Compiler is Microsoft Visual C++" ; |
305 |
|
306 |
AR ?= lib ; |
307 |
AS ?= masm386 ; |
308 |
CC ?= cl /nologo ; |
309 |
CCFLAGS ?= "" ; |
310 |
C++ ?= $(CC) ; |
311 |
C++FLAGS ?= $(CCFLAGS) ; |
312 |
LINK ?= link /nologo ; |
313 |
LINKFLAGS ?= "" ; |
314 |
LINKLIBS ?= /LIBPATH:$(VISUALC)\\lib |
315 |
/LIBPATH:$(VISUALC)\\PlatformSDK\\lib |
316 |
advapi32.lib |
317 |
libc.lib |
318 |
oldnames.lib |
319 |
gdi32.lib |
320 |
user32.lib |
321 |
kernel32.lib ; |
322 |
OPTIM ?= "" ; |
323 |
STDHDRS ?= $(VISUALC)\\include $(VISUALC)\\PlatformSDK\\include ; |
324 |
UNDEFFLAG ?= "/u _" ; |
325 |
} |
326 |
else if $(TOOLSET) = INTELC |
327 |
{ |
328 |
ECHO "Compiler is Intel C/C++" ; |
329 |
|
330 |
if ! $(VISUALC) |
331 |
{ |
332 |
ECHO "As a special exception, when using the Intel C++ compiler, you need" ; |
333 |
ECHO "to define the VISUALC environment variable to indicate the location" ; |
334 |
ECHO "of your Visual C++ installation. Aborting.." ; |
335 |
EXIT ; |
336 |
} |
337 |
|
338 |
AR ?= lib ; |
339 |
AS ?= masm386 ; |
340 |
CC ?= icl /nologo ; |
341 |
CCFLAGS ?= "" ; |
342 |
C++ ?= $(CC) ; |
343 |
C++FLAGS ?= $(CCFLAGS) ; |
344 |
LINK ?= link /nologo ; |
345 |
LINKFLAGS ?= "" ; |
346 |
LINKLIBS ?= $(VISUALC)\\lib\\advapi32.lib |
347 |
$(VISUALC)\\lib\\libc.lib |
348 |
$(VISUALC)\\lib\\oldnames.lib |
349 |
$(VISUALC)\\lib\\kernel32.lib ; |
350 |
OPTIM ?= "" ; |
351 |
STDHDRS ?= $(INTELC)\include $(VISUALC)\\include ; |
352 |
UNDEFFLAG ?= "/u _" ; |
353 |
} |
354 |
else if $(TOOLSET) = WATCOM |
355 |
{ |
356 |
ECHO "Compiler is Watcom C/C++" ; |
357 |
|
358 |
AR ?= wlib ; |
359 |
CC ?= wcc386 ; |
360 |
CCFLAGS ?= /zq /DWIN32 /I$(WATCOM)\\h ; # zq=quiet |
361 |
C++ ?= wpp386 ; |
362 |
C++FLAGS ?= $(CCFLAGS) ; |
363 |
DOT ?= . ; |
364 |
DOTDOT ?= .. ; |
365 |
FORTRAN ?= wfc386 ; |
366 |
LINK ?= wcl386 ; |
367 |
LINKFLAGS ?= /zq ; # zq=quiet |
368 |
LINKLIBS ?= ; |
369 |
NOARSCAN ?= true ; |
370 |
OPTIM ?= ; |
371 |
STDHDRS ?= $(WATCOM)\\h $(WATCOM)\\h\\nt ; |
372 |
UNDEFFLAG ?= "/u _" ; |
373 |
} |
374 |
else if $(TOOLSET) = MINGW |
375 |
{ |
376 |
ECHO "Compiler is GCC with Mingw" ; |
377 |
|
378 |
AR ?= ar -ru ; |
379 |
CC ?= gcc ; |
380 |
CCFLAGS ?= "" ; |
381 |
C++ ?= $(CC) ; |
382 |
C++FLAGS ?= $(CCFLAGS) ; |
383 |
FORTRAN ?= g77 ; |
384 |
LINK ?= $(CC) ; |
385 |
LINKFLAGS ?= "" ; |
386 |
LINKLIBS ?= "" ; |
387 |
OPTIM ?= ; |
388 |
SUFOBJ = .o ; |
389 |
SUFLIB = .a ; |
390 |
# NOARSCAN ?= true ; |
391 |
} |
392 |
else if $(TOOLSET) = LCC |
393 |
{ |
394 |
ECHO "Compiler is Win32-LCC" ; |
395 |
|
396 |
AR ?= lcclib ; |
397 |
CC ?= lcc ; |
398 |
CCFLAGS ?= "" ; |
399 |
C++ ?= $(CC) ; |
400 |
C++FLAGS ?= $(CCFLAGS) ; |
401 |
LINK ?= lcclnk ; |
402 |
LINKFLAGS ?= "" ; |
403 |
LINKLIBS ?= "" ; |
404 |
OPTIM ?= ; |
405 |
NOARSCAN = true ; |
406 |
} |
407 |
else |
408 |
{ |
409 |
EXIT On NT, did not recognize compiler type. ; |
410 |
} |
411 |
} |
412 |
|
413 |
else if $(OS2) |
414 |
{ |
415 |
# the list of supported toolsets on Windows NT and Windows 95/98 |
416 |
# |
417 |
local SUPPORTED_TOOLSETS = "EMX" "WATCOM" ; |
418 |
|
419 |
# this variable holds the current toolset |
420 |
# |
421 |
TOOLSET = "" ; |
422 |
|
423 |
# if the JAM_TOOLSET environment variable is defined, check that it is |
424 |
# one of our supported values |
425 |
# |
426 |
if $(JAM_TOOLSET) |
427 |
{ |
428 |
local t ; |
429 |
|
430 |
for t in $(SUPPORTED_TOOLSETS) |
431 |
{ |
432 |
if $(t) = $(JAM_TOOLSET) { TOOLSET = $(t) ; } |
433 |
} |
434 |
|
435 |
if ! $(TOOLSET) |
436 |
{ |
437 |
ECHO "The JAM_TOOLSET environment variable is defined but its value" ; |
438 |
ECHO "is invalid, please use one of the following:" ; |
439 |
ECHO ; |
440 |
|
441 |
for t in $(SUPPORTED_TOOLSETS) { ECHO " " $(t) ; } |
442 |
EXIT ; |
443 |
} |
444 |
} |
445 |
|
446 |
# if TOOLSET is empty, we'll try to detect the toolset from other |
447 |
# environment variables to remain backwards compatible with Jam 2.3 |
448 |
# |
449 |
if ! $(TOOLSET) |
450 |
{ |
451 |
if $(watcom) |
452 |
{ |
453 |
WATCOM = $(watcom) ; |
454 |
TOOLSET = WATCOM ; |
455 |
} |
456 |
else |
457 |
{ |
458 |
ECHO "Jam cannot be run because you didn't indicate which compilation toolset" ; |
459 |
ECHO "to use. To do so, follow these simple instructions:" ; |
460 |
ECHO ; |
461 |
ECHO " - define one of the following environment variable, with the" ; |
462 |
ECHO " appropriate value according to this list:" ; |
463 |
ECHO ; |
464 |
ECHO " Variable Toolset Description" ; |
465 |
ECHO ; |
466 |
ECHO " WATCOM Watcom C/C++ Watcom install path" ; |
467 |
ECHO " EMX EMX (gcc) EMX install path" ; |
468 |
ECHO " VISUALAGE IBM Visual Age C/C++ VisualAge install path" ; |
469 |
ECHO ; |
470 |
ECHO " - define the JAM_TOOLSET environment variable with the *name*" ; |
471 |
ECHO " of the toolset variable you want to use." ; |
472 |
ECHO ; |
473 |
ECHO " e.g.: set WATCOM=C:\WATCOM" ; |
474 |
ECHO " set JAM_TOOLSET=WATCOM" ; |
475 |
ECHO ; |
476 |
EXIT ; |
477 |
} |
478 |
} |
479 |
|
480 |
RM = del /f ; |
481 |
CP = copy ; |
482 |
MV ?= move ; |
483 |
DOT ?= . ; |
484 |
DOTDOT ?= .. ; |
485 |
SUFLIB ?= .lib ; |
486 |
SUFOBJ ?= .obj ; |
487 |
SUFEXE ?= .exe ; |
488 |
|
489 |
if $(TOOLSET) = WATCOM |
490 |
{ |
491 |
AR ?= wlib ; |
492 |
BINDIR ?= \\os2\\apps ; |
493 |
CC ?= wcc386 ; |
494 |
CCFLAGS ?= /zq /DOS2 /I$(WATCOM)\\h ; # zq=quiet |
495 |
C++ ?= wpp386 ; |
496 |
C++FLAGS ?= $(CCFLAGS) ; |
497 |
LINK ?= wcl386 ; |
498 |
LINKFLAGS ?= /zq ; # zq=quiet |
499 |
LINKLIBS ?= ; |
500 |
NOARSCAN ?= true ; |
501 |
OPTIM ?= ; |
502 |
SLASH ?= \\ ; |
503 |
STDHDRS ?= $(WATCOM)\\h ; |
504 |
UNDEFFLAG ?= "/u _" ; |
505 |
} |
506 |
else if $(TOOLSET) = EMX |
507 |
{ |
508 |
ECHO "Compiler is GCC-EMX" ; |
509 |
AR ?= ar -ru ; |
510 |
CC ?= gcc ; |
511 |
CCFLAGS ?= "" ; |
512 |
C++ ?= $(CC) ; |
513 |
C++FLAGS ?= $(CCFLAGS) ; |
514 |
LINK ?= $(CC) ; |
515 |
LINKFLAGS ?= "" ; |
516 |
LINKLIBS ?= "" ; |
517 |
OPTIM ?= ; |
518 |
SUFOBJ = .o ; |
519 |
SUFLIB = .a ; |
520 |
UNDEFFLAG ?= "-U" ; |
521 |
SLASH = / ; |
522 |
# NOARSCAN ?= true ; |
523 |
} |
524 |
else |
525 |
{ |
526 |
# should never happen |
527 |
EXIT "Sorry, but the $(JAM_TOOLSET) toolset isn't supported for now" ; |
528 |
} |
529 |
} |
530 |
else if $(VMS) |
531 |
{ |
532 |
C++ ?= cxx ; |
533 |
C++FLAGS ?= ; |
534 |
CC ?= cc ; |
535 |
CCFLAGS ?= ; |
536 |
CHMOD ?= set file/prot= ; |
537 |
CP ?= copy/replace ; |
538 |
CRELIB ?= true ; |
539 |
DOT ?= [] ; |
540 |
DOTDOT ?= [-] ; |
541 |
EXEMODE ?= (w:e) ; |
542 |
FILEMODE ?= (w:r) ; |
543 |
HDRS ?= ; |
544 |
LINK ?= link ; |
545 |
LINKFLAGS ?= "" ; |
546 |
LINKLIBS ?= ; |
547 |
MKDIR ?= create/dir ; |
548 |
MV ?= rename ; |
549 |
OPTIM ?= "" ; |
550 |
RM ?= delete ; |
551 |
RUNVMS ?= mcr ; |
552 |
SHELLMODE ?= (w:er) ; |
553 |
SLASH ?= . ; |
554 |
STDHDRS ?= decc$library_include ; |
555 |
SUFEXE ?= .exe ; |
556 |
SUFLIB ?= .olb ; |
557 |
SUFOBJ ?= .obj ; |
558 |
|
559 |
switch $(OS) |
560 |
{ |
561 |
case OPENVMS : CCFLAGS ?= /stand=vaxc ; |
562 |
case VMS : LINKLIBS ?= sys$library:vaxcrtl.olb/lib ; |
563 |
} |
564 |
} |
565 |
else if $(MAC) |
566 |
{ |
567 |
local OPT ; |
568 |
|
569 |
CW ?= "{CW}" ; |
570 |
|
571 |
MACHDRS ?= |
572 |
"$(UMACHDRS):Universal:Interfaces:CIncludes" |
573 |
"$(CW):MSL:MSL_C:MSL_Common:Include" |
574 |
"$(CW):MSL:MSL_C:MSL_MacOS:Include" ; |
575 |
|
576 |
MACLIBS ?= |
577 |
"$(CW):MacOS Support:Universal:Libraries:StubLibraries:Interfacelib" |
578 |
"$(CW):MacOS Support:Universal:Libraries:StubLibraries:Mathlib" ; |
579 |
|
580 |
MPWLIBS ?= |
581 |
"$(CW):MacOS Support:Libraries:Runtime:Runtime PPC:MSL MPWCRuntime.lib" |
582 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL C.PPC MPW.Lib" ; |
583 |
|
584 |
MPWNLLIBS ?= |
585 |
"$(CW):MacOS Support:Libraries:Runtime:Runtime PPC:MSL MPWCRuntime.lib" |
586 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL C.PPC MPW(NL).Lib" ; |
587 |
|
588 |
SIOUXHDRS ?= ; |
589 |
|
590 |
SIOUXLIBS ?= |
591 |
"$(CW):MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.lib" |
592 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL SIOUX.PPC.Lib" |
593 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL C.PPC.Lib" ; |
594 |
|
595 |
C++ ?= mwcppc ; |
596 |
C++FLAGS ?= -w off -nomapcr ; |
597 |
CC ?= mwcppc ; |
598 |
CCFLAGS ?= -w off -nomapcr ; |
599 |
CP ?= duplicate -y ; |
600 |
DOT ?= ":" ; |
601 |
DOTDOT ?= "::" ; |
602 |
HDRS ?= $(MACHDRS) $(MPWHDRS) ; |
603 |
LINK ?= mwlinkppc ; |
604 |
LINKFLAGS ?= -mpwtool -warn ; |
605 |
LINKLIBS ?= $(MACLIBS) $(MPWLIBS) ; |
606 |
MKDIR ?= newfolder ; |
607 |
MV ?= rename -y ; |
608 |
NOARSCAN ?= true ; |
609 |
OPTIM ?= ; |
610 |
RM ?= delete -y ; |
611 |
SLASH ?= ":" ; |
612 |
STDHDRS ?= ; |
613 |
SUFLIB ?= .lib ; |
614 |
SUFOBJ ?= .o ; |
615 |
} |
616 |
else if $(OS) = BEOS && $(METROWERKS) |
617 |
{ |
618 |
AR ?= mwld -xml -o ; |
619 |
BINDIR ?= /boot/apps ; |
620 |
CC ?= mwcc ; |
621 |
CCFLAGS ?= -nosyspath ; |
622 |
C++ ?= $(CC) ; |
623 |
C++FLAGS ?= -nosyspath ; |
624 |
FORTRAN ?= "" ; |
625 |
LIBDIR ?= /boot/develop/libraries ; |
626 |
LINK ?= mwld ; |
627 |
LINKFLAGS ?= "" ; |
628 |
MANDIR ?= /boot/documentation/"Shell Tools"/HTML ; |
629 |
NOARSCAN ?= true ; |
630 |
STDHDRS ?= /boot/develop/headers/posix ; |
631 |
} |
632 |
else if $(OS) = BEOS |
633 |
{ |
634 |
BINDIR ?= /boot/apps ; |
635 |
CC ?= gcc ; |
636 |
C++ ?= $(CC) ; |
637 |
FORTRAN ?= "" ; |
638 |
LIBDIR ?= /boot/develop/libraries ; |
639 |
LINK ?= gcc ; |
640 |
LINKLIBS ?= -lnet ; |
641 |
NOARSCAN ?= true ; |
642 |
STDHDRS ?= /boot/develop/headers/posix ; |
643 |
} |
644 |
else if $(UNIX) |
645 |
{ |
646 |
switch $(OS) |
647 |
{ |
648 |
case AIX : |
649 |
LINKLIBS ?= -lbsd ; |
650 |
|
651 |
case AMIGA : |
652 |
CC ?= gcc ; |
653 |
YACC ?= bison ; |
654 |
|
655 |
case CYGWIN : |
656 |
CC ?= gcc ; |
657 |
CCFLAGS += -D__cygwin__ ; |
658 |
LEX ?= flex ; |
659 |
JAMSHELL ?= sh -c ; |
660 |
RANLIB ?= "" ; |
661 |
SUFEXE ?= .exe ; |
662 |
YACC ?= bison ; |
663 |
|
664 |
case DGUX : |
665 |
RANLIB ?= "" ; |
666 |
RELOCATE ?= true ; |
667 |
|
668 |
case HPUX : |
669 |
RANLIB ?= "" ; |
670 |
|
671 |
case INTERIX : |
672 |
CC ?= gcc ; |
673 |
JAMSHELL ?= sh -c ; |
674 |
RANLIB ?= "" ; |
675 |
|
676 |
case IRIX : |
677 |
RANLIB ?= "" ; |
678 |
|
679 |
case MPEIX : |
680 |
CC ?= gcc ; |
681 |
C++ ?= gcc ; |
682 |
CCFLAGS += -D_POSIX_SOURCE ; |
683 |
HDRS += /usr/include ; |
684 |
RANLIB ?= "" ; |
685 |
NOARSCAN ?= true ; |
686 |
NOARUPDATE ?= true ; |
687 |
|
688 |
case MVS : |
689 |
RANLIB ?= "" ; |
690 |
|
691 |
case NEXT : |
692 |
AR ?= libtool -o ; |
693 |
RANLIB ?= "" ; |
694 |
|
695 |
case MACOSX : |
696 |
AR ?= libtool -o ; |
697 |
C++ ?= c++ ; |
698 |
MANDIR ?= /usr/local/share/man ; |
699 |
RANLIB ?= "" ; |
700 |
|
701 |
case NCR : |
702 |
RANLIB ?= "" ; |
703 |
|
704 |
case PTX : |
705 |
RANLIB ?= "" ; |
706 |
|
707 |
case QNX : |
708 |
AR ?= wlib ; |
709 |
CC ?= cc ; |
710 |
CCFLAGS ?= -Q ; # quiet |
711 |
C++ ?= $(CC) ; |
712 |
C++FLAGS ?= -Q ; # quiet |
713 |
LINK ?= $(CC) ; |
714 |
LINKFLAGS ?= -Q ; # quiet |
715 |
NOARSCAN ?= true ; |
716 |
RANLIB ?= "" ; |
717 |
|
718 |
case SCO : |
719 |
RANLIB ?= "" ; |
720 |
RELOCATE ?= true ; |
721 |
|
722 |
case SINIX : |
723 |
RANLIB ?= "" ; |
724 |
|
725 |
case SOLARIS : |
726 |
RANLIB ?= "" ; |
727 |
AR ?= "/usr/ccs/bin/ar ru" ; |
728 |
|
729 |
case UNICOS : |
730 |
NOARSCAN ?= true ; |
731 |
OPTIM ?= -O0 ; |
732 |
|
733 |
case UNIXWARE : |
734 |
RANLIB ?= "" ; |
735 |
RELOCATE ?= true ; |
736 |
} |
737 |
|
738 |
# UNIX defaults |
739 |
|
740 |
CCFLAGS ?= ; |
741 |
C++FLAGS ?= $(CCFLAGS) ; |
742 |
CHMOD ?= chmod ; |
743 |
LEX ?= lex ; |
744 |
LINKFLAGS ?= $(CCFLAGS) ; |
745 |
LINKLIBS ?= ; |
746 |
OPTIM ?= -O ; |
747 |
RANLIB ?= ranlib ; |
748 |
YACC ?= yacc ; |
749 |
YACCFILES ?= y.tab ; |
750 |
YACCFLAGS ?= -d ; |
751 |
} |
752 |
|
753 |
# |
754 |
# General defaults; a lot like UNIX |
755 |
# |
756 |
|
757 |
AR ?= ar ru ; |
758 |
AS ?= as ; |
759 |
ASFLAGS ?= ; |
760 |
AWK ?= awk ; |
761 |
BINDIR ?= /usr/local/bin ; |
762 |
C++ ?= gcc ; |
763 |
C++FLAGS ?= ; |
764 |
CC ?= gcc ; |
765 |
CCFLAGS ?= ; |
766 |
CP ?= cp -f ; |
767 |
CRELIB ?= ; |
768 |
DOT ?= . ; |
769 |
DOTDOT ?= .. ; |
770 |
EXEMODE ?= 711 ; |
771 |
FILEMODE ?= 644 ; |
772 |
FORTRAN ?= g77 ; |
773 |
FORTRANFLAGS ?= ; |
774 |
HDRS ?= ; |
775 |
JAMFILE ?= Jamfile ; |
776 |
JAMRULES ?= Jamrules ; |
777 |
LEX ?= lex ; |
778 |
LIBDIR ?= /usr/local/lib ; |
779 |
LINK ?= $(CC) ; |
780 |
LINKFLAGS ?= ; |
781 |
LINKLIBS ?= ; |
782 |
LN ?= ln ; |
783 |
MANDIR ?= /usr/local/man ; |
784 |
MKDIR ?= mkdir ; |
785 |
MV ?= mv -f ; |
786 |
OPTIM ?= ; |
787 |
RCP ?= rcp ; |
788 |
RM ?= rm -f ; |
789 |
RSH ?= rsh ; |
790 |
SED ?= sed ; |
791 |
SHELLHEADER ?= "#!/bin/sh" ; |
792 |
SHELLMODE ?= 755 ; |
793 |
SLASH ?= / ; |
794 |
STDHDRS ?= /usr/include ; |
795 |
SUFEXE ?= "" ; |
796 |
SUFLIB ?= .a ; |
797 |
SUFOBJ ?= .o ; |
798 |
UNDEFFLAG ?= "-u _" ; |
799 |
YACC ?= ; |
800 |
YACCFILES ?= ; |
801 |
YACCFLAGS ?= ; |
802 |
|
803 |
HDRPATTERN = |
804 |
"^[ ]*#[ ]*include[ ]*[<\"]([^\">]*)[\">].*$" ; |
805 |
|
806 |
OSFULL = $(OS)$(OSVER)$(OSPLAT) $(OS)$(OSPLAT) $(OS)$(OSVER) $(OS) ; |
807 |
|
808 |
|
809 |
# |
810 |
# Base dependencies - first for "bootstrap" kinds of rules |
811 |
# |
812 |
|
813 |
DEPENDS all : shell files lib exe obj ; |
814 |
DEPENDS all shell files lib exe obj : first ; |
815 |
NOTFILE all first shell files lib exe obj dirs clean uninstall ; |
816 |
ALWAYS clean uninstall ; |
817 |
|
818 |
# |
819 |
# Rules |
820 |
# |
821 |
|
822 |
rule As |
823 |
{ |
824 |
DEPENDS $(<) : $(>) ; |
825 |
ASFLAGS on $(<) += $(ASFLAGS) $(SUBDIRASFLAGS) ; |
826 |
} |
827 |
|
828 |
rule Bulk |
829 |
{ |
830 |
local i ; |
831 |
|
832 |
for i in $(>) |
833 |
{ |
834 |
File $(i:D=$(<)) : $(i) ; |
835 |
} |
836 |
} |
837 |
|
838 |
rule Cc |
839 |
{ |
840 |
local _h ; |
841 |
|
842 |
DEPENDS $(<) : $(>) ; |
843 |
|
844 |
# Just to clarify here: this sets the per-target CCFLAGS to |
845 |
# be the current value of (global) CCFLAGS and SUBDIRCCFLAGS. |
846 |
|
847 |
CCFLAGS on $(<) += $(CCFLAGS) $(SUBDIRCCFLAGS) ; |
848 |
|
849 |
# If the compiler's -o flag doesn't work, relocate the .o |
850 |
|
851 |
if $(RELOCATE) |
852 |
{ |
853 |
CcMv $(<) : $(>) ; |
854 |
} |
855 |
|
856 |
_h = $(SEARCH_SOURCE) $(HDRS) $(SUBDIRHDRS) ; |
857 |
|
858 |
if $(VMS) && $(_h) |
859 |
{ |
860 |
SLASHINC on $(<) = "/inc=(" $(_h[1]) ,$(_h[2-]) ")" ; |
861 |
} |
862 |
else if $(MAC) && $(_h) |
863 |
{ |
864 |
local _i _j ; |
865 |
_j = $(_h[1]) ; |
866 |
for _i in $(_h[2-]) |
867 |
{ |
868 |
_j = $(_j),$(_i) ; |
869 |
} |
870 |
MACINC on $(<) = \"$(_j)\" ; |
871 |
} |
872 |
} |
873 |
|
874 |
rule C++ |
875 |
{ |
876 |
local _h ; |
877 |
|
878 |
DEPENDS $(<) : $(>) ; |
879 |
C++FLAGS on $(<) += $(C++FLAGS) $(SUBDIRC++FLAGS) ; |
880 |
|
881 |
if $(RELOCATE) |
882 |
{ |
883 |
CcMv $(<) : $(>) ; |
884 |
} |
885 |
|
886 |
_h = $(SEARCH_SOURCE) $(HDRS) $(SUBDIRHDRS) ; |
887 |
|
888 |
if $(VMS) && $(_h) |
889 |
{ |
890 |
SLASHINC on $(<) = "/inc=(" $(_h[1]) ,$(_h[2-]) ")" ; |
891 |
} |
892 |
else if $(MAC) && $(_h) |
893 |
{ |
894 |
local _i _j ; |
895 |
_j = $(_h[1]) ; |
896 |
for _i in $(_h[2-]) |
897 |
{ |
898 |
_j = $(_j),$(_i) ; |
899 |
} |
900 |
MACINC on $(<) = \"$(_j)\" ; |
901 |
} |
902 |
} |
903 |
|
904 |
rule Chmod |
905 |
{ |
906 |
if $(CHMOD) { Chmod1 $(<) ; } |
907 |
} |
908 |
|
909 |
rule File |
910 |
{ |
911 |
DEPENDS files : $(<) ; |
912 |
DEPENDS $(<) : $(>) ; |
913 |
SEARCH on $(>) = $(SEARCH_SOURCE) ; |
914 |
MODE on $(<) = $(FILEMODE) ; |
915 |
Chmod $(<) ; |
916 |
} |
917 |
|
918 |
rule Fortran |
919 |
{ |
920 |
DEPENDS $(<) : $(>) ; |
921 |
} |
922 |
|
923 |
rule GenFile |
924 |
{ |
925 |
local _t = [ FGristSourceFiles $(<) ] ; |
926 |
local _s = [ FAppendSuffix $(>[1]) : $(SUFEXE) ] ; |
927 |
Depends $(_t) : $(_s) $(>[2-]) ; |
928 |
GenFile1 $(_t) : $(_s) $(>[2-]) ; |
929 |
Clean clean : $(_t) ; |
930 |
} |
931 |
|
932 |
rule GenFile1 |
933 |
{ |
934 |
MakeLocate $(<) : $(LOCATE_SOURCE) ; |
935 |
SEARCH on $(>) = $(SEARCH_SOURCE) ; |
936 |
} |
937 |
|
938 |
rule HardLink |
939 |
{ |
940 |
DEPENDS files : $(<) ; |
941 |
DEPENDS $(<) : $(>) ; |
942 |
SEARCH on $(>) = $(SEARCH_SOURCE) ; |
943 |
} |
944 |
|
945 |
rule HdrMacroFile |
946 |
{ |
947 |
# HdrMacroFile file ; |
948 |
# |
949 |
# this rule is used to indicate that a given file contains definitions |
950 |
# for filename macros (e.g. "#define MYFILE_H <myfile.h>") that can |
951 |
# later be used in #include statements in the rest of the source |
952 |
# |
953 |
# theses files must be parsed before any make is tried.. |
954 |
# |
955 |
HDRMACRO $(<) ; |
956 |
} |
957 |
|
958 |
rule HdrRule |
959 |
{ |
960 |
# HdrRule source : headers ; |
961 |
|
962 |
# N.B. This rule is called during binding, potentially after |
963 |
# the fate of many targets has been determined, and must be |
964 |
# used with caution: don't add dependencies to unrelated |
965 |
# targets, and don't set variables on $(<). |
966 |
|
967 |
# Tell Jam that anything depending on $(<) also depends on $(>), |
968 |
# set SEARCH so Jam can find the headers, but then say we don't |
969 |
# care if we can't actually find the headers (they may have been |
970 |
# within ifdefs), |
971 |
|
972 |
local s ; |
973 |
|
974 |
if $(HDRGRIST) |
975 |
{ |
976 |
s = $(>:G=$(HDRGRIST)) ; |
977 |
} else { |
978 |
s = $(>) ; |
979 |
} |
980 |
|
981 |
INCLUDES $(<) : $(s) ; |
982 |
SEARCH on $(s) = $(HDRSEARCH) ; |
983 |
NOCARE $(s) ; |
984 |
|
985 |
# Propagate on $(<) to $(>) |
986 |
|
987 |
HDRSEARCH on $(s) = $(HDRSEARCH) ; |
988 |
HDRSCAN on $(s) = $(HDRSCAN) ; |
989 |
HDRRULE on $(s) = $(HDRRULE) ; |
990 |
HDRGRIST on $(s) = $(HDRGRIST) ; |
991 |
} |
992 |
|
993 |
rule InstallInto |
994 |
{ |
995 |
local i t ; |
996 |
|
997 |
t = $(>:G=installed) ; |
998 |
|
999 |
DEPENDS install : $(t) ; |
1000 |
DEPENDS $(t) : $(>) ; |
1001 |
SEARCH on $(>) = $(SEARCH_SOURCE) ; |
1002 |
MakeLocate $(t) : $(<) ; |
1003 |
|
1004 |
# Arrange for jam uninstall |
1005 |
|
1006 |
Clean uninstall : $(t) ; |
1007 |
|
1008 |
for i in $(>) |
1009 |
{ |
1010 |
Install $(i:G=installed) : $(i) ; |
1011 |
} |
1012 |
|
1013 |
Chmod $(t) ; |
1014 |
|
1015 |
if $(UNIX) |
1016 |
{ |
1017 |
if $(OWNER) { Chown $(t) ; OWNER on $(t) = $(OWNER) ; } |
1018 |
if $(GROUP) { Chgrp $(t) ; GROUP on $(t) = $(GROUP) ; } |
1019 |
} |
1020 |
} |
1021 |
|
1022 |
rule InstallBin |
1023 |
{ |
1024 |
local _t = [ FAppendSuffix $(>) : $(SUFEXE) ] ; |
1025 |
|
1026 |
InstallInto $(<) : $(_t) ; |
1027 |
MODE on $(_t:G=installed) = $(EXEMODE) ; |
1028 |
} |
1029 |
|
1030 |
rule InstallFile |
1031 |
{ |
1032 |
InstallInto $(<) : $(>) ; |
1033 |
MODE on $(>:G=installed) = $(FILEMODE) ; |
1034 |
} |
1035 |
|
1036 |
rule InstallLib |
1037 |
{ |
1038 |
InstallInto $(<) : $(>) ; |
1039 |
MODE on $(>:G=installed) = $(FILEMODE) ; |
1040 |
} |
1041 |
|
1042 |
rule InstallMan |
1043 |
{ |
1044 |
# Really this just strips the . from the suffix |
1045 |
|
1046 |
local i s d ; |
1047 |
|
1048 |
for i in $(>) |
1049 |
{ |
1050 |
switch $(i:S) |
1051 |
{ |
1052 |
case .1 : s = 1 ; case .2 : s = 2 ; case .3 : s = 3 ; |
1053 |
case .4 : s = 4 ; case .5 : s = 5 ; case .6 : s = 6 ; |
1054 |
case .7 : s = 7 ; case .8 : s = 8 ; case .l : s = l ; |
1055 |
case .n : s = n ; case .man : s = 1 ; |
1056 |
} |
1057 |
|
1058 |
d = man$(s) ; |
1059 |
|
1060 |
InstallInto $(d:R=$(<)) : $(i) ; |
1061 |
} |
1062 |
|
1063 |
MODE on $(>:G=installed) = $(FILEMODE) ; |
1064 |
} |
1065 |
|
1066 |
rule InstallShell |
1067 |
{ |
1068 |
InstallInto $(<) : $(>) ; |
1069 |
MODE on $(>:G=installed) = $(SHELLMODE) ; |
1070 |
} |
1071 |
|
1072 |
rule Lex |
1073 |
{ |
1074 |
LexMv $(<) : $(>) ; |
1075 |
DEPENDS $(<) : $(>) ; |
1076 |
MakeLocate $(<) : $(LOCATE_SOURCE) ; |
1077 |
Clean clean : $(<) ; |
1078 |
} |
1079 |
|
1080 |
rule Library |
1081 |
{ |
1082 |
LibraryFromObjects $(<) : $(>:S=$(SUFOBJ)) ; |
1083 |
Objects $(>) ; |
1084 |
} |
1085 |
|
1086 |
rule LibraryFromObjects |
1087 |
{ |
1088 |
local _i _l _s ; |
1089 |
|
1090 |
# Add grist to file names |
1091 |
|
1092 |
_s = [ FGristFiles $(>) ] ; |
1093 |
_l = $(<:S=$(SUFLIB)) ; |
1094 |
|
1095 |
# library depends on its member objects |
1096 |
|
1097 |
if $(KEEPOBJS) |
1098 |
{ |
1099 |
DEPENDS obj : $(_s) ; |
1100 |
} |
1101 |
else |
1102 |
{ |
1103 |
DEPENDS lib : $(_l) ; |
1104 |
} |
1105 |
|
1106 |
# Set LOCATE for the library and its contents. The bound |
1107 |
# value shows up as $(NEEDLIBS) on the Link actions. |
1108 |
# For compatibility, we only do this if the library doesn't |
1109 |
# already have a path. |
1110 |
|
1111 |
if ! $(_l:D) |
1112 |
{ |
1113 |
MakeLocate $(_l) $(_l)($(_s:BS)) : $(LOCATE_TARGET) ; |
1114 |
} |
1115 |
|
1116 |
if $(NOARSCAN) |
1117 |
{ |
1118 |
# If we can't scan the library to timestamp its contents, |
1119 |
# we have to just make the library depend directly on the |
1120 |
# on-disk object files. |
1121 |
|
1122 |
DEPENDS $(_l) : $(_s) ; |
1123 |
} |
1124 |
else |
1125 |
{ |
1126 |
# If we can scan the library, we make the library depend |
1127 |
# on its members and each member depend on the on-disk |
1128 |
# object file. |
1129 |
|
1130 |
DEPENDS $(_l) : $(_l)($(_s:BS)) ; |
1131 |
|
1132 |
for _i in $(_s) |
1133 |
{ |
1134 |
DEPENDS $(_l)($(_i:BS)) : $(_i) ; |
1135 |
} |
1136 |
} |
1137 |
|
1138 |
Clean clean : $(_l) ; |
1139 |
|
1140 |
if $(CRELIB) { CreLib $(_l) : $(_s[1]) ; } |
1141 |
|
1142 |
Archive $(_l) : $(_s) ; |
1143 |
|
1144 |
if $(RANLIB) { Ranlib $(_l) ; } |
1145 |
|
1146 |
# If we can't scan the library, we have to leave the .o's around. |
1147 |
|
1148 |
if ! ( $(NOARSCAN) || $(KEEPOBJS) ) { RmTemps $(_l) : $(_s) ; } |
1149 |
} |
1150 |
|
1151 |
rule Link |
1152 |
{ |
1153 |
MODE on $(<) = $(EXEMODE) ; |
1154 |
Chmod $(<) ; |
1155 |
} |
1156 |
|
1157 |
rule LinkLibraries |
1158 |
{ |
1159 |
# make library dependencies of target |
1160 |
# set NEEDLIBS variable used by 'actions Main' |
1161 |
|
1162 |
local _t = [ FAppendSuffix $(<) : $(SUFEXE) ] ; |
1163 |
|
1164 |
DEPENDS $(_t) : $(>:S=$(SUFLIB)) ; |
1165 |
NEEDLIBS on $(_t) += $(>:S=$(SUFLIB)) ; |
1166 |
} |
1167 |
|
1168 |
rule Main |
1169 |
{ |
1170 |
MainFromObjects $(<) : $(>:S=$(SUFOBJ)) ; |
1171 |
Objects $(>) ; |
1172 |
} |
1173 |
|
1174 |
rule MainFromObjects |
1175 |
{ |
1176 |
local _s _t ; |
1177 |
|
1178 |
# Add grist to file names |
1179 |
# Add suffix to exe |
1180 |
|
1181 |
_s = [ FGristFiles $(>) ] ; |
1182 |
_t = [ FAppendSuffix $(<) : $(SUFEXE) ] ; |
1183 |
|
1184 |
if $(_t) != $(<) |
1185 |
{ |
1186 |
DEPENDS $(<) : $(_t) ; |
1187 |
NOTFILE $(<) ; |
1188 |
} |
1189 |
|
1190 |
# make compiled sources a dependency of target |
1191 |
|
1192 |
DEPENDS exe : $(_t) ; |
1193 |
DEPENDS $(_t) : $(_s) ; |
1194 |
MakeLocate $(_t) : $(LOCATE_TARGET) ; |
1195 |
|
1196 |
Clean clean : $(_t) ; |
1197 |
|
1198 |
Link $(_t) : $(_s) ; |
1199 |
} |
1200 |
|
1201 |
rule MakeLocate |
1202 |
{ |
1203 |
if $(>) |
1204 |
{ |
1205 |
LOCATE on $(<) = $(>) ; |
1206 |
Depends $(<) : $(>[1]) ; |
1207 |
MkDir $(>[1]) ; |
1208 |
} |
1209 |
} |
1210 |
|
1211 |
rule MkDir |
1212 |
{ |
1213 |
# If dir exists, don't update it |
1214 |
# Do this even for $(DOT). |
1215 |
|
1216 |
NOUPDATE $(<) ; |
1217 |
|
1218 |
if $(<) != $(DOT) && ! $($(<)-mkdir) |
1219 |
{ |
1220 |
local s ; |
1221 |
|
1222 |
# Cheesy gate to prevent multiple invocations on same dir |
1223 |
# MkDir1 has the actions |
1224 |
# Arrange for jam dirs |
1225 |
|
1226 |
$(<)-mkdir = true ; |
1227 |
MkDir1 $(<) ; |
1228 |
Depends dirs : $(<) ; |
1229 |
|
1230 |
# Recursively make parent directories. |
1231 |
# $(<:P) = $(<)'s parent, & we recurse until root |
1232 |
|
1233 |
s = $(<:P) ; |
1234 |
|
1235 |
if $(NT) |
1236 |
{ |
1237 |
switch $(s) |
1238 |
{ |
1239 |
case *: : s = ; |
1240 |
case *:\\ : s = ; |
1241 |
} |
1242 |
} |
1243 |
|
1244 |
if $(s) && $(s) != $(<) |
1245 |
{ |
1246 |
Depends $(<) : $(s) ; |
1247 |
MkDir $(s) ; |
1248 |
} |
1249 |
else if $(s) |
1250 |
{ |
1251 |
NOTFILE $(s) ; |
1252 |
} |
1253 |
|
1254 |
} |
1255 |
} |
1256 |
|
1257 |
rule Object |
1258 |
{ |
1259 |
local h ; |
1260 |
|
1261 |
# locate object and search for source, if wanted |
1262 |
|
1263 |
Clean clean : $(<) ; |
1264 |
|
1265 |
MakeLocate $(<) : $(LOCATE_TARGET) ; |
1266 |
SEARCH on $(>) = $(SEARCH_SOURCE) ; |
1267 |
|
1268 |
# Save HDRS for -I$(HDRS) on compile. |
1269 |
# We shouldn't need -I$(SEARCH_SOURCE) as cc can find headers |
1270 |
# in the .c file's directory, but generated .c files (from |
1271 |
# yacc, lex, etc) are located in $(LOCATE_TARGET), possibly |
1272 |
# different from $(SEARCH_SOURCE). |
1273 |
|
1274 |
HDRS on $(<) = $(SEARCH_SOURCE) $(HDRS) $(SUBDIRHDRS) ; |
1275 |
|
1276 |
# handle #includes for source: Jam scans for headers with |
1277 |
# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE) |
1278 |
# with the scanned file as the target and the found headers |
1279 |
# as the sources. HDRSEARCH is the value of SEARCH used for |
1280 |
# the found header files. Finally, if jam must deal with |
1281 |
# header files of the same name in different directories, |
1282 |
# they can be distinguished with HDRGRIST. |
1283 |
|
1284 |
# $(h) is where cc first looks for #include "foo.h" files. |
1285 |
# If the source file is in a distant directory, look there. |
1286 |
# Else, look in "" (the current directory). |
1287 |
|
1288 |
if $(SEARCH_SOURCE) |
1289 |
{ |
1290 |
h = $(SEARCH_SOURCE) ; |
1291 |
} |
1292 |
else |
1293 |
{ |
1294 |
h = "" ; |
1295 |
} |
1296 |
|
1297 |
HDRRULE on $(>) = HdrRule ; |
1298 |
HDRSCAN on $(>) = $(HDRPATTERN) ; |
1299 |
HDRSEARCH on $(>) = $(HDRS) $(SUBDIRHDRS) $(h) $(STDHDRS) ; |
1300 |
HDRGRIST on $(>) = $(HDRGRIST) ; |
1301 |
|
1302 |
# if source is not .c, generate .c with specific rule |
1303 |
|
1304 |
switch $(>:S) |
1305 |
{ |
1306 |
case .asm : As $(<) : $(>) ; |
1307 |
case .c : Cc $(<) : $(>) ; |
1308 |
case .C : C++ $(<) : $(>) ; |
1309 |
case .cc : C++ $(<) : $(>) ; |
1310 |
case .cpp : C++ $(<) : $(>) ; |
1311 |
case .f : Fortran $(<) : $(>) ; |
1312 |
case .l : Cc $(<) : $(<:S=.c) ; |
1313 |
Lex $(<:S=.c) : $(>) ; |
1314 |
case .s : As $(<) : $(>) ; |
1315 |
case .y : Cc $(<) : $(<:S=.c) ; |
1316 |
Yacc $(<:S=.c) : $(>) ; |
1317 |
case * : UserObject $(<) : $(>) ; |
1318 |
} |
1319 |
} |
1320 |
|
1321 |
|
1322 |
rule ObjectCcFlags |
1323 |
{ |
1324 |
CCFLAGS on [ FGristFiles $(<:S=$(SUFOBJ)) ] += $(>) ; |
1325 |
} |
1326 |
|
1327 |
rule ObjectC++Flags |
1328 |
{ |
1329 |
C++FLAGS on [ FGristFiles $(<:S=$(SUFOBJ)) ] += $(>) ; |
1330 |
} |
1331 |
|
1332 |
rule ObjectHdrs |
1333 |
{ |
1334 |
HDRS on [ FGristFiles $(<:S=$(SUFOBJ)) ] += $(>) ; |
1335 |
} |
1336 |
|
1337 |
rule Objects |
1338 |
{ |
1339 |
local _i ; |
1340 |
|
1341 |
for _i in [ FGristFiles $(<) ] |
1342 |
{ |
1343 |
Object $(_i:S=$(SUFOBJ)) : $(_i) ; |
1344 |
DEPENDS obj : $(_i:S=$(SUFOBJ)) ; |
1345 |
} |
1346 |
} |
1347 |
|
1348 |
rule RmTemps |
1349 |
{ |
1350 |
TEMPORARY $(>) ; |
1351 |
} |
1352 |
|
1353 |
rule Setuid |
1354 |
{ |
1355 |
MODE on [ FAppendSuffix $(<) : $(SUFEXE) ] = 4711 ; |
1356 |
} |
1357 |
|
1358 |
rule Shell |
1359 |
{ |
1360 |
DEPENDS shell : $(<) ; |
1361 |
DEPENDS $(<) : $(>) ; |
1362 |
SEARCH on $(>) = $(SEARCH_SOURCE) ; |
1363 |
MODE on $(<) = $(SHELLMODE) ; |
1364 |
Clean clean : $(<) ; |
1365 |
Chmod $(<) ; |
1366 |
} |
1367 |
|
1368 |
rule SubDir |
1369 |
{ |
1370 |
local _r _s ; |
1371 |
|
1372 |
# |
1373 |
# SubDir TOP d1 [ ... ] |
1374 |
# |
1375 |
# This introduces a Jamfile that is part of a project tree |
1376 |
# rooted at $(TOP). It (only once) includes the project-specific |
1377 |
# rules file $(TOP)/Jamrules and then sets search & locate stuff. |
1378 |
# |
1379 |
# If the variable $(TOPRULES) is set (where TOP is the first arg |
1380 |
# to SubDir), that file is included instead of $(TOP)/Jamrules. |
1381 |
# |
1382 |
# d1 ... are the directory elements that lead to this directory |
1383 |
# from $(TOP). We construct the system dependent path from these |
1384 |
# directory elements in order to set search&locate stuff. |
1385 |
# |
1386 |
|
1387 |
if ! $($(<[1])) |
1388 |
{ |
1389 |
if ! $(<[1]) |
1390 |
{ |
1391 |
EXIT SubDir syntax error ; |
1392 |
} |
1393 |
|
1394 |
$(<[1]) = [ FSubDir $(<[2-]) ] ; |
1395 |
} |
1396 |
|
1397 |
# |
1398 |
# If $(TOP)/Jamrules hasn't been included, do so. |
1399 |
# |
1400 |
|
1401 |
if ! $($(<[1])-included) |
1402 |
{ |
1403 |
# Gated entry. |
1404 |
|
1405 |
$(<[1])-included = TRUE ; |
1406 |
|
1407 |
# File is $(TOPRULES) or $(TOP)/Jamrules. |
1408 |
|
1409 |
_r = $($(<[1])RULES) ; |
1410 |
|
1411 |
if ! $(_r) |
1412 |
{ |
1413 |
_r = $(JAMRULES:R=$($(<[1]))) ; |
1414 |
} |
1415 |
|
1416 |
# Include it. |
1417 |
|
1418 |
include $(_r) ; |
1419 |
} |
1420 |
|
1421 |
# Get path to current directory from root using SubDir. |
1422 |
# Save dir tokens for other potential uses. |
1423 |
|
1424 |
_s = [ FDirName $(<[2-]) ] ; |
1425 |
SUBDIR = $(_s:R=$($(<[1]))) ; |
1426 |
SUBDIR_TOKENS = $(<[2-]) ; |
1427 |
|
1428 |
# Now set up SEARCH_SOURCE, LOCATE_TARGET, SOURCE_GRIST |
1429 |
# These can be reset if needed. For example, if the source |
1430 |
# directory should not hold object files, LOCATE_TARGET can |
1431 |
# subsequently be redefined. |
1432 |
|
1433 |
SEARCH_SOURCE = $(SUBDIR) ; |
1434 |
LOCATE_SOURCE = $(ALL_LOCATE_TARGET) $(SUBDIR) ; |
1435 |
LOCATE_TARGET = $(ALL_LOCATE_TARGET) $(SUBDIR) ; |
1436 |
SOURCE_GRIST = [ FGrist $(<[2-]) ] ; |
1437 |
|
1438 |
# Reset per-directory ccflags, hdrs |
1439 |
|
1440 |
SUBDIRCCFLAGS = ; |
1441 |
SUBDIRC++FLAGS = ; |
1442 |
SUBDIRHDRS = ; |
1443 |
} |
1444 |
|
1445 |
rule SubDirCcFlags |
1446 |
{ |
1447 |
SUBDIRCCFLAGS += $(<) ; |
1448 |
} |
1449 |
|
1450 |
rule SubDirC++Flags |
1451 |
{ |
1452 |
SUBDIRC++FLAGS += $(<) ; |
1453 |
} |
1454 |
|
1455 |
rule SubDirHdrs |
1456 |
{ |
1457 |
SUBDIRHDRS += $(<) ; |
1458 |
} |
1459 |
|
1460 |
rule SubInclude |
1461 |
{ |
1462 |
local _s ; |
1463 |
|
1464 |
# That's |
1465 |
# SubInclude TOP d1 [ d2 [ d3 [ d4 ] ] ] |
1466 |
# |
1467 |
# to include a subdirectory's Jamfile. |
1468 |
|
1469 |
if ! $($(<[1])) |
1470 |
{ |
1471 |
EXIT Top level of source tree has not been set with $(<[1]) ; |
1472 |
} |
1473 |
|
1474 |
_s = [ FDirName $(<[2-]) ] ; |
1475 |
|
1476 |
include $(JAMFILE:D=$(_s):R=$($(<[1]))) ; |
1477 |
} |
1478 |
|
1479 |
rule Undefines |
1480 |
{ |
1481 |
UNDEFS on [ FAppendSuffix $(<) : $(SUFEXE) ] += $(UNDEFFLAG)$(>) ; |
1482 |
} |
1483 |
|
1484 |
rule UserObject |
1485 |
{ |
1486 |
EXIT "Unknown suffix on" $(>) "- see UserObject rule in Jamfile(5)." ; |
1487 |
} |
1488 |
|
1489 |
rule Yacc |
1490 |
{ |
1491 |
local _h ; |
1492 |
|
1493 |
_h = $(<:BS=.h) ; |
1494 |
|
1495 |
# Some places don't have a yacc. |
1496 |
|
1497 |
MakeLocate $(<) $(_h) : $(LOCATE_SOURCE) ; |
1498 |
|
1499 |
if $(YACC) |
1500 |
{ |
1501 |
DEPENDS $(<) $(_h) : $(>) ; |
1502 |
Yacc1 $(<) $(_h) : $(>) ; |
1503 |
YaccMv $(<) $(_h) : $(>) ; |
1504 |
Clean clean : $(<) $(_h) ; |
1505 |
} |
1506 |
|
1507 |
# make sure someone includes $(_h) else it will be |
1508 |
# a deadly independent target |
1509 |
|
1510 |
INCLUDES $(<) : $(_h) ; |
1511 |
} |
1512 |
|
1513 |
# |
1514 |
# Utility rules; no side effects on these |
1515 |
# |
1516 |
|
1517 |
rule FGrist |
1518 |
{ |
1519 |
# Turn individual elements in $(<) into grist. |
1520 |
|
1521 |
local _g _i ; |
1522 |
|
1523 |
_g = $(<[1]) ; |
1524 |
|
1525 |
for _i in $(<[2-]) |
1526 |
{ |
1527 |
_g = $(_g)!$(_i) ; |
1528 |
} |
1529 |
|
1530 |
return $(_g) ; |
1531 |
} |
1532 |
|
1533 |
rule FGristFiles |
1534 |
{ |
1535 |
if ! $(SOURCE_GRIST) |
1536 |
{ |
1537 |
return $(<) ; |
1538 |
} |
1539 |
else |
1540 |
{ |
1541 |
return $(<:G=$(SOURCE_GRIST)) ; |
1542 |
} |
1543 |
} |
1544 |
|
1545 |
rule FGristSourceFiles |
1546 |
{ |
1547 |
# Produce source file name name with grist in it, |
1548 |
# if SOURCE_GRIST is set. |
1549 |
|
1550 |
# Leave header files alone, because they have a global |
1551 |
# visibility. |
1552 |
|
1553 |
if ! $(SOURCE_GRIST) |
1554 |
{ |
1555 |
return $(<) ; |
1556 |
} |
1557 |
else |
1558 |
{ |
1559 |
local _i _o ; |
1560 |
|
1561 |
for _i in $(<) |
1562 |
{ |
1563 |
switch $(_i) |
1564 |
{ |
1565 |
case *.h : _o += $(_i) ; |
1566 |
case * : _o += $(_i:G=$(SOURCE_GRIST)) ; |
1567 |
} |
1568 |
} |
1569 |
|
1570 |
return $(_o) ; |
1571 |
} |
1572 |
} |
1573 |
|
1574 |
rule FConcat |
1575 |
{ |
1576 |
# Puts the variables together, removing spaces. |
1577 |
|
1578 |
local _t _r ; |
1579 |
|
1580 |
$(_r) = $(<[1]) ; |
1581 |
|
1582 |
for _t in $(<[2-]) |
1583 |
{ |
1584 |
$(_r) = $(_r)$(_t) ; |
1585 |
} |
1586 |
|
1587 |
return $(_r) ; |
1588 |
} |
1589 |
|
1590 |
rule FSubDir |
1591 |
{ |
1592 |
local _i _d ; |
1593 |
|
1594 |
# If $(>) is the path to the current directory, compute the |
1595 |
# path (using ../../ etc) back to that root directory. |
1596 |
# Sets result in $(<) |
1597 |
|
1598 |
if ! $(<[1]) |
1599 |
{ |
1600 |
_d = $(DOT) ; |
1601 |
} |
1602 |
else |
1603 |
{ |
1604 |
_d = $(DOTDOT) ; |
1605 |
|
1606 |
for _i in $(<[2-]) |
1607 |
{ |
1608 |
_d = $(_d:R=$(DOTDOT)) ; |
1609 |
} |
1610 |
} |
1611 |
|
1612 |
return $(_d) ; |
1613 |
} |
1614 |
|
1615 |
rule FDirName |
1616 |
{ |
1617 |
local _s _i ; |
1618 |
|
1619 |
# Turn individual elements in $(<) into a usable path. |
1620 |
|
1621 |
if ! $(<) |
1622 |
{ |
1623 |
_s = $(DOT) ; |
1624 |
} |
1625 |
else if $(VMS) |
1626 |
{ |
1627 |
# This handles the following cases: |
1628 |
# a -> [.a] |
1629 |
# a b c -> [.a.b.c] |
1630 |
# x: -> x: |
1631 |
# x: a -> x:[a] |
1632 |
# x:[a] b -> x:[a.b] |
1633 |
|
1634 |
switch $(<[1]) |
1635 |
{ |
1636 |
case *:* : _s = $(<[1]) ; |
1637 |
case \\[*\\] : _s = $(<[1]) ; |
1638 |
case * : _s = [.$(<[1])] ; |
1639 |
} |
1640 |
|
1641 |
for _i in [.$(<[2-])] |
1642 |
{ |
1643 |
_s = $(_i:R=$(_s)) ; |
1644 |
} |
1645 |
} |
1646 |
else if $(MAC) |
1647 |
{ |
1648 |
_s = $(DOT) ; |
1649 |
|
1650 |
for _i in $(<) |
1651 |
{ |
1652 |
_s = $(_i:R=$(_s)) ; |
1653 |
} |
1654 |
} |
1655 |
else |
1656 |
{ |
1657 |
_s = $(<[1]) ; |
1658 |
|
1659 |
for _i in $(<[2-]) |
1660 |
{ |
1661 |
_s = $(_i:R=$(_s)) ; |
1662 |
} |
1663 |
} |
1664 |
|
1665 |
return $(_s) ; |
1666 |
} |
1667 |
|
1668 |
|
1669 |
rule _makeCommon |
1670 |
{ |
1671 |
# strip common initial elements |
1672 |
|
1673 |
if $($(<)[1]) && $($(<)[1]) = $($(>)[1]) |
1674 |
{ |
1675 |
$(<) = $($(<)[2-]) ; |
1676 |
$(>) = $($(>)[2-]) ; |
1677 |
_makeCommon $(<) : $(>) ; |
1678 |
} |
1679 |
} |
1680 |
|
1681 |
|
1682 |
rule FRelPath |
1683 |
{ |
1684 |
local _l _r ; |
1685 |
|
1686 |
# first strip off common parts |
1687 |
|
1688 |
_l = $(<) ; |
1689 |
_r = $(>) ; |
1690 |
|
1691 |
_makeCommon _l : _r ; |
1692 |
|
1693 |
# now make path to root and path down |
1694 |
|
1695 |
_l = [ FSubDir $(_l) ] ; |
1696 |
_r = [ FDirName $(_r) ] ; |
1697 |
|
1698 |
# Concatenate and save |
1699 |
|
1700 |
# XXX This should be better |
1701 |
|
1702 |
if $(_r) = $(DOT) { |
1703 |
return $(_l) ; |
1704 |
} else { |
1705 |
return $(_r:R=$(_l)) ; |
1706 |
} |
1707 |
} |
1708 |
|
1709 |
rule FAppendSuffix |
1710 |
{ |
1711 |
# E.g., "FAppendSuffix yacc lex foo.bat : $(SUFEXE) ;" |
1712 |
# returns (yacc,lex,foo.bat) on Unix and |
1713 |
# (yacc.exe,lex.exe,foo.bat) on NT. |
1714 |
|
1715 |
if $(>) |
1716 |
{ |
1717 |
local _i _o ; |
1718 |
|
1719 |
for _i in $(<) |
1720 |
{ |
1721 |
if $(_i:S) |
1722 |
{ |
1723 |
_o += $(_i) ; |
1724 |
} |
1725 |
else |
1726 |
{ |
1727 |
_o += $(_i:S=$(>)) ; |
1728 |
} |
1729 |
} |
1730 |
return $(_o) ; |
1731 |
} |
1732 |
else |
1733 |
{ |
1734 |
return $(<) ; |
1735 |
} |
1736 |
} |
1737 |
|
1738 |
rule unmakeDir |
1739 |
{ |
1740 |
if $(>[1]:D) && $(>[1]:D) != $(>[1]) && $(>[1]:D) != \\\\ |
1741 |
{ |
1742 |
unmakeDir $(<) : $(>[1]:D) $(>[1]:BS) $(>[2-]) ; |
1743 |
} |
1744 |
else |
1745 |
{ |
1746 |
$(<) = $(>) ; |
1747 |
} |
1748 |
} |
1749 |
|
1750 |
|
1751 |
rule FConvertToSlashes |
1752 |
{ |
1753 |
local _d, _s, _i ; |
1754 |
|
1755 |
unmakeDir _d : $(<) ; |
1756 |
|
1757 |
_s = $(_d[1]) ; |
1758 |
for _i in $(_d[2-]) |
1759 |
{ |
1760 |
_s = $(_s)/$(_i) ; |
1761 |
} |
1762 |
return $(_s) ; |
1763 |
} |
1764 |
|
1765 |
|
1766 |
# |
1767 |
# Actions |
1768 |
# |
1769 |
|
1770 |
# |
1771 |
# First the defaults |
1772 |
# |
1773 |
|
1774 |
actions updated together piecemeal Archive |
1775 |
{ |
1776 |
$(AR) $(<) $(>) |
1777 |
} |
1778 |
|
1779 |
actions As |
1780 |
{ |
1781 |
$(AS) $(ASFLAGS) -I$(HDRS) -o $(<) $(>) |
1782 |
} |
1783 |
|
1784 |
actions C++ |
1785 |
{ |
1786 |
$(C++) -c $(C++FLAGS) $(OPTIM) -I$(HDRS) -o $(<) $(>) |
1787 |
} |
1788 |
|
1789 |
actions Cc |
1790 |
{ |
1791 |
$(CC) -c $(CCFLAGS) $(OPTIM) -I$(HDRS) -o $(<) $(>) |
1792 |
} |
1793 |
|
1794 |
actions Chgrp |
1795 |
{ |
1796 |
chgrp $(GROUP) $(<) |
1797 |
} |
1798 |
|
1799 |
actions Chmod1 |
1800 |
{ |
1801 |
$(CHMOD) $(MODE) $(<) |
1802 |
} |
1803 |
|
1804 |
actions Chown |
1805 |
{ |
1806 |
chown $(OWNER) $(<) |
1807 |
} |
1808 |
|
1809 |
actions piecemeal together existing Clean |
1810 |
{ |
1811 |
$(RM) $(>) |
1812 |
} |
1813 |
|
1814 |
actions File |
1815 |
{ |
1816 |
$(CP) $(>) $(<) |
1817 |
} |
1818 |
|
1819 |
actions GenFile1 |
1820 |
{ |
1821 |
$(>[1]) $(<) $(>[2-]) |
1822 |
} |
1823 |
|
1824 |
actions Fortran |
1825 |
{ |
1826 |
$(FORTRAN) $(FORTRANFLAGS) -o $(<) $(>) |
1827 |
} |
1828 |
|
1829 |
actions HardLink |
1830 |
{ |
1831 |
$(RM) $(<) && $(LN) $(>) $(<) |
1832 |
} |
1833 |
|
1834 |
actions Install |
1835 |
{ |
1836 |
$(CP) $(>) $(<) |
1837 |
} |
1838 |
|
1839 |
actions Lex |
1840 |
{ |
1841 |
$(LEX) $(>) |
1842 |
} |
1843 |
|
1844 |
actions LexMv |
1845 |
{ |
1846 |
$(MV) lex.yy.c $(<) |
1847 |
} |
1848 |
|
1849 |
actions Link bind NEEDLIBS |
1850 |
{ |
1851 |
$(LINK) $(LINKFLAGS) -o $(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) |
1852 |
} |
1853 |
|
1854 |
actions MkDir1 |
1855 |
{ |
1856 |
$(MKDIR) $(<) |
1857 |
} |
1858 |
|
1859 |
actions together Ranlib |
1860 |
{ |
1861 |
$(RANLIB) $(<) |
1862 |
} |
1863 |
|
1864 |
actions quietly updated piecemeal together RmTemps |
1865 |
{ |
1866 |
$(RM) $(>) |
1867 |
} |
1868 |
|
1869 |
actions Shell |
1870 |
{ |
1871 |
$(AWK) ' |
1872 |
NR == 1 { print "$(SHELLHEADER)" } |
1873 |
NR == 1 && /^[#:]/ { next } |
1874 |
/^##/ { next } |
1875 |
{ print } |
1876 |
' < $(>) > $(<) |
1877 |
} |
1878 |
|
1879 |
actions Yacc1 |
1880 |
{ |
1881 |
$(YACC) $(YACCFLAGS) $(>) |
1882 |
} |
1883 |
|
1884 |
actions YaccMv |
1885 |
{ |
1886 |
$(MV) $(YACCFILES).c $(<[1]) |
1887 |
$(MV) $(YACCFILES).h $(<[2]) |
1888 |
} |
1889 |
|
1890 |
# |
1891 |
# RELOCATE - for compilers with broken -o flags |
1892 |
# |
1893 |
|
1894 |
if $(RELOCATE) |
1895 |
{ |
1896 |
actions C++ |
1897 |
{ |
1898 |
$(C++) -c $(C++FLAGS) $(OPTIM) -I$(HDRS) $(>) |
1899 |
} |
1900 |
|
1901 |
actions Cc |
1902 |
{ |
1903 |
$(CC) -c $(CCFLAGS) $(OPTIM) -I$(HDRS) $(>) |
1904 |
} |
1905 |
|
1906 |
actions ignore CcMv |
1907 |
{ |
1908 |
[ $(<) != $(>:BS=$(SUFOBJ)) ] && $(MV) $(>:BS=$(SUFOBJ)) $(<) |
1909 |
} |
1910 |
} |
1911 |
|
1912 |
# |
1913 |
# NOARUPDATE - can't update an archive |
1914 |
# |
1915 |
|
1916 |
if $(NOARUPDATE) |
1917 |
{ |
1918 |
actions Archive |
1919 |
{ |
1920 |
$(AR) $(<) $(>) |
1921 |
} |
1922 |
} |
1923 |
|
1924 |
# |
1925 |
# NT specific actions |
1926 |
# |
1927 |
|
1928 |
if $(NT) |
1929 |
{ |
1930 |
if $(TOOLSET) = VISUALC || $(TOOLSET) = INTELC |
1931 |
{ |
1932 |
actions updated together piecemeal Archive |
1933 |
{ |
1934 |
if exist $(<) set _$(<:B)_=$(<) |
1935 |
$(AR) /out:$(<) %_$(<:B)_% $(>) |
1936 |
} |
1937 |
|
1938 |
actions As |
1939 |
{ |
1940 |
$(AS) /Ml /p /v /w2 $(>) $(<) ,nul,nul; |
1941 |
} |
1942 |
|
1943 |
actions Cc |
1944 |
{ |
1945 |
$(CC) /c $(CCFLAGS) $(OPTIM) /Fo$(<) /I$(HDRS) /I$(STDHDRS) $(>) |
1946 |
} |
1947 |
|
1948 |
actions C++ |
1949 |
{ |
1950 |
$(C++) /c $(C++FLAGS) $(OPTIM) /Fo$(<) /I$(HDRS) /I$(STDHDRS) /Tp$(>) |
1951 |
} |
1952 |
|
1953 |
actions Link bind NEEDLIBS |
1954 |
{ |
1955 |
$(LINK) $(LINKFLAGS) /out:$(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) |
1956 |
} |
1957 |
} |
1958 |
else if $(TOOLSET) = VISUALC16 |
1959 |
{ |
1960 |
actions updated together piecemeal Archive |
1961 |
{ |
1962 |
$(AR) $(<) -+$(>) |
1963 |
} |
1964 |
|
1965 |
actions Cc |
1966 |
{ |
1967 |
$(CC) /c $(CCFLAGS) $(OPTIM) /Fo$(<) /I$(HDRS) $(>) |
1968 |
} |
1969 |
|
1970 |
actions C++ |
1971 |
{ |
1972 |
$(C++) /c $(C++FLAGS) $(OPTIM) /Fo$(<) /I$(HDRS) /Tp$(>) |
1973 |
} |
1974 |
|
1975 |
actions Link bind NEEDLIBS |
1976 |
{ |
1977 |
$(LINK) $(LINKFLAGS) /out:$(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) |
1978 |
} |
1979 |
} |
1980 |
else if $(TOOLSET) = BORLANDC |
1981 |
{ |
1982 |
actions updated together piecemeal Archive |
1983 |
{ |
1984 |
$(AR) $(<) -+$(>) |
1985 |
} |
1986 |
|
1987 |
actions Link bind NEEDLIBS |
1988 |
{ |
1989 |
$(LINK) -e$(<) $(LINKFLAGS) $(UNDEFS) -L$(LINKLIBS) $(NEEDLIBS) $(>) |
1990 |
} |
1991 |
|
1992 |
actions C++ |
1993 |
{ |
1994 |
$(C++) -c $(C++FLAGS) $(OPTIM) -I$(STDHDRS) -I$(HDRS) -o$(<) $(>) |
1995 |
} |
1996 |
|
1997 |
actions Cc |
1998 |
{ |
1999 |
$(CC) -c $(CCFLAGS) $(OPTIM) -I$(STDHDRS) -I$(HDRS) -o$(<) $(>) |
2000 |
} |
2001 |
|
2002 |
} |
2003 |
else if $(TOOLSET) = MINGW |
2004 |
{ |
2005 |
# actions together piecemeal Archive |
2006 |
# { |
2007 |
# $(AR) $(<) $(>:T) |
2008 |
# } |
2009 |
|
2010 |
# actions Cc |
2011 |
# { |
2012 |
# $(CC) $(CCFLAGS) $(OPTIM) -I$(HDRS) -o$(<) $(>) |
2013 |
# } |
2014 |
|
2015 |
# actions C++ |
2016 |
# { |
2017 |
# $(C++) $(C++FLAGS) $(OPTIM) -I$(HDRS) -o$(<) $(>) |
2018 |
# } |
2019 |
} |
2020 |
else if $(TOOLSET) = WATCOM |
2021 |
{ |
2022 |
actions together piecemeal Archive |
2023 |
{ |
2024 |
$(AR) $(<) +-$(>) |
2025 |
} |
2026 |
|
2027 |
actions Cc |
2028 |
{ |
2029 |
$(CC) $(CCFLAGS) $(OPTIM) /Fo=$(<) /I$(HDRS) $(>) |
2030 |
} |
2031 |
|
2032 |
actions C++ |
2033 |
{ |
2034 |
$(C++) $(C++FLAGS) $(OPTIM) /Fo=$(<) /I$(HDRS) $(>) |
2035 |
} |
2036 |
|
2037 |
actions Fortran |
2038 |
{ |
2039 |
$(FORTRAN) $(FORTRANFLAGS) /FO=$(<) $(>) |
2040 |
} |
2041 |
|
2042 |
actions Link bind NEEDLIBS |
2043 |
{ |
2044 |
$(LINK) $(LINKFLAGS) /Fe=$(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) |
2045 |
} |
2046 |
|
2047 |
actions Shell |
2048 |
{ |
2049 |
$(CP) $(>) $(<) |
2050 |
} |
2051 |
} |
2052 |
else if $(TOOLSET) = LCC |
2053 |
{ |
2054 |
actions together piecemeal Archive |
2055 |
{ |
2056 |
$(AR) /out:$(<) $(>) |
2057 |
} |
2058 |
|
2059 |
actions Cc |
2060 |
{ |
2061 |
$(CC) $(CCFLAGS) $(OPTIM) -Fo$(<) -I$(HDRS) $(>) |
2062 |
} |
2063 |
|
2064 |
actions Link bind NEEDLIBS |
2065 |
{ |
2066 |
$(LINK) $(LINKFLAGS) -o $(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) |
2067 |
} |
2068 |
|
2069 |
actions Shell |
2070 |
{ |
2071 |
$(CP) $(>) $(<) |
2072 |
} |
2073 |
} |
2074 |
} |
2075 |
|
2076 |
# |
2077 |
# OS2 specific actions |
2078 |
# |
2079 |
|
2080 |
else if $(OS2) |
2081 |
{ |
2082 |
if $(TOOLSET) = WATCOM |
2083 |
{ |
2084 |
actions together piecemeal Archive |
2085 |
{ |
2086 |
$(AR) $(<) +-$(>) |
2087 |
} |
2088 |
|
2089 |
actions Cc |
2090 |
{ |
2091 |
$(CC) $(CCFLAGS) $(OPTIM) /Fo=$(<) /I$(HDRS) $(>) |
2092 |
} |
2093 |
|
2094 |
actions C++ |
2095 |
{ |
2096 |
$(C++) $(C++FLAGS) $(OPTIM) /Fo=$(<) /I$(HDRS) $(>) |
2097 |
} |
2098 |
|
2099 |
actions Link bind NEEDLIBS |
2100 |
{ |
2101 |
$(LINK) $(LINKFLAGS) /Fe=$(<) $(UNDEFS) $(>) $(NEEDLIBS) $(LINKLIBS) |
2102 |
} |
2103 |
|
2104 |
actions Shell |
2105 |
{ |
2106 |
$(CP) $(>) $(<) |
2107 |
} |
2108 |
} |
2109 |
else if $(TOOLSET) = EMX |
2110 |
{ |
2111 |
actions together piecemeal Archive |
2112 |
{ |
2113 |
$(AR) $(<) $(>:T) |
2114 |
} |
2115 |
|
2116 |
actions Cc |
2117 |
{ |
2118 |
$(CC) -c $(CCFLAGS) $(OPTIM) -I$(HDRS) -o$(<) $(>) |
2119 |
} |
2120 |
|
2121 |
actions C++ |
2122 |
{ |
2123 |
$(C++) -c $(C++FLAGS) $(OPTIM) -I$(HDRS) -o$(<) $(>) |
2124 |
} |
2125 |
} |
2126 |
} |
2127 |
|
2128 |
# |
2129 |
# VMS specific actions |
2130 |
# |
2131 |
|
2132 |
else if $(VMS) |
2133 |
{ |
2134 |
actions updated together piecemeal Archive |
2135 |
{ |
2136 |
lib/replace $(<) $(>[1]) ,$(>[2-]) |
2137 |
} |
2138 |
|
2139 |
actions Cc |
2140 |
{ |
2141 |
$(CC)/obj=$(<) $(CCFLAGS) $(OPTIM) $(SLASHINC) $(>) |
2142 |
} |
2143 |
|
2144 |
actions C++ |
2145 |
{ |
2146 |
$(C++)/obj=$(<) $(C++FLAGS) $(OPTIM) $(SLASHINC) $(>) |
2147 |
} |
2148 |
|
2149 |
actions piecemeal together existing Clean |
2150 |
{ |
2151 |
$(RM) $(>[1]);* ,$(>[2-]);* |
2152 |
} |
2153 |
|
2154 |
actions together quietly CreLib |
2155 |
{ |
2156 |
if f$search("$(<)") .eqs. "" then lib/create $(<) |
2157 |
} |
2158 |
|
2159 |
actions GenFile1 |
2160 |
{ |
2161 |
mcr $(>[1]) $(<) $(>[2-]) |
2162 |
} |
2163 |
|
2164 |
actions Link bind NEEDLIBS |
2165 |
{ |
2166 |
$(LINK)/exe=$(<) $(LINKFLAGS) $(>[1]) ,$(>[2-]) ,$(NEEDLIBS)/lib ,$(LINKLIBS) |
2167 |
} |
2168 |
|
2169 |
actions quietly updated piecemeal together RmTemps |
2170 |
{ |
2171 |
$(RM) $(>[1]);* ,$(>[2-]);* |
2172 |
} |
2173 |
|
2174 |
actions Shell |
2175 |
{ |
2176 |
$(CP) $(>) $(<) |
2177 |
} |
2178 |
} |
2179 |
|
2180 |
# |
2181 |
# Mac specific actions |
2182 |
# |
2183 |
|
2184 |
else if $(MAC) |
2185 |
{ |
2186 |
actions together Archive |
2187 |
{ |
2188 |
$(LINK) -library -o $(<) $(>) |
2189 |
} |
2190 |
|
2191 |
actions Cc |
2192 |
{ |
2193 |
set -e MWCincludes $(MACINC) |
2194 |
$(CC) -o $(<) $(CCFLAGS) $(OPTIM) $(>) |
2195 |
} |
2196 |
|
2197 |
actions C++ |
2198 |
{ |
2199 |
set -e MWCincludes $(MACINC) |
2200 |
$(CC) -o $(<) $(C++FLAGS) $(OPTIM) $(>) |
2201 |
} |
2202 |
|
2203 |
actions Link bind NEEDLIBS |
2204 |
{ |
2205 |
$(LINK) -o $(<) $(LINKFLAGS) $(>) $(NEEDLIBS) "$(LINKLIBS)" |
2206 |
} |
2207 |
} |
2208 |
|
2209 |
# |
2210 |
# Backwards compatibility with jam 1, where rules were uppercased. |
2211 |
# |
2212 |
|
2213 |
rule BULK { Bulk $(<) : $(>) ; } |
2214 |
rule FILE { File $(<) : $(>) ; } |
2215 |
rule HDRRULE { HdrRule $(<) : $(>) ; } |
2216 |
rule INSTALL { Install $(<) : $(>) ; } |
2217 |
rule LIBRARY { Library $(<) : $(>) ; } |
2218 |
rule LIBS { LinkLibraries $(<) : $(>) ; } |
2219 |
rule LINK { Link $(<) : $(>) ; } |
2220 |
rule MAIN { Main $(<) : $(>) ; } |
2221 |
rule SETUID { Setuid $(<) ; } |
2222 |
rule SHELL { Shell $(<) : $(>) ; } |
2223 |
rule UNDEFINES { Undefines $(<) : $(>) ; } |
2224 |
|
2225 |
# Old INSTALL* didn't take dest directory. |
2226 |
|
2227 |
rule INSTALLBIN { InstallBin $(BINDIR) : $(<) ; } |
2228 |
rule INSTALLLIB { InstallLib $(LIBDIR) : $(<) ; } |
2229 |
rule INSTALLMAN { InstallMan $(MANDIR) : $(<) ; } |
2230 |
|
2231 |
# Compatibility with jam 2.2. |
2232 |
|
2233 |
rule addDirName { $(<) += [ FDirName $(>) ] ; } |
2234 |
rule makeDirName { $(<) = [ FDirName $(>) ] ; } |
2235 |
rule makeGristedName { $(<) = [ FGristSourceFiles $(>) ] ; } |
2236 |
rule makeRelPath { $(<[1]) = [ FRelPath $(<[2-]) : $(>) ] ; } |
2237 |
rule makeSuffixed { $(<[1]) = [ FAppendSuffix $(>) : $(<[2]) ] ; } |
2238 |
|
2239 |
# |
2240 |
# Now include the user's Jamfile. |
2241 |
# |
2242 |
|
2243 |
{ |
2244 |
if $(JAMFILE) { include $(JAMFILE) ; } |
2245 |
} |