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