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