| 1 |
# |
| 2 |
# /+\ |
| 3 |
# +\ Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc. |
| 4 |
# \+/ |
| 5 |
# |
| 6 |
# This file is part of Jam - see jam.c for Copyright information. |
| 7 |
# |
| 8 |
|
| 9 |
# The Copyright information in jam.c reads: |
| 10 |
# |
| 11 |
#/* |
| 12 |
# * /+\ |
| 13 |
# * +\ Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc. |
| 14 |
# * \+/ |
| 15 |
# * |
| 16 |
# * This file is part of jam. |
| 17 |
# * |
| 18 |
# * License is hereby granted to use this software and distribute it |
| 19 |
# * freely, as long as this copyright notice is retained and modifications |
| 20 |
# * are clearly marked. |
| 21 |
# * |
| 22 |
# * ALL WARRANTIES ARE HEREBY DISCLAIMED. |
| 23 |
# */ |
| 24 |
|
| 25 |
# MODIFIDED version of jam 2.5 Jambase, for the ArgyllCMS project by Graeme W. Gill. |
| 26 |
# These modifications are herebye licensed under the same conditions |
| 27 |
# as as the rest of Jam, as detailed above. |
| 28 |
# Moved to a "Normalized" scheme, where Jamfile UNIX style target paths |
| 29 |
# are converted to platform specific, Jamfile relative, Gristed/SEARCH/LOCATE |
| 30 |
# form internally. Creating the tree is simplified by eliminating the SubDir |
| 31 |
# rule. Better support for MingW, OS X. More comprehensive ruleset. |
| 32 |
# Renamed Jamrules to Jamtop. |
| 33 |
# |
| 34 |
# JAMBASE - jam 2.5 ruleset providing make(1)-like functionality |
| 35 |
# |
| 36 |
# Supports UNIX, NT, and VMS. |
| 37 |
# |
| 38 |
# Special targets defined in this file: |
| 39 |
# |
| 40 |
# all - parent of first, shell, files, lib, exe |
| 41 |
# first - first dependent of 'all', for potential initialization |
| 42 |
# shell - parent of all Shell targets |
| 43 |
# files - parent of all File targets |
| 44 |
# lib - parent of all Library targets |
| 45 |
# exe - parent of all Main targets |
| 46 |
# dirs - parent of all MkDir targets |
| 47 |
# install - parent of all Install targets |
| 48 |
# clean - removes all Shell, File, Library, and Main targets |
| 49 |
# uninstall - removes all Install targets |
| 50 |
# |
| 51 |
|
| 52 |
# Rules defined by this file: |
| 53 |
# |
| 54 |
# As obj : source.s ; .s -> .o |
| 55 |
# Bulk dir : files ; populate directory with many files |
| 56 |
# Cc obj : src.c : flags : defines : hdrpaths |
| 57 |
# .c -> .o |
| 58 |
# C++ obj : src.cc : flags : defines : hdrpaths |
| 59 |
# .cc -> .o |
| 60 |
# Clean clean : sources ; remove sources with 'jam clean' |
| 61 |
# File dest : source ; copy file |
| 62 |
# FileNoClean dest : source ; copy file, but don't delete dest during clean |
| 63 |
# FakeFile dest : source ; Fudge to say dest is created with source |
| 64 |
# Fortran obj.o : source.f ; .f -> .o |
| 65 |
# GenFile target : program args ; make custom file |
| 66 |
# GenFileND target : program args : extra_dependecies ; |
| 67 |
# make custom file, program dependent & args not |
| 68 |
# GenFileNND target : program args : extra_dependecies ; |
| 69 |
# make custom file, program & args not dependent |
| 70 |
# GenFileNNDnc target : program args : extra_dependecies ; |
| 71 |
# Same as GenFileNND but don't clean the target. |
| 72 |
# CatToFile dest : strings ; save the arguments to the file |
| 73 |
# GuiBin image ; Mark executable as GUI applications |
| 74 |
# (Needs to go before other declarations of image) |
| 75 |
# UACBin image ; Mark executable as MSWindows UAC applications |
| 76 |
# (Needs to go before other declarations of image) |
| 77 |
# HardLink target : source ; make link from source to target |
| 78 |
# HdrRule source : headers ; handle #includes |
| 79 |
# InstallInto dir : sources ; install any files |
| 80 |
# InstallBin dir : sources ; install binaries |
| 81 |
# InstallLib dir : sources ; install files |
| 82 |
# InstallShLib dir : sources ; install files |
| 83 |
# InstallFile dir : sources ; install files |
| 84 |
# InstallMan dir : sources ; install man pages |
| 85 |
# InstallShell dir : sources ; install shell scripts |
| 86 |
# Lex source.c : source.l ; .l -> .c |
| 87 |
# Library library : sources : flags : defines : hdrpaths : objects |
| 88 |
# static library from compiled sources |
| 89 |
# LibraryFromLibraries lib : libs ; static library from static libraries |
| 90 |
# LibraryFromObjects lib : objects ; static library from objects |
| 91 |
# LinkLibraries images : libraries ; add static libraries onto Mains |
| 92 |
# LinkObjects images : objects ; add objects onto Mains |
| 93 |
# LinkShLibraries images : shlibraries ; add shared libraries onto Mains |
| 94 |
# Main image : sources : flags : defines : hdrpaths : objects : libs : shlibs ; |
| 95 |
# create exe from compiled sources |
| 96 |
# MainsFromSources sources ; create exes each from their source |
| 97 |
# MainFromObjects image : objects : libs : shlibs ; |
| 98 |
# create executable from objects |
| 99 |
# MainVariant image : sources : flags : defines : hdrpaths : objects : libs : shlibs ; |
| 100 |
# create exe from compiled sources with separate named objs |
| 101 |
# MainLinkFlags mains : flags ; add linker flags for object |
| 102 |
# MkDir dir ; make a directory, if not there |
| 103 |
# Mod target : mode ; sets mode of file |
| 104 |
# NDepends dest : source ; make Normalized dependency |
| 105 |
# NNoUpdate targ ; create Normalized target if needed but never update it |
| 106 |
# NIncludes dest : source ; make Normalized co-dependency |
| 107 |
# Object object : sources : flags : defines : hdrpaths ; compile object from source |
| 108 |
# ObjectCcFlags objects : flags ; add compiler flags for object |
| 109 |
# ObjectPrefCcFlags objects : flags ; add preference compiler flags for object (overridable) |
| 110 |
# ObjectC++Flags objects : flags ; add compiler flags for object |
| 111 |
# ObjectPrefC++Flags objects : flags ; add preference compiler flags for object (overridable) |
| 112 |
# ObjectDefines objects : defines ; add defines for object |
| 113 |
# ObjectHdrs objects : dirs ; add include directories for object |
| 114 |
# ObjectKeep objects ; mark objects to be kept after library build |
| 115 |
# Objects sources : flags : defines : hdrpaths compile sources |
| 116 |
# PeerInclude dir ; include peer Jamfile |
| 117 |
# FindTop ; Set TOP by locating JAMTOP file above SUBDIR |
| 118 |
# ProjTop d1 d2 .. ; Set project TOP |
| 119 |
# RmTemps target : sources ; remove temp sources after target made |
| 120 |
# Setuid images ; mark executables Setuid |
| 121 |
# set SHLINKDEFFILE on for Windows to define exports using .def file. |
| 122 |
# set SHLINKSEARCHEXEPATH true on UNIX/OSX to have applications search exeutable location for it |
| 123 |
# ShLibrary shlib : source ; link shared library from compiled sources |
| 124 |
# ShLibraryFromObjects shlib : objects ; link shared library from objects |
| 125 |
# ShLibraryLibraries shlib : libraries ; add static libraries onto shared libraries link |
| 126 |
# ShLibraryObjects shlib : objects ; add objects onto shared libraries link |
| 127 |
# ShLibraryShLibraries shlib : shlibraries ; add shared libraries onto shared libraries link |
| 128 |
# SoftLink target : source ; make symlink from source to target |
| 129 |
# SubInclude dir ; include sub Jamfile |
| 130 |
# Shell exe : source ; make a shell executable |
| 131 |
# Undefines images : symbols ; save undef's for linking |
| 132 |
# UserObject object : source ; handle unknown suffixes for Object |
| 133 |
# Yacc source.c : source.y ; .y -> .c |
| 134 |
# Aswig : source.i ; .i -> .h _i.c .hpp |
| 135 |
# |
| 136 |
# Utility rules |
| 137 |
# |
| 138 |
# val = geton var : varname ; return the value of varname on var |
| 139 |
# paths = NormPaths paths [ : dir ] ; normalize a set of paths relative to SUBDIR or dir |
| 140 |
# paths = NormSrcPaths paths [ : dir ] ; NormPaths with SRCDIR |
| 141 |
# paths = NormDstPaths paths [ : dir ] ; NormPaths with DSTDIR |
| 142 |
# paths = NormSrcTargets paths [ : dir ] ; normalize source targets, set Grist NOMLOC SEARCH |
| 143 |
# paths = NormDstTargets paths [ : dir ] ; normalize destination targets, set Grist NOMLOC LOCATE |
| 144 |
# paths = NormISrcTargets paths [ : dir ] ; Same as NormSrcTargets but ignore SRCDIR |
| 145 |
# paths = NormIDstTargets paths [ : dir ] ; Same as NormDstTargets but ignore DSTDIR |
| 146 |
# |
| 147 |
# More utility rules that have no side effects : |
| 148 |
# |
| 149 |
# FAppendSuffix f1 f2 ... : $(SUF) ; return $(<) with suffixes if no current suffixes |
| 150 |
# FStripCommon v1 : v2 ; strip common initial parts of v1 v2 |
| 151 |
# FReverse a1 a2 ... ; return ... a2 a1 |
| 152 |
# FDelEmpty a1 a2 ... ; return a1 a2 ... with any empty elements deleted |
| 153 |
# |
| 154 |
# Variables: |
| 155 |
# |
| 156 |
# Sub-Jamfile build variables, optionaly set in each Sub-Jamfile. They will |
| 157 |
# be picked up by subsequent rules that set target relationships and |
| 158 |
# creation rules. They are added to any Parent-Jamfile variables, |
| 159 |
# and become the Parent-Jamfile variables of any SubIncludes. |
| 160 |
# Relative file/path variables are anchored by the Jamfile location. |
| 161 |
# |
| 162 |
# ASFLAGS - Flags for the assembler. |
| 163 |
# CCFLAGS - Flags for the C compiler. |
| 164 |
# C++FLAGS - Flags for the C++ compiler. |
| 165 |
# LINKFLAGS - Flags for the executable linker. |
| 166 |
# SHLINKFLAGS - Flags for the shared library linker. |
| 167 |
# HDRS - Complile header search directories |
| 168 |
# DEFINES - Compile defines |
| 169 |
# LINKOBJS - Link extra objects |
| 170 |
# LINKLIBS - Link extra libraries |
| 171 |
# LINKSHLIBS - Link extra shared libraries |
| 172 |
# SHLINKOBJS - ShLibrary Linker extra objects |
| 173 |
# SHLINKLIBS - ShLibrary Linker extra libraries |
| 174 |
# SHLINKSHLIBS - ShLibrary Linker extra shared libraries |
| 175 |
# |
| 176 |
# Sub-directory preferred build flags, e.g. optimizations etc. These will only |
| 177 |
# have effect if not set by a parent Jamfile (ie. involked from a leaf Jamfile). |
| 178 |
# |
| 179 |
# PREF_ASFLAGS |
| 180 |
# PREF_CCFLAGS |
| 181 |
# PREF_C++FLAGS |
| 182 |
# PREF_LINKFLAGS |
| 183 |
# PREF_SHLINKFLAGS |
| 184 |
# |
| 185 |
# Parent-Jamfile build variables. These are the accumulated |
| 186 |
# values from any Parent Jamfiles, and will be added to any |
| 187 |
# Sub-Jamfile variables when a rule picks them up. |
| 188 |
# File/path variables will have been normalized. |
| 189 |
# |
| 190 |
# P_ASFLAGS - Flags for the assembler. |
| 191 |
# P_CCFLAGS - Flags for the C compiler. |
| 192 |
# P_C++FLAGS - Flags for the C++ compiler. |
| 193 |
# P_LINKFLAGS - Flags for the executable linker. |
| 194 |
# P_SHLINKFLAGS - Flags for the shared library linker. |
| 195 |
# P_HDRS - Complile header search directories |
| 196 |
# P_DEFINES - Compile defines |
| 197 |
# P_LINKOBJS - Link extra objects |
| 198 |
# P_LINKLIBS - Link extra libraries |
| 199 |
# P_LINKSHLIBS - Link extra shared libraries |
| 200 |
# P_SHLINKOBJS - ShLibrary Linker extra objects |
| 201 |
# P_SHLINKLIBS - ShLibrary Linker extra libraries |
| 202 |
# P_SHLINKSHLIBS - ShLibrary Linker extra shared libraries |
| 203 |
# |
| 204 |
# Pre-defined values |
| 205 |
# |
| 206 |
# Pre-packaged flags that conceal platform dependence, |
| 207 |
# and are used to set CCFLAGS/C++FLAGS/LINKFLAGS/SHLINLFLAGS etc. |
| 208 |
# |
| 209 |
# CCOPTFLAG - CC/C++ flag for optimization |
| 210 |
# CCDEBUGFLAG - CC/C++ flag for debug |
| 211 |
# CCPROFFLAG - CC/C++ flag for performance profiling |
| 212 |
# CCSHOBJFLAG - CC/C++ flag for compiling for a shared library (UNIX) |
| 213 |
# |
| 214 |
# LINKOPTFLAG - LINK flag for optimization of the binary/shared library |
| 215 |
# LINKDEBUGFLAG - LINK flag to support debugging |
| 216 |
# LINKPROFFLAG - LINK flag to support performance profiling |
| 217 |
# LINKSTRIPFLAG - LINK flag to strip binary of any symbols |
| 218 |
# |
| 219 |
# Location variables: |
| 220 |
# |
| 221 |
# DSTDIR - puts all products in a subdirectory of their nominated location. |
| 222 |
# Useful for storing variants in their own areas. |
| 223 |
# |
| 224 |
# SRCDIR - Looks for all sources and Jamfiles in an alternate top level source |
| 225 |
# location. Useful for accessing a read only source repository, or |
| 226 |
# building a variant without copying all the sources. |
| 227 |
# Note that at least the project Jamtop must be in the location |
| 228 |
# that is the target for the build, and will most likely be where |
| 229 |
# SRCDIR is set. SRCDIR is the location of the sources relative |
| 230 |
# to where it is declared. |
| 231 |
# (Not currently useful for a shadow build repository where the source |
| 232 |
# is spread between the SRCDIR and the build dir, because Jam 2.5 fails |
| 233 |
# to look at SEARCH if LOCATE is set). |
| 234 |
# |
| 235 |
# ========================================================================= |
| 236 |
# ArgyllCMS Normalize mods: |
| 237 |
# |
| 238 |
# The main change is to locate and identify targets using their nominated location in the |
| 239 |
# filesystem. This eliminates the need to create Grist, or manipulate SEARCH, LOCATE etc. |
| 240 |
# when setting up a herachy of Jamfiles. |
| 241 |
# |
| 242 |
# Whenever a path is provided as an argument to one of the public rules, its path is assumed |
| 243 |
# to be relative to the Jamfile that it is declared in. [ The NormPaths/NormTargets rules do this. ] |
| 244 |
# Naturally absolute paths are not affected by this. |
| 245 |
# During execution this means that all files are translated to paths that are |
| 246 |
# in a normalized form, with either an absolute path or one that is relative to |
| 247 |
# the directory that Jam was involked in. For simplicity it is assumed that |
| 248 |
# the Jamfile contains UNIX style paths, and these are converted to the |
| 249 |
# platform specific form on normalization. |
| 250 |
# |
| 251 |
# For a target, the normalized directory is then stripped from the name and |
| 252 |
# set as the Grist (path elements separated by !), and also set in the NOMLOC, |
| 253 |
# LOCATE and SEARCH variables "on" the target. This gives a target a unique |
| 254 |
# identity for the whole of the build, determined by its nominated file system location. |
| 255 |
# The NOMLOC variable is a way of recovering it's location without having the reverse |
| 256 |
# the Grist strings. The actual location of the target can then be varied by |
| 257 |
# augmenting it's LOCATE and/or SEARCH variables. |
| 258 |
# |
| 259 |
# Any include file discovered by header scanning is searched for using the |
| 260 |
# search path that is expected to be used during compilation, and |
| 261 |
# its nominated location resolved this way. Any headers that are not |
| 262 |
# located this way or who's location isn't declared by another rule (the |
| 263 |
# latter being typical when headers are being generated) will be marked as |
| 264 |
# being in an __unknown__ directory and will not be scaned. Normally any |
| 265 |
# header files located in the STDHDRS directories will not be scanned either. |
| 266 |
# |
| 267 |
# [ Typically headers will be __unknown__ if the STDHDRS directories do |
| 268 |
# not reflect the default paths actually searched by the compiler, or if a |
| 269 |
# header is not actually going to be #included because it is protected |
| 270 |
# by an #ifdef. ] |
| 271 |
|
| 272 |
# Argyll Jambase internal implementation rules: |
| 273 |
|
| 274 |
# IDs = _TargetIDs targpaths ; return target ID's (gristed) from normalized paths |
| 275 |
# path = DeNormTargs target ; return the original path |
| 276 |
# CopyTarget dest : source ; duplicate a targets on NOMLOC LOCATE SEARCH variables. |
| 277 |
# NotTargets vars ; ensure variables aren't treated as LOCATE etc targets |
| 278 |
|
| 279 |
# d1 d2 ... file = _SepPath path ; separate a path into its components |
| 280 |
# path = _DirName d1 d2 ... ; combine components into a path |
| 281 |
# d1 d2 .. = _RatPath d1 d2 .. rationalize a path |
| 282 |
# d1 d2 .. = _RootPath d1 d2 .. : p1 p2 ... re-root a path |
| 283 |
# paths = RatPaths paths ; rationalize a set of paths |
| 284 |
# paths = RootPaths dir : paths ; re-root a set of paths |
| 285 |
# targs = CreateIDstTargets targs : dir ; create dest targets by locating targets in dir |
| 286 |
# paths1/paths = CatPaths path1 : paths ; concatenate paths separated by a / |
| 287 |
# found = FindToRoot starting_dir : file ; Try and locate file from directory up to root. |
| 288 |
|
| 289 |
# FindTop ; # Look for a default project file |
| 290 |
|
| 291 |
# DoInit ; Do subdir initialization (done by JAMBASE) |
| 292 |
|
| 293 |
# public write/read Variables: |
| 294 |
# |
| 295 |
# TRACESTDHDRS # Normally false, set to true to trace system path #include file dependenicies |
| 296 |
|
| 297 |
# public read only Variables: |
| 298 |
# |
| 299 |
# SUBDIR d1/d2/d3 # Current path from PWD to Jamfile |
| 300 |
# TOP d1/d2/d3 # Current path from PWD to the project Jamtop |
| 301 |
|
| 302 |
# internal variables |
| 303 |
# |
| 304 |
# _SUBDIR d1 d2 d3 ... # Current path from PWD to Jamfile |
| 305 |
# _TOP d1 d2 d3 # Current path from PWD to the project Jamtop |
| 306 |
|
| 307 |
# - - - - - - - - - - - - - - - |
| 308 |
|
| 309 |
# NOTE: Cross compiling support :- |
| 310 |
# To fix this to support cross compilation, the setup needs to be |
| 311 |
# modularised into 3 parts, making them all rules that can be re-involked: |
| 312 |
# 1) OS/Platform setup. System tools like copy, delete etc. |
| 313 |
# 2) Compiler setup. Basic compiler syntax etc. |
| 314 |
# 3) Target setup. Make this a rule, and allow switching |
| 315 |
# target by involking the rule. This will be simpler to |
| 316 |
# get working that per target 'on' variable (some |
| 317 |
# things are currently broken for 'on' variables, such |
| 318 |
# as library members, and it will be easier to do |
| 319 |
# things such as switch compilers. |
| 320 |
|
| 321 |
# - - - - - - - - - - - - - - - |
| 322 |
|
| 323 |
|
| 324 |
# Brief review of the jam language: |
| 325 |
# |
| 326 |
# Statements: |
| 327 |
# rule RULE - statements to process a rule |
| 328 |
# actions RULE - system commands to carry out target update |
| 329 |
# |
| 330 |
# Modifiers on actions: |
| 331 |
# together - multiple instances of same rule on target get executed |
| 332 |
# once with their sources ($(>)) concatenated |
| 333 |
# updated - refers to updated sources ($(>)) only |
| 334 |
# ignore - ignore return status of command |
| 335 |
# quietly - don't trace its execution unless verbose |
| 336 |
# piecemeal - iterate command each time with a small subset of $(>) |
| 337 |
# existing - refers to currently existing sources ($(>)) only |
| 338 |
# bind vars - subject to binding before expanding in actions |
| 339 |
# |
| 340 |
# Special rules: |
| 341 |
# Always - always build a target |
| 342 |
# Depends - builds the dependency graph |
| 343 |
# NOTE: can have only one $(<), or parallel builds stuff up!! |
| 344 |
# Use FakeFile to work around the problem. |
| 345 |
# Echo - blurt out targets on stdout |
| 346 |
# Exit - blurt out targets and exit |
| 347 |
# Includes - marks sources as headers for target (a codependency) |
| 348 |
# NoCare - don't panic if the target can't be built |
| 349 |
# NoUpdate - create the target if needed but never update it |
| 350 |
# NotFile - ignore the timestamp of the target (it's not a file) |
| 351 |
# Temporary - target need not be present if sources haven't changed |
| 352 |
# |
| 353 |
# Special variables set by jam: |
| 354 |
# $(<) - targets of a rule (to the left of the :) |
| 355 |
# $(>) - sources of a rule (to the right of the :) |
| 356 |
# $(xxx) - true on xxx (UNIX, VMS, NT, OS2, MAC) |
| 357 |
# $(OS) - name of OS - varies wildly |
| 358 |
# $(JAMVERSION) - version number (2.5) |
| 359 |
# |
| 360 |
# Special variables used by jam: |
| 361 |
# SEARCH - where to find something (used during binding and actions) |
| 362 |
# LOCATE - where to plop something not found with SEARCH |
| 363 |
# HDRRULE - rule to call to handle include files |
| 364 |
# HDRSCAN - egrep regex to extract include files |
| 365 |
# |
| 366 |
# Special targets: |
| 367 |
# all - default if none given on command line |
| 368 |
# |
| 369 |
|
| 370 |
# for perforce use -- jambase version |
| 371 |
|
| 372 |
JAMBASEDATE = 2008.03.26 ; |
| 373 |
|
| 374 |
# Initialize variables |
| 375 |
# |
| 376 |
|
| 377 |
# =========================================================== |
| 378 |
# |
| 379 |
# OS specific variable settings |
| 380 |
# |
| 381 |
|
| 382 |
if $(NT) |
| 383 |
{ |
| 384 |
# GWG |
| 385 |
WIN_MT_AVAIL = true ; |
| 386 |
if ! [ GLOB $(PATH) : mt.exe ] { |
| 387 |
Echo "mt is NOT available!" ; |
| 388 |
WIN_MT_AVAIL = false ; |
| 389 |
} |
| 390 |
|
| 391 |
MV ?= move /y ; |
| 392 |
CP ?= copy ; |
| 393 |
RM ?= del /f/q ; |
| 394 |
RMDIR ?= rmdir /s/q ; |
| 395 |
SLASH ?= \\ ; |
| 396 |
SUFLIB ?= .lib ; |
| 397 |
SUFSHLIB ?= .dll ; |
| 398 |
SUFIMPLIB ?= .lib ; |
| 399 |
SUFOBJ ?= .obj ; |
| 400 |
SUFEXE ?= .exe ; |
| 401 |
SUFSH ?= .bat ; |
| 402 |
CCSHOBJFLAG ?= ; |
| 403 |
|
| 404 |
if $(BCCROOT) |
| 405 |
{ |
| 406 |
AR ?= tlib /C /P64 ; |
| 407 |
CC ?= bcc32 ; |
| 408 |
CCFLAGS ?= -v -w- -q -DWIN -tWR -tWM -tWC ; |
| 409 |
C++ ?= $(CC) ; |
| 410 |
C++FLAGS ?= $(CCFLAGS) -P ; |
| 411 |
LINK ?= $(CC) ; |
| 412 |
LINKFLAGS ?= ; |
| 413 |
STDLIBPATH ?= $(BCCROOT)\\lib ; |
| 414 |
STDHDRS ?= $(BCCROOT)\\include ; |
| 415 |
NOARSCAN ?= true ; |
| 416 |
} |
| 417 |
else if $(MingW) || $(MINGW) |
| 418 |
{ |
| 419 |
# We need to do something about adding -Wl,-subsystem,windows |
| 420 |
# if WinMain is being used ? (it defaults to console) |
| 421 |
|
| 422 |
MINGW ?= $(MingW) ; |
| 423 |
TPFX = "" ; |
| 424 |
|
| 425 |
if [ GLOB $(MINGW)/bin : x86_64-w64-mingw32-gcc.exe ] { |
| 426 |
if [ GLOB $(MINGW)/bin : gcc.exe ] { |
| 427 |
MINGW64 = $(MINGW) ; |
| 428 |
} else { |
| 429 |
MINGW64o32 = $(MINGW) ; |
| 430 |
} |
| 431 |
} |
| 432 |
|
| 433 |
# This doesn't work on a 32 bit system because we're cross |
| 434 |
# compiling and need to create build system exe's |
| 435 |
# (tiff/mkversion.exe, imdi/imdi_make.exe |
| 436 |
# Will using -m32 for local exe's fix this ? |
| 437 |
# What is multi-lib option ??? |
| 438 |
if $(MINGW64) { |
| 439 |
ECHO "Compiler is native MingW 64 bit target" ; |
| 440 |
TARGET64 = true ; |
| 441 |
TPFX1 = "" ; # Some tools |
| 442 |
TPFX2 = "" ; # Rest of tools |
| 443 |
} else if $(MINGW64o32) { |
| 444 |
ECHO "Compiler is MingW 64 bit target on 32 bit host" ; |
| 445 |
TARGET64 = true ; |
| 446 |
TPFX1 = x86_64-w64-mingw32- ; # Some tools |
| 447 |
TPFX2 = x86_64-w64-mingw32- ; # Rest of tools |
| 448 |
# MINGW64_LIB32 = $(MINGW)/mingw/lib32 ; |
| 449 |
} else { |
| 450 |
ECHO "Compiler is MingW for 32 bit target" ; |
| 451 |
TPFX1 = "" ; # Some tools |
| 452 |
TPFX2 = "" ; # Rest of tools |
| 453 |
} |
| 454 |
|
| 455 |
# Basic C/C++ tools |
| 456 |
AR ?= $(TPFX2)ar rsc ; |
| 457 |
AS ?= $(TPFX2)as ; |
| 458 |
CC ?= $(TPFX1)gcc ; |
| 459 |
CCFLAGS ?= -DNT -mwin32 -pipe ; # -fwrapv ?? |
| 460 |
C++ ?= $(CC) ; |
| 461 |
C++FLAGS ?= $(CCFLAGS) ; |
| 462 |
|
| 463 |
OLELIBS ?= -loleaut32 -luuid ; |
| 464 |
BASELIBS ?= -lstdc++ -lgcc -lodbc32 -lwsock32 ; |
| 465 |
# WINLIBS ?= -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 |
| 466 |
# -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 |
| 467 |
# -lglu32 -lshlwapi -lsetupapi ; |
| 468 |
WINLIBS ?= -lshlwapi -lsetupapi -lole32 -lws2_32 -lpsapi -liphlpapi -lversion ; |
| 469 |
GUILIBS ?= -lgdi32 -lmscms ; |
| 470 |
|
| 471 |
LINK ?= $(TPFX1)g++ ; # In case we link to C++ files |
| 472 |
LINKFLAGS ?= -static ; |
| 473 |
SHLINKFLAGS ?= ; |
| 474 |
STDLIBS ?= -lm $(OLELIBS) $(WINLIBS) $(GUILIBS) ; |
| 475 |
SHSTDLIBS ?= $(STDLIBS) ; |
| 476 |
|
| 477 |
STDHDRS ?= $(MINGW)\\include ; |
| 478 |
|
| 479 |
# Not sure whether linker -mconsole or -mwindow are needed ?? |
| 480 |
|
| 481 |
# Allow setting of flags, independent of compiler |
| 482 |
DEFFLAG ?= -D ; |
| 483 |
UNDEFFLAG ?= -U ; |
| 484 |
CCOPTFLAG ?= -O2 ; |
| 485 |
if $(PROCESSOR_LEVEL) = 15 |
| 486 |
{ # -mtune seems faster than -march !!! |
| 487 |
# CCOPTFLAG += -mtune=pentium4 ; |
| 488 |
# CCOPTFLAG += -mtune=prescott ; |
| 489 |
CCOPTFLAG += -mtune=nocona ; # portable code for Pentium4 640 |
| 490 |
# CCOPTFLAG += -march=nocona -mfpmath=sse -msse3 ; # non-portable |
| 491 |
|
| 492 |
} |
| 493 |
|
| 494 |
CCDEBUGFLAG ?= -g ; # default (TABS? DWARF2 ?) format |
| 495 |
CCPROFFLAG ?= -pg ; |
| 496 |
LINKDEBUGFLAG ?= -g ; |
| 497 |
LINKPROFFLAG ?= -pg ; |
| 498 |
LINKOPTFLAG ?= -s -O ; # Affects creating .so's ?? |
| 499 |
LINKSTRIPFLAG ?= -s ; |
| 500 |
|
| 501 |
# Other tools |
| 502 |
AWK ?= awk ; |
| 503 |
SED ?= sed ; |
| 504 |
|
| 505 |
# YACC ?= yacc ; |
| 506 |
# YACCFLAGS ?= -d ; |
| 507 |
# YACCFILES ?= y.tab ; |
| 508 |
|
| 509 |
YACC ?= bison -y ; |
| 510 |
YACCGEN ?= .c ; |
| 511 |
YACCFILES ?= y.tab ; |
| 512 |
YACCFLAGS ?= -d ; |
| 513 |
|
| 514 |
# gcc assembler listing: |
| 515 |
# -g -O -Wa,-aslh source.cpp > list.txt |
| 516 |
# -save-temps |
| 517 |
# -fdump-tree-all' |
| 518 |
|
| 519 |
} |
| 520 |
else if $(MSVC) # |
| 521 |
{ |
| 522 |
ECHO "Compiler is VC++ 16 bit" ; |
| 523 |
AR ?= lib /nologo ; |
| 524 |
CC ?= cl /nologo ; |
| 525 |
CCFLAGS ?= /D \"WIN\" ; |
| 526 |
C++ ?= $(CC) ; |
| 527 |
C++FLAGS ?= $(CCFLAGS) ; |
| 528 |
LINK ?= $(CC) ; |
| 529 |
LINKFLAGS ?= ; |
| 530 |
STDLIBS ?= |
| 531 |
$(MSVC)\\lib\\mlibce.lib |
| 532 |
$(MSVC)\\lib\\oldnames.lib |
| 533 |
; |
| 534 |
NOARSCAN ?= true ; |
| 535 |
STDHDRS ?= $(MSVC)\\include ; |
| 536 |
DEFFLAG ?= /D ; |
| 537 |
UNDEFFLAG ?= "/u _" ; |
| 538 |
} |
| 539 |
else if $(TARGET_ARCH) |
| 540 |
{ |
| 541 |
# Intel C++ compiler (ICL) |
| 542 |
|
| 543 |
# No IA64 dir |
| 544 |
local I ; I = "" ; |
| 545 |
|
| 546 |
AR ?= lib /NOLOGO ; |
| 547 |
AS ?= masm386 ; |
| 548 |
CC ?= icl /nologo ; |
| 549 |
CCFLAGS ?= /DNT /MD ; # DLL compatible build by default |
| 550 |
|
| 551 |
C++ ?= $(CC) ; |
| 552 |
C++FLAGS ?= $(CCFLAGS) /GX ; # GX enables syncronous exception handling |
| 553 |
LINK ?= xilink /nologo ; |
| 554 |
LINKOUTFLAG ?= /out: ; |
| 555 |
LINKFLAGS ?= ; # iclvars.bat [arch] sets this up |
| 556 |
|
| 557 |
SHLINKFLAGS ?= ; |
| 558 |
|
| 559 |
STDLIBS ?= |
| 560 |
oldnames.lib |
| 561 |
kernel32.lib |
| 562 |
advapi32.lib |
| 563 |
user32.lib |
| 564 |
mscms.lib |
| 565 |
gdi32.lib |
| 566 |
shlwapi.lib |
| 567 |
shell32.lib |
| 568 |
setupapi.lib |
| 569 |
ole32.lib |
| 570 |
oleaut32.lib |
| 571 |
ws2_32.lib |
| 572 |
Wbemuuid.lib |
| 573 |
; |
| 574 |
SHSTDLIBS ?= $(STDLIBS) ; |
| 575 |
LINKFLAG ?= ; |
| 576 |
STDHDRS ?= $(ICPP_COMPILER14)\\Include ; |
| 577 |
DEFFLAG ?= /D ; |
| 578 |
UNDEFFLAG ?= /U ; |
| 579 |
CCOPTFLAG ?= /O2 ; |
| 580 |
|
| 581 |
if $(MSVCVER) = 6 { |
| 582 |
CCDEBUGFLAG ?= /Od /Z7 ; # Include debugging into in each object |
| 583 |
CCPROFFLAG ?= /Od /Z7 ; |
| 584 |
LINKDEBUGFLAG ?= /DEBUGTYPE:BOTH /DEBUG /PDB:NONE ; |
| 585 |
} else { |
| 586 |
CCDEBUGFLAG ?= /Od /Zi ; # /Zi creates debugging database |
| 587 |
CCPROFFLAG ?= /Od /Zi ; |
| 588 |
LINKDEBUGFLAG ?= /DEBUG ; |
| 589 |
} |
| 590 |
LINKPROFFLAG ?= /PROFILE $(LINKDEBUGFLAG) ; |
| 591 |
LINKOPTFLAG ?= /OPT:REF ; |
| 592 |
LINKSTRIPFLAG ?= ; |
| 593 |
YACC ?= bison -y ; |
| 594 |
YACCGEN ?= .c ; |
| 595 |
YACCFILES ?= y.tab ; |
| 596 |
YACCFLAGS ?= -d ; |
| 597 |
} |
| 598 |
else if $(MSVCNT) || $(MSVCDIR) || $(MSVCDir) || $(VCINSTALLDIR) |
| 599 |
{ |
| 600 |
# Visual C++ 8.0/9.0/10.0/11.0/12.0 uses VCINSTALLDIR |
| 601 |
# We assume VC++ Express + XP32 SDK has been setup |
| 602 |
|
| 603 |
if $(VCINSTALLDIR) { |
| 604 |
# MSVCNT ?= $(VCINSTALLDIR) ; |
| 605 |
MSVCNT ?= $(VCINSTALLDIR:J=" ") ; # VCINSTALLDIR may have spaces... |
| 606 |
} else if $(MSVCDir) { |
| 607 |
MSVCNT ?= $(MSVCDir) ; |
| 608 |
} else { # Visual C++ 6.0 uses MSVCDIR |
| 609 |
MSVCNT ?= $(MSVCDIR) ; |
| 610 |
} |
| 611 |
|
| 612 |
if [ MATCH 17\\.(.*) : $(VisualStudioVersion) ] { |
| 613 |
if $(VSCMD_ARG_TGT_ARCH) = "x64" { |
| 614 |
ECHO "Compiler is VC++17 64 bit" ; |
| 615 |
TARGET64 = true ; |
| 616 |
} else if $(VSCMD_ARG_TGT_ARCH) = "arm64" { |
| 617 |
ECHO "Compiler is VC++17 ARM 64 bit" ; |
| 618 |
TARGET64 = true ; |
| 619 |
} else { |
| 620 |
ECHO "Compiler is VC++17 32 bit" ; |
| 621 |
} |
| 622 |
MSVCVER = 17 ; |
| 623 |
} else if [ MATCH 16\\.(.*) : $(VisualStudioVersion) ] { |
| 624 |
ECHO "Compiler is VC++16 (AKA Community 2019)" ; |
| 625 |
MSVCVER = 16 ; |
| 626 |
} else if [ MATCH 15\\.(.*) : $(VisualStudioVersion) ] { |
| 627 |
ECHO "Compiler is VC++15 (AKA Community 2017)" ; |
| 628 |
MSVCVER = 15 ; |
| 629 |
} else if [ MATCH 14\\.(.*) : $(VisualStudioVersion) ] { |
| 630 |
ECHO "Compiler is VC++14 32 bit" ; |
| 631 |
MSVCVER = 14 ; |
| 632 |
} else if [ MATCH 13\\.(.*) : $(VisualStudioVersion) ] { |
| 633 |
ECHO "Compiler is VC++13 32 bit" ; |
| 634 |
MSVCVER = 13 ; |
| 635 |
} else if [ MATCH 12\\.(.*) : $(VisualStudioVersion) ] { |
| 636 |
ECHO "Compiler is VC++12 32 bit" ; |
| 637 |
MSVCVER = 12 ; |
| 638 |
} else if [ MATCH 11\\.(.*) : $(VisualStudioVersion) ] { |
| 639 |
ECHO "Compiler is VC++11 32 bit" ; |
| 640 |
MSVCVER = 11 ; |
| 641 |
} else if $(VisualStudioVersion) { |
| 642 |
ECHO "Compiler VC++, unknown version " ; |
| 643 |
MSVCVER = 17 ; |
| 644 |
} else if [ MATCH (.*)VC\\+\\+10(.*) : $(MSVCNT) ] { |
| 645 |
ECHO "Compiler is VC++10 32 bit" ; |
| 646 |
MSVCVER = 10 ; |
| 647 |
} else if [ MATCH (.*)VC\\+\\+9(.*) : $(MSVCNT) ] { |
| 648 |
ECHO "Compiler is VC++9 32 bit" ; |
| 649 |
MSVCVER = 09 ; |
| 650 |
} else if [ MATCH (.*)VC\\+\\+8(.*) : $(MSVCNT) ] { |
| 651 |
ECHO "Compiler is VC++8 32 bit" ; |
| 652 |
MSVCVER = 08 ; |
| 653 |
} else { |
| 654 |
ECHO "Compiler is VC++6 32 bit" ; |
| 655 |
MSVCVER = 06 ; |
| 656 |
} |
| 657 |
|
| 658 |
# Add the SDK include and lib if it is present |
| 659 |
if $(MSSdk) { |
| 660 |
MSNTSDK ?= $(MSSdk) ; |
| 661 |
} else if $(MSSDK) { |
| 662 |
MSNTSDK ?= $(MSSDK) ; |
| 663 |
} else if $(MSVCNT) { |
| 664 |
MSNTSDK ?= $(MSVCNT) ; |
| 665 |
} |
| 666 |
|
| 667 |
# bury IA64 in the path for the SDK ??? |
| 668 |
# (but MSSDK already has this ? |
| 669 |
# local I ; if $(CPU) = "IA64" { I = ia64\\ ; } else { I = "" ; } |
| 670 |
local I ; I = "" ; |
| 671 |
|
| 672 |
AR ?= lib /NOLOGO ; |
| 673 |
AS ?= masm386 ; |
| 674 |
CC ?= cl /nologo ; |
| 675 |
CCFLAGS ?= /DNT /MD ; # DLL compatible build by default |
| 676 |
if $(EXTRA_DEFINES) != "" { |
| 677 |
CCFLAGS += /D$(EXTRA_DEFINES) ; |
| 678 |
} |
| 679 |
# if $(MSVCVER) <= 06 { |
| 680 |
# CCFLAGS += /Zm200 ; # Increase compiler heap limit to 150% |
| 681 |
# } |
| 682 |
if $(MSVCVER) >= 08 { |
| 683 |
CCFLAGS += /D_CRT_SECURE_NO_DEPRECATE=1 |
| 684 |
/D_CRT_NONSTDC_NO_DEPRECATE=1 ; |
| 685 |
} |
| 686 |
C++ ?= $(CC) ; |
| 687 |
C++FLAGS ?= $(CCFLAGS) /GX ; # GX enables syncronous exception handling |
| 688 |
LINK ?= link /nologo ; |
| 689 |
LINKOUTFLAG ?= /out: ; |
| 690 |
LINKFLAGS ?= /STACK:16000000 /INCREMENTAL:NO ; |
| 691 |
# LINKFLAGS += /LIBPATH:$(MSNTSDK)\lib\$(I) ; # Not needed ? Problems if spaces.. |
| 692 |
SHLINKFLAGS ?= ; |
| 693 |
|
| 694 |
STDLIBS ?= |
| 695 |
oldnames.lib |
| 696 |
kernel32.lib |
| 697 |
advapi32.lib |
| 698 |
user32.lib |
| 699 |
mscms.lib |
| 700 |
gdi32.lib |
| 701 |
shlwapi.lib |
| 702 |
shell32.lib |
| 703 |
setupapi.lib |
| 704 |
ole32.lib |
| 705 |
oleaut32.lib |
| 706 |
ws2_32.lib |
| 707 |
Wbemuuid.lib |
| 708 |
iphlpapi.lib |
| 709 |
Version.lib |
| 710 |
# Winmm.lib |
| 711 |
; |
| 712 |
if $(MSVCVER) >= 08 { |
| 713 |
STDLIBS += psapi.lib ; |
| 714 |
} |
| 715 |
|
| 716 |
SHSTDLIBS ?= $(STDLIBS) ; |
| 717 |
LINKFLAG ?= ; |
| 718 |
# STDHDRS ?= \"$(MSNTSDK)\Include\" ; # Not needed ? |
| 719 |
DEFFLAG ?= /D ; |
| 720 |
UNDEFFLAG ?= /U ; |
| 721 |
CCOPTFLAG ?= /O2 ; # MSVC9 doesn't understamd GB, G6 ? |
| 722 |
if $(MSVCVER) = 06 { |
| 723 |
CCDEBUGFLAG ?= /Od /Z7 ; # Include debugging into in each object |
| 724 |
CCPROFFLAG ?= /Od /Z7 ; |
| 725 |
LINKDEBUGFLAG ?= /DEBUGTYPE:BOTH /DEBUG /PDB:NONE ; |
| 726 |
} else { |
| 727 |
CCDEBUGFLAG ?= /Od /Zi ; # /Zi creates debugging database |
| 728 |
CCPROFFLAG ?= /Od /Zi ; |
| 729 |
LINKDEBUGFLAG ?= /DEBUG ; |
| 730 |
if $(MSVCVER) > 10 { # ?? which versions need this ?? |
| 731 |
CCDEBUGFLAG += /FS ; # Allow for parallel builds |
| 732 |
CCPROFFLAG += /FS ; |
| 733 |
} |
| 734 |
} |
| 735 |
LINKPROFFLAG ?= /PROFILE $(LINKDEBUGFLAG) ; |
| 736 |
LINKOPTFLAG ?= /OPT:REF ; |
| 737 |
LINKSTRIPFLAG ?= ; |
| 738 |
YACC ?= bison -y ; |
| 739 |
YACCGEN ?= .c ; |
| 740 |
YACCFILES ?= y.tab ; |
| 741 |
YACCFLAGS ?= -d ; |
| 742 |
} |
| 743 |
else |
| 744 |
{ |
| 745 |
EXIT On NT, set BCCROOT, MINGW, MSVCDIR, MSVCNT, MSVC or VCINSTALLDIR to the root |
| 746 |
of the Borland, GCC or Microsoft directories. ; |
| 747 |
} |
| 748 |
} |
| 749 |
else if $(OS2) |
| 750 |
{ |
| 751 |
WATCOM ?= $(watcom) ; |
| 752 |
|
| 753 |
if ! $(WATCOM) |
| 754 |
{ |
| 755 |
Exit On OS2, set WATCOM to the root of the Watcom directory. ; |
| 756 |
} |
| 757 |
|
| 758 |
AR ?= wlib ; |
| 759 |
BINDIR ?= \\os2\\apps ; |
| 760 |
CC ?= wcc386 ; |
| 761 |
CCFLAGS ?= /zq /DOS2 /I$(WATCOM)\\h ; # zq=quiet |
| 762 |
C++ ?= wpp386 ; |
| 763 |
C++FLAGS ?= $(CCFLAGS) ; |
| 764 |
CP ?= copy ; |
| 765 |
DOT ?= . ; |
| 766 |
DOTDOT ?= .. ; |
| 767 |
LINK ?= wcl386 ; |
| 768 |
LINKFLAGS ?= /zq ; # zq=quiet |
| 769 |
STDLIBS ?= ; |
| 770 |
MV ?= move ; |
| 771 |
NOARSCAN ?= true ; |
| 772 |
RM ?= del /f ; |
| 773 |
SLASH ?= \\ ; |
| 774 |
STDHDRS ?= $(WATCOM)\\h ; |
| 775 |
SUFEXE ?= .exe ; |
| 776 |
SUFSH ?= .bat ; |
| 777 |
SUFLIB ?= .lib ; |
| 778 |
SUFOBJ ?= .obj ; |
| 779 |
DEFFLAG ?= /D ; |
| 780 |
UNDEFFLAG ?= "/u _" ; |
| 781 |
|
| 782 |
} |
| 783 |
else if $(VMS) |
| 784 |
{ |
| 785 |
C++ ?= cxx ; |
| 786 |
C++FLAGS ?= ; |
| 787 |
CC ?= cc ; |
| 788 |
CCFLAGS ?= ; |
| 789 |
CHMOD ?= set file/prot= ; |
| 790 |
CP ?= copy/replace ; |
| 791 |
CRELIB ?= true ; |
| 792 |
DOT ?= [] ; |
| 793 |
DOTDOT ?= [-] ; |
| 794 |
EXEMODE ?= (w:e) ; |
| 795 |
FILEMODE ?= (w:r) ; |
| 796 |
HDRS ?= ; |
| 797 |
LINK ?= link ; |
| 798 |
LINKFLAGS ?= "" ; |
| 799 |
STDLIBS ?= ; |
| 800 |
MKDIR ?= create/dir ; |
| 801 |
MV ?= rename ; |
| 802 |
RM ?= delete ; |
| 803 |
RUNVMS ?= mcr ; |
| 804 |
SHELLMODE ?= (w:er) ; |
| 805 |
SLASH ?= . ; |
| 806 |
STDHDRS ?= decc$library_include ; |
| 807 |
SUFEXE ?= .exe ; |
| 808 |
SUFSH ?= .bat ; |
| 809 |
SUFLIB ?= .olb ; |
| 810 |
SUFOBJ ?= .obj ; |
| 811 |
|
| 812 |
switch $(OS) |
| 813 |
{ |
| 814 |
case OPENVMS : CCFLAGS ?= /stand=vaxc ; |
| 815 |
case VMS : STDLIBS ?= sys$library:vaxcrtl.olb/lib ; |
| 816 |
} |
| 817 |
} |
| 818 |
else if $(MAC) |
| 819 |
{ |
| 820 |
local OPT ; |
| 821 |
|
| 822 |
CW ?= "{CW}" ; |
| 823 |
|
| 824 |
MACHDRS ?= |
| 825 |
"$(UMACHDRS):Universal:Interfaces:CIncludes" |
| 826 |
"$(CW):MSL:MSL_C:MSL_Common:Include" |
| 827 |
"$(CW):MSL:MSL_C:MSL_MacOS:Include" ; |
| 828 |
|
| 829 |
MACLIBS ?= |
| 830 |
"$(CW):MacOS Support:Universal:Libraries:StubLibraries:Interfacelib" |
| 831 |
"$(CW):MacOS Support:Universal:Libraries:StubLibraries:Mathlib" ; |
| 832 |
|
| 833 |
MPWLIBS ?= |
| 834 |
"$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_MPWCRuntime_PPC.lib" |
| 835 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC_MPW.Lib" ; |
| 836 |
|
| 837 |
MPWNLLIBS ?= |
| 838 |
"$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_MPWCRuntime_PPC.lib" |
| 839 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC_MPW(NL).Lib" ; |
| 840 |
|
| 841 |
SIOUXHDRS ?= ; |
| 842 |
|
| 843 |
SIOUXLIBS ?= |
| 844 |
"$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_Runtime_PPC.lib" |
| 845 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_SIOUX_PPC.Lib" |
| 846 |
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC.Lib" ; |
| 847 |
|
| 848 |
C++ ?= mwcppc ; |
| 849 |
C++FLAGS ?= -w off ; |
| 850 |
CC ?= mwcppc ; |
| 851 |
CCFLAGS ?= -w off ; |
| 852 |
CP ?= duplicate -y ; |
| 853 |
DOT ?= ":" ; |
| 854 |
DOTDOT ?= "::" ; |
| 855 |
HDRS ?= $(MACHDRS) $(MPWHDRS) ; |
| 856 |
LINK ?= mwlinkppc ; |
| 857 |
LINKFLAGS ?= -mpwtool -warn ; |
| 858 |
STDLIBS ?= $(MACLIBS) $(MPWLIBS) ; |
| 859 |
SHSTDLIBS ?= $(STDLIBS) ; |
| 860 |
MKDIR ?= newfolder ; |
| 861 |
MV ?= rename -y ; |
| 862 |
NOARSCAN ?= true ; |
| 863 |
RM ?= delete -y ; |
| 864 |
SLASH ?= ":" ; |
| 865 |
STDHDRS ?= ; |
| 866 |
SUFLIB ?= .lib ; |
| 867 |
SUFOBJ ?= .o ; |
| 868 |
} |
| 869 |
else if $(OS) = BEOS && $(OSPLAT) = PPC |
| 870 |
{ |
| 871 |
AR ?= mwld -xml -o ; |
| 872 |
BINDIR ?= /boot/home/config/bin ; |
| 873 |
CC ?= mwcc ; |
| 874 |
CCFLAGS ?= -nosyspath ; |
| 875 |
C++ ?= $(CC) ; |
| 876 |
C++FLAGS ?= -nosyspath ; |
| 877 |
CHMOD ?= chmod ; |
| 878 |
CHGRP ?= chgrp ; |
| 879 |
CHOWN ?= chown ; |
| 880 |
FORTRAN ?= "" ; |
| 881 |
LEX ?= flex ; |
| 882 |
LIBDIR ?= /boot/home/config/lib ; |
| 883 |
LINK ?= mwld ; |
| 884 |
LINKFLAGS ?= "" ; |
| 885 |
MANDIR ?= /boot/home/config/man ; |
| 886 |
NOARSCAN ?= true ; |
| 887 |
RANLIB ?= ranlib ; |
| 888 |
STDHDRS ?= /boot/develop/headers/posix ; |
| 889 |
YACC ?= bison -y ; |
| 890 |
YACCGEN ?= .c ; |
| 891 |
YACCFILES ?= y.tab ; |
| 892 |
YACCFLAGS ?= -d ; |
| 893 |
} |
| 894 |
else if $(OS) = BEOS |
| 895 |
{ |
| 896 |
BINDIR ?= /boot/home/config/bin ; |
| 897 |
CC ?= gcc ; |
| 898 |
C++ ?= $(CC) ; |
| 899 |
CHMOD ?= chmod ; |
| 900 |
CHGRP ?= chgrp ; |
| 901 |
CHOWN ?= chown ; |
| 902 |
FORTRAN ?= "" ; |
| 903 |
LEX ?= flex ; |
| 904 |
LIBDIR ?= /boot/home/config/lib ; |
| 905 |
LINK ?= gcc ; |
| 906 |
MANDIR ?= /boot/home/config/man ; |
| 907 |
NOARSCAN ?= true ; |
| 908 |
RANLIB ?= ranlib ; |
| 909 |
STDHDRS ?= /boot/develop/headers/posix ; |
| 910 |
YACC ?= bison -y ; |
| 911 |
YACCGEN ?= .c ; |
| 912 |
YACCFILES ?= y.tab ; |
| 913 |
YACCFLAGS ?= -d ; |
| 914 |
} |
| 915 |
else if $(UNIX) |
| 916 |
{ |
| 917 |
switch $(OS) |
| 918 |
{ |
| 919 |
case AIX : |
| 920 |
STDLIBS ?= -lbsd ; |
| 921 |
|
| 922 |
case AMIGA : |
| 923 |
CC ?= gcc ; |
| 924 |
YACC ?= bison -y ; |
| 925 |
|
| 926 |
case CYGWIN : |
| 927 |
CC ?= gcc ; |
| 928 |
CCFLAGS += -D__cygwin__ ; |
| 929 |
LEX ?= flex ; |
| 930 |
JAMSHELL ?= sh -c ; |
| 931 |
RANLIB ?= "" ; |
| 932 |
SUFEXE ?= .exe ; |
| 933 |
YACC ?= bison -y ; |
| 934 |
|
| 935 |
case DGUX : |
| 936 |
RANLIB ?= "" ; |
| 937 |
RELOCATE ?= true ; |
| 938 |
|
| 939 |
case HPUX : |
| 940 |
RANLIB ?= "" ; |
| 941 |
|
| 942 |
case INTERIX : |
| 943 |
CC ?= gcc ; |
| 944 |
JAMSHELL ?= sh -c ; |
| 945 |
RANLIB ?= "" ; |
| 946 |
|
| 947 |
case IRIX : |
| 948 |
RANLIB ?= "" ; |
| 949 |
|
| 950 |
case MPEIX : |
| 951 |
CC ?= gcc ; |
| 952 |
C++ ?= gcc ; |
| 953 |
CCFLAGS += -D_POSIX_SOURCE ; |
| 954 |
HDRS += /usr/include ; |
| 955 |
RANLIB ?= "" ; |
| 956 |
NOARSCAN ?= true ; |
| 957 |
NOARUPDATE ?= true ; |
| 958 |
|
| 959 |
case MVS : |
| 960 |
RANLIB ?= "" ; |
| 961 |
|
| 962 |
case NEXT : |
| 963 |
AR ?= libtool -o ; |
| 964 |
RANLIB ?= "" ; |
| 965 |
|
| 966 |
case MACOSX : |
| 967 |
# AR ?= libtool -o ; |
| 968 |
AR ?= ar rusc ; |
| 969 |
C++ ?= c++ ; |
| 970 |
MANDIR ?= /usr/local/share/man ; |
| 971 |
RANLIB ?= "" ; |
| 972 |
SUFSHLIB ?= .dylib ; |
| 973 |
SUFIMPLIB ?= .dylib ; |
| 974 |
|
| 975 |
case NCR : |
| 976 |
RANLIB ?= "" ; |
| 977 |
|
| 978 |
case PTX : |
| 979 |
RANLIB ?= "" ; |
| 980 |
|
| 981 |
case QNX : |
| 982 |
AR ?= wlib ; |
| 983 |
CC ?= cc ; |
| 984 |
CCFLAGS ?= -Q ; # quiet |
| 985 |
C++ ?= $(CC) ; |
| 986 |
C++FLAGS ?= -Q ; # quiet |
| 987 |
LINK ?= $(CC) ; |
| 988 |
LINKFLAGS ?= -Q ; # quiet |
| 989 |
NOARSCAN ?= true ; |
| 990 |
RANLIB ?= "" ; |
| 991 |
|
| 992 |
case SCO : |
| 993 |
RANLIB ?= "" ; |
| 994 |
RELOCATE ?= true ; |
| 995 |
|
| 996 |
case SINIX : |
| 997 |
RANLIB ?= "" ; |
| 998 |
|
| 999 |
case SOLARIS : |
| 1000 |
RANLIB ?= "" ; |
| 1001 |
AR ?= "/usr/ccs/bin/ar ru" ; |
| 1002 |
|
| 1003 |
case UNICOS : |
| 1004 |
NOARSCAN ?= true ; |
| 1005 |
CCOPTFLAG ?= -O0 ; |
| 1006 |
|
| 1007 |
case UNIXWARE : |
| 1008 |
RANLIB ?= "" ; |
| 1009 |
RELOCATE ?= true ; |
| 1010 |
} |
| 1011 |
|
| 1012 |
# UNIX defaults |
| 1013 |
|
| 1014 |
CCFLAGS ?= $(CPPFLAGS) -g -DUNIX -D_THREAD_SAFE -pipe -fPIC ; # -fwrapv ?? |
| 1015 |
CCOPTFLAG ?= -O2 ; |
| 1016 |
CCDEBUGFLAG ?= -g ; |
| 1017 |
CCPROFFLAG ?= ; |
| 1018 |
CCSHOBJFLAG ?= -fPIC ; # Position independent is better for ShLibrary |
| 1019 |
C++FLAGS ?= $(CCFLAGS) ; |
| 1020 |
CHMOD ?= chmod ; |
| 1021 |
CHGRP ?= chgrp ; |
| 1022 |
CHOWN ?= chown ; |
| 1023 |
LEX ?= lex ; |
| 1024 |
LINKFLAGS ?= $(LDFLAGS) ; |
| 1025 |
LINKOPTFLAG ?= -O ; # Affects creating .so's |
| 1026 |
LINKSTRIPFLAG ?= -s ; |
| 1027 |
LINKDEBUGFLAG ?= ; |
| 1028 |
LINKPROFFLAG ?= ; |
| 1029 |
SHLINKFLAGS ?= ; # Flags for creation of shared library |
| 1030 |
STDLIBS ?= -lm -lpthread ; |
| 1031 |
SHSTDLIBS ?= $(STDLIBS) ; |
| 1032 |
LINKFLAG ?= -l ; |
| 1033 |
RANLIB ?= "" ; |
| 1034 |
YACC ?= yacc ; |
| 1035 |
YACCGEN ?= .c ; |
| 1036 |
YACCFILES ?= y.tab ; |
| 1037 |
YACCFLAGS ?= -d ; |
| 1038 |
|
| 1039 |
HDRS ?= /usr/local/include ; |
| 1040 |
|
| 1041 |
# Add some good defaults for OS X |
| 1042 |
if $(OS) = MACOSX { |
| 1043 |
CCFLAGS += -Wno-sign-compare ; # supress new gcc4 warnings ? |
| 1044 |
CCFLAGS += -fpascal-strings ; # for compatibility with the OSX API |
| 1045 |
LINKFLAGS += -framework Carbon ; # default for .c |
| 1046 |
LINKFLAGS += -framework Cocoa ; # default for .m |
| 1047 |
|
| 1048 |
if $(COMPILER) = "OSX10_6_X86_64BIT" { |
| 1049 |
ECHO "We're cross compiling to OSX 10.6 AMD/Intel 64 bit" ; |
| 1050 |
# setup script needs to export MACOSX_DEPLOYMENT_TARGET="10.6" |
| 1051 |
# and export CROSS_CFLAGS=--target=x86_64-apple-macosx10.6.0 |
| 1052 |
# and export CROSS_LDFLAGS=--target=x86_64-apple-macosx10.6.0 |
| 1053 |
# and export CROSS_TARGET=x86_64-apple-darwin10.0 |
| 1054 |
CCFLAGS += --target=x86_64-apple-macosx10.6.0 ; |
| 1055 |
LINKFLAGS += --target=x86_64-apple-macosx10.6.0 ; |
| 1056 |
|
| 1057 |
} else if $(COMPILER) = "OSX10_4_X86_32BIT" { |
| 1058 |
ECHO "We're cross compiling to OSX 10.4 Intel 32 bit" ; |
| 1059 |
# setup script needs to export MACOSX_DEPLOYMENT_TARGET="10.4" |
| 1060 |
# and export CROSS_CFLAGS=--target=i386-apple-macosx10.4.0 |
| 1061 |
# and export CROSS_LDFLAGS=--target=i386-apple-macosx10.4.0 |
| 1062 |
# and export CROSS_TARGET=i386-apple-darwin8.0 |
| 1063 |
CCFLAGS += --target=i386-apple-macosx10.4.0 ; |
| 1064 |
LINKFLAGS += --target=i386-apple-macosx10.4.0 ; |
| 1065 |
|
| 1066 |
} else if $(COMPILER) = "OSX10_3_PPC_32BIT" { |
| 1067 |
ECHO "We're cross compiling to OSX 10.3 PowerPC 32 bit" ; |
| 1068 |
# setup script needs to export MACOSX_DEPLOYMENT_TARGET="10.3" |
| 1069 |
# and export CROSS_CFLAGS=--target=powerpc-apple-darwin8.0 |
| 1070 |
# and export CROSS_LDFLAGS=--target=powerpc-apple-darwin8.0 |
| 1071 |
# and export CROSS_TARGET=powerpc-apple-darwin8.0 |
| 1072 |
# CCFLAGS += --target=powerpc-apple-darwin8.0 ; |
| 1073 |
# LINKFLAGS += --target=powerpc-apple-darwin8.0 ; |
| 1074 |
# CC = powerpc-apple-darwin9-gcc-4.2.1 ; |
| 1075 |
# C++ = powerpc-apple-darwin9-g++-4.2.1 ; |
| 1076 |
} |
| 1077 |
} |
| 1078 |
|
| 1079 |
# Make things work on 64 bit Linux |
| 1080 |
# Because HOSTTYPE is not normally exported, check the uname() result |
| 1081 |
if ! $(HOSTTYPE) { |
| 1082 |
HOSTTYPE = $(JAMUNAME[1]) ; |
| 1083 |
} |
| 1084 |
|
| 1085 |
if $(COMPILER) != "OSX10_4_X86_32BIT" { |
| 1086 |
if $(HOSTTYPE) = x86_64 |
| 1087 |
|| $(HOSTTYPE) = x86_64-linux |
| 1088 |
|| $(HOSTTYPE) = amd64 { |
| 1089 |
ECHO "We're on a 64 bit host" ; |
| 1090 |
HOST64 = true ; |
| 1091 |
TARGET64 = true ; |
| 1092 |
CCFLAGS += -m64 ; |
| 1093 |
C++FLAGS += -m64 ; |
| 1094 |
} |
| 1095 |
} |
| 1096 |
|
| 1097 |
|
| 1098 |
# Hmm. Newer linux gcc ar defaults to no timestamps |
| 1099 |
# and introduces a new option to get old behaviour, |
| 1100 |
# breaking the dependency determination. |
| 1101 |
# Older versions of ar will barf on the new option |
| 1102 |
# There seems no way of determining this short of checking |
| 1103 |
# the version of ar :-(:-( |
| 1104 |
# gcc seems oblivious to the pain caused by their change of behaviour. |
| 1105 |
# We use a hack - user has to set NEW_GNU_AR_OPTIONS |
| 1106 |
if $(JAM_NEW_GNU_AR_OPTIONS) != "" { |
| 1107 |
AR = ar ruscU ; |
| 1108 |
} |
| 1109 |
|
| 1110 |
# Adding --hash-style=sysv to the compiler options |
| 1111 |
# might improve Linux compatibility with FC5 ? |
| 1112 |
} |
| 1113 |
|
| 1114 |
# |
| 1115 |
# General defaults; a lot like UNIX |
| 1116 |
# |
| 1117 |
|
| 1118 |
AR ?= ar rusc ; |
| 1119 |
AS ?= as ; |
| 1120 |
ASFLAGS ?= ; |
| 1121 |
AWK ?= awk ; |
| 1122 |
BINDIR ?= /usr/local/bin ; |
| 1123 |
C++ ?= cc ; |
| 1124 |
C++FLAGS ?= ; |
| 1125 |
CC ?= cc ; |
| 1126 |
CCFLAGS ?= ; |
| 1127 |
CP ?= cp -f ; |
| 1128 |
CRELIB ?= ; |
| 1129 |
DOT ?= . ; |
| 1130 |
DOTDOT ?= .. ; |
| 1131 |
EXEMODE ?= 755 ; |
| 1132 |
FILEMODE ?= 644 ; |
| 1133 |
FORTRAN ?= f77 ; |
| 1134 |
FORTRANFLAGS ?= ; |
| 1135 |
HDRS ?= ; |
| 1136 |
INSTALLGRIST ?= installed ; |
| 1137 |
JAMFILE ?= Jamfile ; |
| 1138 |
JAMTOP ?= Jamtop ; |
| 1139 |
LEX ?= ; |
| 1140 |
LIBDIR ?= /usr/local/lib ; |
| 1141 |
LINK ?= $(CC) ; |
| 1142 |
LINKFLAGS ?= ; |
| 1143 |
SHLINKFLAGS ?= ; |
| 1144 |
STDLIBS ?= ; |
| 1145 |
SHSTDLIBS ?= $(STDLIBS) ; |
| 1146 |
LINKOUTFLAG ?= "-o " ; |
| 1147 |
LN ?= ln ; |
| 1148 |
MANDIR ?= /usr/local/man ; |
| 1149 |
MKDIR ?= mkdir ; |
| 1150 |
MV ?= mv -f ; |
| 1151 |
RCP ?= rcp ; |
| 1152 |
RM ?= rm -f ; |
| 1153 |
RMDIR ?= $(RM) ; |
| 1154 |
RSH ?= rsh ; |
| 1155 |
SED ?= sed ; |
| 1156 |
SHELLHEADER ?= "#!/bin/sh" ; |
| 1157 |
SHELLMODE ?= 755 ; |
| 1158 |
SLASH ?= / ; |
| 1159 |
STDHDRS ?= /usr/include ; |
| 1160 |
SUFEXE ?= "" ; |
| 1161 |
SUFSH ?= .sh ; |
| 1162 |
SUFLIB ?= .a ; |
| 1163 |
SUFSHLIB ?= .so ; |
| 1164 |
SUFIMPLIB ?= .so ; |
| 1165 |
SUFOBJ ?= .o ; |
| 1166 |
|
| 1167 |
DEFFLAG ?= -D ; |
| 1168 |
UNDEFFLAG ?= -U ; |
| 1169 |
YACC ?= ; |
| 1170 |
YACCGEN ?= ; |
| 1171 |
YACCFILES ?= ; |
| 1172 |
YACCFLAGS ?= ; |
| 1173 |
|
| 1174 |
# Scan both #include <xxx.h> and #include "xxx.h" |
| 1175 |
# HDRPATTERN = "^[ ]*#[ ]*include[ ]*[<\"]([^\">]*)[\">].*$" ; |
| 1176 |
|
| 1177 |
# Scan just #include "xxx.h" |
| 1178 |
# (Some linux systems hide standard .h files in directories that aren't in |
| 1179 |
# env. paths) |
| 1180 |
HDRPATTERN = "^[ ]*#[ ]*include[ ]*[\"]([^\">]*)[\"].*$" ; |
| 1181 |
|
| 1182 |
OSFULL = $(OS)$(OSVER)$(OSPLAT) $(OS)$(OSPLAT) $(OS)$(OSVER) $(OS) ; |
| 1183 |
|
| 1184 |
|
| 1185 |
# =========================================================== |
| 1186 |
|
| 1187 |
# |
| 1188 |
# Base dependencies - first for "bootstrap" kinds of rules |
| 1189 |
# |
| 1190 |
|
| 1191 |
Depends all : shell files lib exe obj ; |
| 1192 |
Depends all shell files lib exe obj install : first ; |
| 1193 |
NotFile all first shell files lib exe obj dirs clean install uninstall ; |
| 1194 |
Always clean uninstall ; |
| 1195 |
|
| 1196 |
# =========================================================== |
| 1197 |
# ArgyllCMS Jambase building blocks: |
| 1198 |
|
| 1199 |
# Allow returning of a targets "on" variable |
| 1200 |
# Only the first variable in the list "on" variable is retrieved |
| 1201 |
# ret = geton target : variable ; |
| 1202 |
rule noop { return $(<) ; } |
| 1203 |
rule geton { |
| 1204 |
local _rv ; |
| 1205 |
_rv = [ on $(<[1]) noop $($(>)) ] ; |
| 1206 |
return $(_rv) ; |
| 1207 |
} |
| 1208 |
|
| 1209 |
# Separate a single path into it's components, irrespective of |
| 1210 |
# whether a MSWindows or UNIX path separator is used. |
| 1211 |
# d1 d2 ... file = _SepPath path ; |
| 1212 |
rule _SepPath |
| 1213 |
{ |
| 1214 |
#Echo "_SepPath called with = '" $(<[1]) "'" ; |
| 1215 |
|
| 1216 |
local _in = /$(<[1]) ; # leading / is to detect absolute path |
| 1217 |
local split = true ; |
| 1218 |
local _out = ; |
| 1219 |
|
| 1220 |
if ! $(<) { |
| 1221 |
#Echo "_SepPath returning '" "" "'" ; |
| 1222 |
return $(<) ; |
| 1223 |
} |
| 1224 |
|
| 1225 |
split = [ MATCH (.*)[/\\](.*) : $(_in) ] ; |
| 1226 |
while $(split) { |
| 1227 |
#Echo "Split = '" $(split[1]) "' and '" $(split[2]) "'" ; |
| 1228 |
_out = $(split[2]) $(_out) ; |
| 1229 |
_in = $(split[1]) ; |
| 1230 |
split = [ MATCH (.*)[/\\](.*) : $(_in) ] ; |
| 1231 |
} |
| 1232 |
#Echo "After slplitting got '" $(_in) "' out '" $(_out) "'" ; |
| 1233 |
|
| 1234 |
if $(_in) != "" { # No leading / |
| 1235 |
#Echo "Setting _out to '" $(_in) "' plus '" $(_out) "'" ; |
| 1236 |
_out = $(_in) $(_out) ; |
| 1237 |
} |
| 1238 |
|
| 1239 |
#Echo "_SepPath initial sep =" $(_out) ; |
| 1240 |
|
| 1241 |
# Deal with DOS drive letters |
| 1242 |
if $(NT) { |
| 1243 |
switch $(_out[1]) { |
| 1244 |
case *:* : { |
| 1245 |
split = [ MATCH (.*)[:](.*) : $(_out[1]) ] ; |
| 1246 |
if $(split[2]) != "" { |
| 1247 |
_out = $(split[1]): $(split[2]) $(_out[2-]) ; |
| 1248 |
} else { |
| 1249 |
_out = $(split[1]): $(SLASH) $(_out[2-]) ; |
| 1250 |
} |
| 1251 |
} |
| 1252 |
} |
| 1253 |
#Echo "_SepPath after DOS letters _out =" $(_out) ; |
| 1254 |
} |
| 1255 |
|
| 1256 |
# Make sure leading / is in the correct form |
| 1257 |
if $(_out[1]) = "/" || $(_out[1]) = "\\" { |
| 1258 |
_out = $(SLASH) $(_out[2-]) ; |
| 1259 |
} |
| 1260 |
|
| 1261 |
#Echo "_SepPath returning _out =" $(_out) ; |
| 1262 |
|
| 1263 |
return $(_out) ; |
| 1264 |
} |
| 1265 |
|
| 1266 |
# Turn a sequence of directories into a directory path. |
| 1267 |
# Opposite of _SepPath |
| 1268 |
# path = _DirName d1 d2 ... ; |
| 1269 |
rule _DirName |
| 1270 |
{ |
| 1271 |
local _in = $(<) ; |
| 1272 |
local _out = "" ; |
| 1273 |
|
| 1274 |
#Echo "_DirName got '" $(_in) "'" ; |
| 1275 |
|
| 1276 |
# Deal with DOS drive letters |
| 1277 |
if $(NT) { |
| 1278 |
switch $(_in[1]) { |
| 1279 |
case *:* : { |
| 1280 |
#Echo "_DirName match x:" ; |
| 1281 |
_out = $(_in[1]) ; |
| 1282 |
_in = $(_in[2-]) ; |
| 1283 |
} |
| 1284 |
} |
| 1285 |
#Echo "_DirName _in = '" $(_in) "' out = '" $(_out) "'" ; |
| 1286 |
} |
| 1287 |
|
| 1288 |
# Deal with absolute path |
| 1289 |
if $(_in[1]) = "/" || $(_in[1]) = "\\" { |
| 1290 |
_out = $(_out)$(SLASH) ; |
| 1291 |
_in = $(_in[2-]) ; |
| 1292 |
#Echo "_DirName abs in = '" $(_in) "' out = '" $(_out) "'" ; |
| 1293 |
} |
| 1294 |
|
| 1295 |
while $(_in) { |
| 1296 |
_out = $(_out)$(_in[1]) ; |
| 1297 |
_in = $(_in[2-]) ; |
| 1298 |
#Echo "_DirName in = '" $(_in) "' out = '" $(_out) "'" ; |
| 1299 |
if $(_in) { |
| 1300 |
_out = $(_out)$(SLASH) ; |
| 1301 |
} |
| 1302 |
#Echo "_DirName sep in = '" $(_in) "' out = '" $(_out) "'" ; |
| 1303 |
} |
| 1304 |
|
| 1305 |
#Echo "_DirName returning '" $(_out) "'" ; |
| 1306 |
return $(_out) ; |
| 1307 |
} |
| 1308 |
|
| 1309 |
# Rationalize a path (ie. cancell dirs & .. ) |
| 1310 |
# Currently paths that cancel out return " ". |
| 1311 |
# d1 d2 .. file = _RatPath d1 d2 .. file ; |
| 1312 |
rule _RatPath |
| 1313 |
{ |
| 1314 |
local _in = $(<) ; |
| 1315 |
local _rio = ; # reversed intermediate output |
| 1316 |
local _out = ; |
| 1317 |
local _gotdot = ; # There was a dot in the input path |
| 1318 |
local _first = ; # Fixed first elements |
| 1319 |
|
| 1320 |
#Echo "_RatPath called with '" $(_in) "'" ; |
| 1321 |
|
| 1322 |
# Deal with DOS drive letters |
| 1323 |
if $(NT) { |
| 1324 |
switch $(_in[1]) { |
| 1325 |
case *:* : { |
| 1326 |
_first = $(_first) $(_in[1]) ; |
| 1327 |
_in = $(_in[2-]) ; |
| 1328 |
} |
| 1329 |
} |
| 1330 |
#Echo "_RatPath got first '" $(_first) "' in = '" $(_in) "'" ; |
| 1331 |
} |
| 1332 |
|
| 1333 |
# Deal with absolute path or single dot |
| 1334 |
if $(_in[1]) = / || $(_in[1]) = \\ { |
| 1335 |
_first = $(_first) $(SLASH) ; |
| 1336 |
_in = $(_in[2-]) ; |
| 1337 |
#Echo "_RatPath got first '" $(_first) "' in = '" $(_in) "'" ; |
| 1338 |
} else { |
| 1339 |
if $(_in[1]) = $(DOT) && ! $(_in[2-]) { |
| 1340 |
_first = $(_first) $(DOT) ; |
| 1341 |
_in = $(_in[2-]) ; |
| 1342 |
#Echo "_RatPath got first '" $(_first) "' in = '" $(_in) "'" ; |
| 1343 |
} |
| 1344 |
} |
| 1345 |
while $(_in) { |
| 1346 |
#Echo "Next = " $(_in[1]) " and last = " $(_rio[1]) ; |
| 1347 |
if $(_in[1]) = $(DOT) { |
| 1348 |
_gotdot = true ; |
| 1349 |
} |
| 1350 |
# if the .. will cancel out the previous directory |
| 1351 |
if $(_in[1]) = $(DOTDOT) && $(_rio[1]) && $(_rio[1] != $(DOTDOT) { |
| 1352 |
_rio = $(_rio[2-]) ; # Remove previous |
| 1353 |
#Echo "Found .. so removed previous and got _rio = " $(_rio) ; |
| 1354 |
} else { # Add next |
| 1355 |
# If we're decending with a directory |
| 1356 |
if $(_in[1]) != $(DOT) { |
| 1357 |
_rio = $(_in[1]) $(_rio) ; |
| 1358 |
#Echo "Adding so _rio = " $(_rio) ; |
| 1359 |
} else { |
| 1360 |
#Echo "Found . so ignoring got _rio = " $(_rio) ; |
| 1361 |
} |
| 1362 |
} |
| 1363 |
_in = $(_in[2-]) ; |
| 1364 |
} |
| 1365 |
# Make sure that a single dot is preserved |
| 1366 |
if $(_gotdot) && ! $(_rio) { |
| 1367 |
_rio = $(DOT) ; |
| 1368 |
} |
| 1369 |
#Echo "Final _rio = " $(_rio) ; |
| 1370 |
# Reverse it |
| 1371 |
for _i in $(_rio) { |
| 1372 |
_out = $(_i) $(_out) ; |
| 1373 |
} |
| 1374 |
|
| 1375 |
# Preprent with first */ |
| 1376 |
_out = $(_first) $(_out) ; |
| 1377 |
|
| 1378 |
#Echo "_RatPath rationalized to '" $(_out) "'" ; |
| 1379 |
#Echo ; |
| 1380 |
|
| 1381 |
return $(_out) ; |
| 1382 |
} |
| 1383 |
|
| 1384 |
# Re-root a directory path by pre-pending the given path. |
| 1385 |
# Don't do this if the path is absolute |
| 1386 |
# Don't return anything if the path is empty. |
| 1387 |
# p1 p2 .. file = _RootPath d1 d2 .. : p1 p2 ... file ; |
| 1388 |
rule _RootPath |
| 1389 |
{ |
| 1390 |
local _i _out = ; |
| 1391 |
|
| 1392 |
#Echo "_RootPath called with '" $(<) "' and '" $(>) "'" ; |
| 1393 |
|
| 1394 |
if ! $(>[1]) { |
| 1395 |
#Echo "_RootPath no RHS returning '" $(<) "'" ; |
| 1396 |
return $(<) ; |
| 1397 |
} |
| 1398 |
|
| 1399 |
if $(>[1]) = "/" || $(>[1]) = "\\" { |
| 1400 |
#Echo "_RootPath RHS = / returning '" $(<) "'" ; |
| 1401 |
return $(>) ; |
| 1402 |
} |
| 1403 |
if $(NT) { |
| 1404 |
switch $(>[1]) { |
| 1405 |
case *:* : { |
| 1406 |
#Echo "_RootPath RHS = drive: returning '" $(<) "'" ; |
| 1407 |
return $(>) ; |
| 1408 |
} |
| 1409 |
} |
| 1410 |
} |
| 1411 |
|
| 1412 |
#Echo "_RootPath returning '" $(<) $(>) "'" ; |
| 1413 |
return $(<) $(>) ; |
| 1414 |
|
| 1415 |
} |
| 1416 |
|
| 1417 |
# Re-root a set of directory paths by pre-pending the given path. |
| 1418 |
# Don't do this if the path is absolute |
| 1419 |
# Don't return anything if the path is empty. |
| 1420 |
# paths = RootPaths dir : paths ; |
| 1421 |
rule RootPaths |
| 1422 |
{ |
| 1423 |
local _d = [ _SepPath $(<[1]) ] ; |
| 1424 |
local _i _t ; |
| 1425 |
local _out = ; |
| 1426 |
|
| 1427 |
#Echo "RootPaths got dir '" $(<[1]) "' and paths '" $(>) "'" ; |
| 1428 |
for _i in $(>) |
| 1429 |
{ |
| 1430 |
_t = [ _SepPath $(_i) ] ; |
| 1431 |
_t = [ _RootPath $(_d) : $(_t) ] ; |
| 1432 |
_t = [ _RatPath $(_t) ] ; |
| 1433 |
_out += [ _DirName $(_t) ] ; |
| 1434 |
} |
| 1435 |
|
| 1436 |
#Echo "RootPaths returns to '" $(_out) "'" ; |
| 1437 |
|
| 1438 |
return $(_out) ; |
| 1439 |
} |
| 1440 |
|
| 1441 |
# - - - - - - - - - - - - - - |
| 1442 |
|
| 1443 |
# Rationalize a set of paths (ie. cancell dirs & .. ) |
| 1444 |
# paths = RatPaths paths ; |
| 1445 |
rule RatPaths |
| 1446 |
{ |
| 1447 |
local _i _t ; |
| 1448 |
local _out = ; |
| 1449 |
|
| 1450 |
#Echo "RatPaths got '" $(<) "'" ; |
| 1451 |
for _i in $(<) |
| 1452 |
{ |
| 1453 |
_t = [ _SepPath $(_i) ] ; |
| 1454 |
_t = [ _RatPath $(_t) ] ; |
| 1455 |
_out += [ _DirName $(_t) ] ; |
| 1456 |
} |
| 1457 |
|
| 1458 |
#Echo "RatPaths returns to '" $(_out) "'" ; |
| 1459 |
|
| 1460 |
return $(_out) ; |
| 1461 |
} |
| 1462 |
|
| 1463 |
# Normalize a set of paths. This resolves the |
| 1464 |
# paths location with respect to SUBDIR, and so |
| 1465 |
# accounting for the location of the Jamfile |
| 1466 |
# the path is declared, and rationalizes the result. |
| 1467 |
# If the optional dir is present, use it to |
| 1468 |
# locate their targets rather than SUBDIR. |
| 1469 |
# If paths is empty, nothing is returned. |
| 1470 |
# SRCDIR and DSTDIR are ignored. |
| 1471 |
# paths = NormPaths paths : [ dir ] ; |
| 1472 |
rule NormPaths |
| 1473 |
{ |
| 1474 |
return [ _NormPaths $(<) : $(>) : "none" ] ; |
| 1475 |
} |
| 1476 |
|
| 1477 |
# Normalize a set of Source paths. This resolves the |
| 1478 |
# paths location with respect to SUBDIR, and so |
| 1479 |
# accounting for the location of the Jamfile |
| 1480 |
# the path is declared, and rationalizes the result. |
| 1481 |
# If the optional dir is present, use it to |
| 1482 |
# locate thie targets rather than SUBDIR. |
| 1483 |
# If paths is empty, nothing is returned. |
| 1484 |
# paths = NormPaths paths : [ dir ] ; |
| 1485 |
rule NormSrcPaths |
| 1486 |
{ |
| 1487 |
return [ _NormPaths $(<) : $(>) : "src" ] ; |
| 1488 |
} |
| 1489 |
|
| 1490 |
# Normalize a set of destination paths. This resolves the |
| 1491 |
# paths location with respect to SUBDIR, and so |
| 1492 |
# accounting for the location of the Jamfile |
| 1493 |
# the path is declared, and rationalizes the result. |
| 1494 |
# If the optional dir is present, use it to |
| 1495 |
# locate thie targets rather than SUBDIR. |
| 1496 |
# If paths is empty, nothing is returned. |
| 1497 |
# paths = NormPaths paths : [ dir ] ; |
| 1498 |
rule NormDstPaths |
| 1499 |
{ |
| 1500 |
return [ _NormPaths $(<) : $(>) : "dst" ] ; |
| 1501 |
} |
| 1502 |
|
| 1503 |
# Normalize a set of paths. This resolves the |
| 1504 |
# paths location with respect to SUBDIR, and so |
| 1505 |
# accounting for the location of the Jamfile |
| 1506 |
# the path is declared, and rationalizes the result. |
| 1507 |
# If the optional dir is present, use it to |
| 1508 |
# locate thie targets rather than SUBDIR. |
| 1509 |
# If paths is empty, nothing is returned. |
| 1510 |
# paths = NormPaths paths : dir : type ; |
| 1511 |
# (This and the other rules it calls, is probably a good candidate for speed optimization!) |
| 1512 |
rule _NormPaths |
| 1513 |
{ |
| 1514 |
local _ipath ; |
| 1515 |
local _p _i _t ; |
| 1516 |
local _out = ; |
| 1517 |
local _src _dst ; |
| 1518 |
|
| 1519 |
# If we already have grist, de-normalize before re-normalizing |
| 1520 |
_ipath = $(<) ; |
| 1521 |
if $(_ipath:G) { |
| 1522 |
_ipath = [ DeNormTargs $(_ipath) ] ; |
| 1523 |
} |
| 1524 |
|
| 1525 |
if $(>) { |
| 1526 |
_p = [ _SepPath $(>[1]) ] ; |
| 1527 |
_p = [ _RatPath $(_p) ] ; |
| 1528 |
} else { |
| 1529 |
_p = $(_SUBDIR) ; |
| 1530 |
} |
| 1531 |
|
| 1532 |
_src = [ _SepPath $(SRCDIR) ] ; |
| 1533 |
_dst = [ _SepPath $(DSTDIR) ] ; |
| 1534 |
|
| 1535 |
#Echo "_NormPaths got '" $(_ipath) "' dir '" $(_p) "' type '" $(3) "'srcdir "' $(_src) "' dstdir '" $(_dst) "'" ; |
| 1536 |
for _i in $(_ipath) |
| 1537 |
{ |
| 1538 |
#Echo "_i = '" $(_i) "'" ; |
| 1539 |
_t = [ _SepPath $(_i) ] ; |
| 1540 |
#Echo "_SepPath _i = '" $(_i) "'" ; |
| 1541 |
_t = [ _RootPath $(_p) : $(_t) ] ; |
| 1542 |
#Echo "_RootPath _t = '" $(_t) "'" ; |
| 1543 |
|
| 1544 |
if $(_src) && $(3) = "src" { |
| 1545 |
_t = [ _RootPath $(_src) : $(_t) ] ; |
| 1546 |
#Echo "_src += _t = '" $(_i) "'" ; |
| 1547 |
|
| 1548 |
} else if $(_dst) && $(3) = "dst" { |
| 1549 |
local _f ; |
| 1550 |
_t = [ _DirName $(_t) ] ; |
| 1551 |
_f = [ _SepPath $(_t:BS) ] ; |
| 1552 |
_t = $(_t:D) ; |
| 1553 |
if ! $(_t) { |
| 1554 |
_t = $(DOT) ; |
| 1555 |
} |
| 1556 |
_t = [ _RootPath [ _SepPath $(_t) ] : $(_dst) ] $(_f) ; |
| 1557 |
#Echo " _t += _dst = '" $(_t) "'" ; |
| 1558 |
} |
| 1559 |
_t = [ _RatPath $(_t) ] ; |
| 1560 |
#Echo "_RatPath _t = '" $(_t) "'" ; |
| 1561 |
# Special case of complete cancelation that can occure for a pure |
| 1562 |
# directory path (?) |
| 1563 |
if $(_t) = "" { |
| 1564 |
_t = "." ; |
| 1565 |
} |
| 1566 |
_t = [ _DirName $(_t) ] ; |
| 1567 |
_out += $(_t) ; |
| 1568 |
#Echo "_out += '" $(_t) "'" ; |
| 1569 |
} |
| 1570 |
|
| 1571 |
#Echo "_NormPaths returns '" $(_out) "'" ; |
| 1572 |
return $(_out) ; |
| 1573 |
} |
| 1574 |
|
| 1575 |
# Normalize a set of targets. |
| 1576 |
# This is the same as NormPaths except it |
| 1577 |
# then strips the path out and uses it to set the |
| 1578 |
# Grist, NOMLOC, LOCATE and SEARCH on the target. |
| 1579 |
# If the optional dir is present, use it to |
| 1580 |
# locate the targets rather than SUBDIR. |
| 1581 |
# Ignore SRCDIR if present. |
| 1582 |
# paths = NormTargets paths [ : dir ] ; |
| 1583 |
rule NormISrcTargets |
| 1584 |
{ |
| 1585 |
return [ _NormTargets $(<) : $(>) : "isrc" ] ; |
| 1586 |
} |
| 1587 |
|
| 1588 |
# Normalize a set of targets. |
| 1589 |
# This is the same as NormPaths except it |
| 1590 |
# then strips the path out and uses it to set the |
| 1591 |
# Grist, NOMLOC, LOCATE and SEARCH on the target. |
| 1592 |
# If the optional dir is present, use it to |
| 1593 |
# locate the targets rather than SUBDIR. |
| 1594 |
# se DSTDIR if present. |
| 1595 |
# paths = NormTargets paths [ : dir ] ; |
| 1596 |
rule NormIDstTargets |
| 1597 |
{ |
| 1598 |
return [ _NormTargets $(<) : $(>) : "idst" ] ; |
| 1599 |
} |
| 1600 |
|
| 1601 |
# Normalize a set of targets. |
| 1602 |
# This is the same as NormPaths except it |
| 1603 |
# then strips the path out and uses it to set the |
| 1604 |
# Grist, NOMLOC, LOCATE and SEARCH on the target. |
| 1605 |
# If the optional dir is present, use it to |
| 1606 |
# locate the targets rather than SUBDIR. |
| 1607 |
# Use SRCDIR if present. |
| 1608 |
# paths = NormTargets paths [ : dir ] ; |
| 1609 |
rule NormSrcTargets |
| 1610 |
{ |
| 1611 |
return [ _NormTargets $(<) : $(>) : "src" ] ; |
| 1612 |
} |
| 1613 |
|
| 1614 |
# Normalize a set of targets. |
| 1615 |
# This is the same as NormPaths except it |
| 1616 |
# then strips the path out and uses it to set the |
| 1617 |
# Grist, NOMLOC, LOCATE and SEARCH on the target. |
| 1618 |
# If the optional dir is present, use it to |
| 1619 |
# locate the targets rather than SUBDIR. |
| 1620 |
# Use DSTDIR if present. |
| 1621 |
# paths = NormTargets paths [ : dir ] ; |
| 1622 |
rule NormDstTargets |
| 1623 |
{ |
| 1624 |
return [ _NormTargets $(<) : $(>) : "dst" ] ; |
| 1625 |
} |
| 1626 |
|
| 1627 |
# Normalize a set of targets. |
| 1628 |
# This is the same as NormPaths except it |
| 1629 |
# then strips the path out and uses it to set the |
| 1630 |
# Grist, NOMLOC, LOCATE and SEARCH on the target. |
| 1631 |
# If the optional dir is present, use it to |
| 1632 |
# locate the targets rather than SUBDIR. |
| 1633 |
# paths = NormTargets paths : dir : type ; |
| 1634 |
rule _NormTargets |
| 1635 |
{ |
| 1636 |
local _ipath ; |
| 1637 |
local _p _i _t _d _ds ; |
| 1638 |
local _out = ; |
| 1639 |
local _src _dst ; |
| 1640 |
|
| 1641 |
# If we already have grist, de-normalize before re-normalizing |
| 1642 |
_ipath = $(<) ; |
| 1643 |
if $(_ipath:G) { |
| 1644 |
_ipath = [ DeNormTargs $(_ipath) ] ; |
| 1645 |
} |
| 1646 |
|
| 1647 |
if $(>) { |
| 1648 |
_p = [ _SepPath $(>[1]) ] ; |
| 1649 |
} else { |
| 1650 |
_p = $(_SUBDIR) ; |
| 1651 |
} |
| 1652 |
|
| 1653 |
if $(3) = "src" || $(3) = "dst" { |
| 1654 |
_src = [ _SepPath $(SRCDIR) ] ; |
| 1655 |
_dst = [ _SepPath $(DSTDIR) ] ; |
| 1656 |
} |
| 1657 |
|
| 1658 |
#Echo ; |
| 1659 |
#Echo "_NormTargets got '" $(_ipath) "' base = '" $(_p) "' type '" $(3) "' srcdir = '" $(_src) "' dstdirr = '" $(_dst) "'" ; |
| 1660 |
for _i in $(_ipath) |
| 1661 |
{ |
| 1662 |
_t = [ _SepPath $(_i) ] ; |
| 1663 |
#Echo " _t = '" $(_t) "'" ; |
| 1664 |
_t = [ _RootPath $(_p) : $(_t) ] ; |
| 1665 |
#Echo " _t = '" $(_t) "'" ; |
| 1666 |
_t = [ _RatPath $(_t) ] ; |
| 1667 |
#Echo " _t = '" $(_t) "'" ; |
| 1668 |
_t = [ _DirName $(_t) ] ; |
| 1669 |
#Echo " _t = '" $(_t) "'" ; |
| 1670 |
_d = $(_t:D) ; |
| 1671 |
#Echo " _d = '" $(_d) "'" ; |
| 1672 |
_ds = [ _SepPath $(_d) ] ; |
| 1673 |
#Echo " _ds = '" $(_ds) "'" ; |
| 1674 |
_t = $(_t:D=) ; |
| 1675 |
#Echo " _t = '" $(_t) "'" ; |
| 1676 |
_t = $(_t:G=$(_ds:J=!)) ; |
| 1677 |
#Echo " _t = '" $(_t) "'" ; |
| 1678 |
|
| 1679 |
# dst trumps all the others |
| 1680 |
if $(3) = "dst" { |
| 1681 |
if $($(_t)-target) != "dst" { |
| 1682 |
NOMLOC on $(_t) = $(_d) ; |
| 1683 |
if $(_dst) { |
| 1684 |
if ! $(_ds) { |
| 1685 |
_ds = $(DOT) ; |
| 1686 |
} |
| 1687 |
_d = [ _DirName [ _RootPath $(_ds) : $(_dst) ] ] ; |
| 1688 |
} |
| 1689 |
if $(_d) = "/" || $(_d) = "\\" { # Jam has a bug when locating in root |
| 1690 |
_d = $(_d). ; |
| 1691 |
} |
| 1692 |
LOCATE on $(_t) = $(_d) ; |
| 1693 |
$(_t)-target = "dst" ; |
| 1694 |
} |
| 1695 |
|
| 1696 |
# idst trumps src and isrc |
| 1697 |
} else if $(3) = "idst" { |
| 1698 |
if $($(_t)-target) != "dst" && $($(_t)-target) != "idst" { |
| 1699 |
NOMLOC on $(_t) = $(_d) ; |
| 1700 |
if $(_d) = "/" || $(_d) = "\\" { # Jam has a bug when locating in root |
| 1701 |
_d = $(_d). ; |
| 1702 |
} |
| 1703 |
LOCATE on $(_t) = $(_d) ; |
| 1704 |
$(_t)-target = "idst" ; |
| 1705 |
} |
| 1706 |
|
| 1707 |
# src trumps isrc |
| 1708 |
} else if $(3) = "src" { |
| 1709 |
if $($(_t)-target) != "dst" && $($(_t)-target) != "idst" |
| 1710 |
&& $($(_t)-target) != "src" { |
| 1711 |
local _d1 _d2 ; |
| 1712 |
NOMLOC on $(_t) = $(_d) ; |
| 1713 |
if $(_src) { |
| 1714 |
_d1 = [ _DirName [ _RootPath $(_src) : $(_ds) ] ] ; |
| 1715 |
} else { |
| 1716 |
_d1 = $(_d) ; |
| 1717 |
} |
| 1718 |
if $(_dst) { |
| 1719 |
if ! $(_ds) { |
| 1720 |
_ds = $(DOT) ; |
| 1721 |
} |
| 1722 |
_d2 = [ _DirName [ _RootPath $(_ds) : $(_dst) ] ] ; |
| 1723 |
} |
| 1724 |
if $(_d1) = "/" || $(_d1) = "\\" { # Jam has a bug when locating in root |
| 1725 |
_d1 = $(_d1). ; |
| 1726 |
} |
| 1727 |
if $(_d2) = "/" || $(_d2) = "\\" { # Jam has a bug when locating in root |
| 1728 |
_d2 = $(_d2). ; |
| 1729 |
} |
| 1730 |
# We assume that if we've got a DSTDIR here, then |
| 1731 |
# it may apply to this source, even if it is never |
| 1732 |
# gets labelled this way. - ie. it may be a dst of a |
| 1733 |
# Jamfile with the same DSTDIR that's not in scope. |
| 1734 |
SEARCH on $(_t) = $(_d2) $(_d1) ; |
| 1735 |
$(_t)-target = "src" ; |
| 1736 |
} |
| 1737 |
|
| 1738 |
# isrc is lowest priority |
| 1739 |
} else if $(3) = "isrc" && ! $($(_t)-target) { |
| 1740 |
if $(_d) = "/" || $(_d) = "\\" { # Jam has a bug when locating in root |
| 1741 |
_d = $(_d). ; |
| 1742 |
} |
| 1743 |
NOMLOC on $(_t) = $(_d) ; |
| 1744 |
SEARCH on $(_t) = $(_d) ; |
| 1745 |
$(_t)-target = "isrc" ; |
| 1746 |
} |
| 1747 |
|
| 1748 |
#Echo "On '" $(_t) "' set LOCATE = '" [ geton $(_t) : LOCATE ] "' SEARCH = '" [ geton $(_t) : SEARCH ] "' NOMLOC = '" [ geton $(_t) : NOMLOC ] "'" ; |
| 1749 |
_out += $(_t) ; |
| 1750 |
} |
| 1751 |
|
| 1752 |
#Echo "_NormTargets returns to '" $(_out) "'" ; |
| 1753 |
return $(_out) ; |
| 1754 |
} |
| 1755 |
|
| 1756 |
# Given a set of normalized paths, return the Target ID's for |
| 1757 |
# them (ie. Gristed version of path) |
| 1758 |
# IDs = _TargetIDs targpaths ; |
| 1759 |
rule _TargetIDs |
| 1760 |
{ |
| 1761 |
local _i _t _d _ds ; |
| 1762 |
local _out = ; |
| 1763 |
|
| 1764 |
#Echo "_TargetIDs got '" $(<) "'" ; |
| 1765 |
for _i in $(<) |
| 1766 |
{ |
| 1767 |
_d = $(_i:D) ; |
| 1768 |
_ds = [ _SepPath $(_d) ] ; |
| 1769 |
_t = $(_i:D=) ; |
| 1770 |
_t = $(_t:G=$(_ds:J=!)) ; |
| 1771 |
_out += $(_t) ; |
| 1772 |
} |
| 1773 |
|
| 1774 |
#Echo "_TargetIDs returning '" $(_out) "'" ; |
| 1775 |
return $(_out) ; |
| 1776 |
} |
| 1777 |
|
| 1778 |
|
| 1779 |
# Copy the target related "on" variables from one |
| 1780 |
# target to another. |
| 1781 |
#rule CopyTarget dest : source ; |
| 1782 |
rule CopyTarget |
| 1783 |
{ |
| 1784 |
NOMLOC on $(<) = [ geton $(>) : NOMLOC ] ; |
| 1785 |
LOCATE on $(<) = [ geton $(>) : LOCATE ] ; |
| 1786 |
SEARCH on $(<) = [ geton $(>) : SEARCH ] ; |
| 1787 |
} |
| 1788 |
|
| 1789 |
# Make sure a non-target isn't LOCATED or SEARCH'd by |
| 1790 |
# setting LOCATE, SEARCH and NOMLOC to "" |
| 1791 |
#rule NotTargets vars ; |
| 1792 |
rule NotTargets |
| 1793 |
{ |
| 1794 |
NOMLOC on $(<) = "" ; |
| 1795 |
LOCATE on $(<) = "" ; |
| 1796 |
SEARCH on $(<) = "" ; |
| 1797 |
} |
| 1798 |
|
| 1799 |
# Create a destination target by locating |
| 1800 |
# the given files in the given directory. |
| 1801 |
# The dir is assumed to be normalized. |
| 1802 |
# SRCDIR and DSTDIR are ignored. |
| 1803 |
# targs = SetTargetsLoc targs : dir ; |
| 1804 |
rule CreateIDstTargets |
| 1805 |
{ |
| 1806 |
local _o ; |
| 1807 |
#Echo "CreateIDstTargets got '" $(<) "' and '" $(>) "'" ; |
| 1808 |
_o = [ NormIDstTargets $(<:BS) : $(>[1]) ] ; |
| 1809 |
#Echo "CreateIDstTargets returning '" $(_o) "'" ; |
| 1810 |
return $(_o) ; |
| 1811 |
} |
| 1812 |
|
| 1813 |
# Given a normalized target, return the |
| 1814 |
# orgiginal path to it. |
| 1815 |
# (We use NOMLOC to do this.) |
| 1816 |
# path = DeNormTargs target ; |
| 1817 |
rule DeNormTargs |
| 1818 |
{ |
| 1819 |
local _i _t _p _out = ; |
| 1820 |
|
| 1821 |
for _i in $(<) { |
| 1822 |
_p = [ geton $(_i) : NOMLOC ] ; |
| 1823 |
_t = $(_i:G=) ; |
| 1824 |
_out += $(_t:D=$(_p)) ; |
| 1825 |
} |
| 1826 |
|
| 1827 |
return $(_out) ; |
| 1828 |
} |
| 1829 |
|
| 1830 |
# Given a list of directories and a list of files, |
| 1831 |
# simply concatenate them in combination separated by a / |
| 1832 |
# paths1/paths = CatPaths path1 : paths ; |
| 1833 |
rule CatPaths |
| 1834 |
{ |
| 1835 |
return $(<)$(SLASH)$(>) ; |
| 1836 |
} |
| 1837 |
|
| 1838 |
# Try and locate a given file pattern starting from the current |
| 1839 |
# directory and working towards the root. |
| 1840 |
# We use a heuristic to figure out when to stop, since |
| 1841 |
# Jam doesn't have pwd :-( |
| 1842 |
# found = FindRoot starting_dir : file ; |
| 1843 |
rule FindToRoot |
| 1844 |
{ |
| 1845 |
local dir = $(<[1]) ; |
| 1846 |
local dir_list, prev_list = ; |
| 1847 |
local dir_list; |
| 1848 |
local found = ; |
| 1849 |
|
| 1850 |
#Echo "FindToRoot got starting_dir '" $(<) "' file '" $(>) "'" ; |
| 1851 |
found = [ GLOB $(dir) : $(>[1]) ] ; |
| 1852 |
|
| 1853 |
if $(found) { |
| 1854 |
return $(found) ; |
| 1855 |
} |
| 1856 |
|
| 1857 |
#Echo "dir_list = " $(dir_list) ; |
| 1858 |
|
| 1859 |
dir_list = [ GLOB $(dir) : * ] ; |
| 1860 |
while $(dir_list:D="") != $(prev_list:D="") { |
| 1861 |
dir = $(dir)$(SLASH)$(DOTDOT) ; |
| 1862 |
#Echo "dir = " $(dir) ; |
| 1863 |
found = [ GLOB $(dir) : $(>[1]) ] ; |
| 1864 |
|
| 1865 |
if $(found) { |
| 1866 |
return $(found) ; |
| 1867 |
} |
| 1868 |
|
| 1869 |
prev_list = $(dir_list) ; |
| 1870 |
dir_list = [ GLOB $(dir) : * ] ; |
| 1871 |
#Echo "dir_list = " $(dir_list) ; |
| 1872 |
} |
| 1873 |
#Echo "returning " $(found) ; |
| 1874 |
return $(found) ; |
| 1875 |
} |
| 1876 |
|
| 1877 |
# ----------------------------------------- |
| 1878 |
|
| 1879 |
rule DoInit |
| 1880 |
{ |
| 1881 |
if ! $(DONEANCHORINIT) { |
| 1882 |
|
| 1883 |
SUBDIR ?= $(DOT) ; |
| 1884 |
_SUBDIR ?= $(DOT) ; |
| 1885 |
|
| 1886 |
# initial "parent" settings |
| 1887 |
P_ASFLAGS = ; |
| 1888 |
P_CCFLAGS = ; |
| 1889 |
P_C++FLAGS = ; |
| 1890 |
P_LINKFLAGS = ; |
| 1891 |
P_SHLINKFLAGS = ; |
| 1892 |
P_HDRS = ; |
| 1893 |
P_DEFINES = ; |
| 1894 |
|
| 1895 |
P_PREF_ASFLAGS = ; |
| 1896 |
P_PREF_CCFLAGS = ; |
| 1897 |
P_PREF_C++FLAGS = ; |
| 1898 |
P_PREF_LINKFLAGS = ; |
| 1899 |
P_PREF_SHLINKFLAGS = ; |
| 1900 |
|
| 1901 |
FindTop ; # Look for a default project file |
| 1902 |
|
| 1903 |
TRACESTDHDRS = false ; # don't trace system path #include file dependenicies |
| 1904 |
DONEANCHORINIT = true ; |
| 1905 |
} |
| 1906 |
} |
| 1907 |
|
| 1908 |
# Set the project top for this Jamfile and all sub Jamfiles |
| 1909 |
# until another top is set or we return. |
| 1910 |
# ProjTop d1 d2 .. ; |
| 1911 |
rule ProjTop |
| 1912 |
{ |
| 1913 |
#Echo "ProjTop got '" $(<) "'" ; |
| 1914 |
|
| 1915 |
_TOP = [ _RatPath $(<) ] ; |
| 1916 |
TOP = [ _DirName $(_TOP) ] ; |
| 1917 |
|
| 1918 |
#Echo "ProjTop set TOP to '" $(TOP) "'" ; |
| 1919 |
|
| 1920 |
if ! $($(TOP)-SET) { # Not tried to read the project file |
| 1921 |
|
| 1922 |
local found = [ GLOB $(_top) : $(JAMFILE) ] ; |
| 1923 |
|
| 1924 |
if $(found) { |
| 1925 |
local save__SUBDIR = $(_SUBDIR) ; |
| 1926 |
local save__INVSUBDIR = $(_INVSUBDIR) ; |
| 1927 |
local save_SUBDIR = $(SUBDIR) ; |
| 1928 |
|
| 1929 |
_SUBDIR = $(_TOP) ; |
| 1930 |
_INVSUBDIR = [ _InvertPath $(_SUBDIR) ] ; |
| 1931 |
SUBDIR = [ _DirName $(_SUBDIR) ] ; |
| 1932 |
#Echo "_SUBDIR = '" $(_SUBDIR) "'" ; |
| 1933 |
#Echo "_INVSUBDIR = '" $(_INVSUBDIR) "'" ; |
| 1934 |
|
| 1935 |
# Translate SRCDIR for new SUBDIR |
| 1936 |
if $(SRCDIR) { |
| 1937 |
#Echo "SRCDIR olddir '" $(SRCDIR) "'" ; |
| 1938 |
SRCDIR = [ _SepPath $(SRCDIR) ] ; |
| 1939 |
SRCDIR = [ _RootPath $(_INVSUBDIR) : [ _RootPath $(SRCDIR) : $(_SUBDIR) ] ] ; |
| 1940 |
SRCDIR = [ _DirName [ _RatPath $(SRCDIR) ] ] ; |
| 1941 |
#Echo "SRCDIR newdir '" $(SRCDIR) "'" ; |
| 1942 |
} |
| 1943 |
|
| 1944 |
#Echo "About to include Jamtop '" $(found) "'" ; |
| 1945 |
include $(found) ; |
| 1946 |
|
| 1947 |
# Un Translate SRCDIR, in case it was set in the rules directory |
| 1948 |
if $(SRCDIR) { |
| 1949 |
#Echo "_SUBDIR = '" $(_SUBDIR) "'" ; |
| 1950 |
#Echo "_INVSUBDIR = '" $(_INVSUBDIR) "'" ; |
| 1951 |
#Echo "SRCDIR newdir '" $(SRCDIR) "'" ; |
| 1952 |
SRCDIR = [ _SepPath $(SRCDIR) ] ; |
| 1953 |
SRCDIR = [ _RootPath $(_SUBDIR) : [ _RootPath $(SRCDIR) : $(_INVSUBDIR) ] ] ; |
| 1954 |
SRCDIR = [ _DirName [ _RatPath $(SRCDIR) ] ] ; |
| 1955 |
#Echo "SRCDIR olddir '" $(SRCDIR) "'" ; |
| 1956 |
} |
| 1957 |
|
| 1958 |
# Restore things |
| 1959 |
_SUBDIR = $(save__SUBDIR) ; |
| 1960 |
_INVSUBDIR = $(save__INVSUBDIR) ; |
| 1961 |
SUBDIR = $(save_SUBDIR) ; |
| 1962 |
} else { |
| 1963 |
Echo "WARNING :- no project " $(TOP) "Jamtop found" ; |
| 1964 |
} |
| 1965 |
|
| 1966 |
$(TOP)-SET = true ; |
| 1967 |
} |
| 1968 |
} |
| 1969 |
|
| 1970 |
# Search for the project top by looking for the Jamtop |
| 1971 |
# starting at $(SUBDIR) and lookup upwards. |
| 1972 |
# FindTop ; |
| 1973 |
rule FindTop |
| 1974 |
{ |
| 1975 |
#Echo ; |
| 1976 |
#Echo "FindTop called SUBDIR = '" $(SUBDIR) "'" ; |
| 1977 |
|
| 1978 |
local _JRF = [ FindToRoot $(SUBDIR) : $(JAMTOP) ] ; |
| 1979 |
|
| 1980 |
#Echo "FindTop found '" $(_JRF) "'" ; |
| 1981 |
if $(_JRF) { |
| 1982 |
|
| 1983 |
_TOP = [ _RatPath [ _SepPath $(_JRF:D) ] ] ; |
| 1984 |
TOP = [ _DirName $(_TOP) ] ; |
| 1985 |
#Echo "ProjTop set TOP to '" $(TOP) "'" ; |
| 1986 |
|
| 1987 |
if ! $($(TOP)-SET) { # Not tried to read the project file |
| 1988 |
local save__SUBDIR = $(_SUBDIR) ; |
| 1989 |
local save__INVSUBDIR = $(_INVSUBDIR) ; |
| 1990 |
local save_SUBDIR = $(SUBDIR) ; |
| 1991 |
|
| 1992 |
_SUBDIR = $(_TOP) ; |
| 1993 |
_INVSUBDIR = [ _InvertPath $(_SUBDIR) ] ; |
| 1994 |
SUBDIR = [ _DirName $(_SUBDIR) ] ; |
| 1995 |
#Echo "_SUBDIR = '" $(_SUBDIR) "'" ; |
| 1996 |
#Echo "_INVSUBDIR = '" $(_INVSUBDIR) "'" ; |
| 1997 |
|
| 1998 |
# Translate SRCDIR for new SUBDIR |
| 1999 |
if $(SRCDIR) { |
| 2000 |
#Echo "SRCDIR olddir '" $(SRCDIR) "'" ; |
| 2001 |
SRCDIR = [ _SepPath $(SRCDIR) ] ; |
| 2002 |
SRCDIR = [ _RootPath $(_INVSUBDIR) : [ _RootPath $(SRCDIR) : $(_SUBDIR) ] ] ; |
| 2003 |
SRCDIR = [ _DirName [ _RatPath $(SRCDIR) ] ] ; |
| 2004 |
#Echo "SRCDIR newdir '" $(SRCDIR) "'" ; |
| 2005 |
} |
| 2006 |
|
| 2007 |
#Echo "About to include Jamtop '" $(_JRF) "'" ; |
| 2008 |
include $(_JRF) ; |
| 2009 |
$(TOP)-SET = true ; |
| 2010 |
|
| 2011 |
# Un Translate SRCDIR, in case it was set in the ruls directory |
| 2012 |
if $(SRCDIR) { |
| 2013 |
#Echo "_SUBDIR = '" $(_SUBDIR) "'" ; |
| 2014 |
#Echo "_INVSUBDIR = '" $(_INVSUBDIR) "'" ; |
| 2015 |
#Echo "SRCDIR newdir '" $(SRCDIR) "'" ; |
| 2016 |
SRCDIR = [ _SepPath $(SRCDIR) ] ; |
| 2017 |
SRCDIR = [ _RootPath $(_SUBDIR) : [ _RootPath $(SRCDIR) : $(_INVSUBDIR) ] ] ; |
| 2018 |
SRCDIR = [ _DirName [ _RatPath $(SRCDIR) ] ] ; |
| 2019 |
#Echo "SRCDIR olddir '" $(SRCDIR) "'" ; |
| 2020 |
} |
| 2021 |
|
| 2022 |
# Restore things |
| 2023 |
_SUBDIR = $(save__SUBDIR) ; |
| 2024 |
_INVSUBDIR = $(save__INVSUBDIR) ; |
| 2025 |
SUBDIR = $(save_SUBDIR) ; |
| 2026 |
} |
| 2027 |
} else { |
| 2028 |
Echo "WARNING :- no project Jamtop found, no TOP set !" ; |
| 2029 |
|
| 2030 |
if ! $(TOP) { |
| 2031 |
TOP = $(DOT) ; # set a default TOP |
| 2032 |
_TOP = $(DOT) ; |
| 2033 |
} |
| 2034 |
} |
| 2035 |
} |
| 2036 |
|
| 2037 |
# Given a path relative to CWD, return the inverse direction |
| 2038 |
# path. Return nothing if the path is absolute. |
| 2039 |
# [ we're using a hack here, since Jam 2.5 doesn't have |
| 2040 |
# any functions that will simply resolve a path relative |
| 2041 |
# to CWD into an absolute path. ] |
| 2042 |
# d1 d2 .. = _InvertPath d1 d2 .. |
| 2043 |
rule _InvertPath |
| 2044 |
{ |
| 2045 |
local _i _o _d ; |
| 2046 |
#Echo "_InvertPath got '" $(<) "'" ; |
| 2047 |
if $(<[1]) = "/" || $(<[1]) = "\\" { |
| 2048 |
#Echo "_InvertPath returning nothing" ; |
| 2049 |
return "" ; |
| 2050 |
} |
| 2051 |
if $(NT) { |
| 2052 |
switch $(<[1]) { |
| 2053 |
case *:* : { |
| 2054 |
#Echo "_InvertPath returning nothing" ; |
| 2055 |
return "" ; |
| 2056 |
} |
| 2057 |
} |
| 2058 |
} |
| 2059 |
|
| 2060 |
for _i in $(<) { |
| 2061 |
#Echo "_InvertPath _i = '" $(_i) "' _o = '" $(_o) "'" ; |
| 2062 |
# Ignore . |
| 2063 |
if $(_i) = $(DOT) { |
| 2064 |
continue ; |
| 2065 |
} |
| 2066 |
# The hard one. Look amongst all the |
| 2067 |
# sub directories for one that has the same |
| 2068 |
# contents as the directory we came from. |
| 2069 |
# Too bad if two directories have the same contents... |
| 2070 |
if $(_i) = $(DOTDOT) { |
| 2071 |
local _j; |
| 2072 |
local _d1 _d2 _l1, _l2 _l3 ; |
| 2073 |
|
| 2074 |
#Echo "_InvertPath inverting '" $(_i) "'" ; |
| 2075 |
|
| 2076 |
_d1 = [ _DirName $(_d) ] ; |
| 2077 |
_l1 = [ GLOB $(_d1) : * ] ; |
| 2078 |
#Echo "_d1 = '" $(_d1) "'" ; |
| 2079 |
_d += $(_i) ; |
| 2080 |
_d2 = [ _DirName $(_d) ] ; |
| 2081 |
#Echo "_d2 = '" $(_d2) "'" ; |
| 2082 |
_l2 = [ GLOB $(_d2) : * ] ; |
| 2083 |
|
| 2084 |
for _j in $(_l2) { |
| 2085 |
if $(_j) = $(DOT) || $(_j) = $(DOTDOT) { |
| 2086 |
continue ; |
| 2087 |
} |
| 2088 |
#Echo "Checking _j = '" $(_j) "'" ; |
| 2089 |
_l3 = [ GLOB $(_j) : * ] ; |
| 2090 |
#Echo "_l1 = '" $(_l1) "'" ; |
| 2091 |
#Echo "_l3 = '" $(_l3:BS) "'" ; |
| 2092 |
if $(_l3:BS) = $(_l1) { |
| 2093 |
#Echo "Found reverse = '" $(_j) "'" ; |
| 2094 |
_o = $(_j:BS) $(_o) ; |
| 2095 |
break ; |
| 2096 |
} |
| 2097 |
} |
| 2098 |
|
| 2099 |
# The easy one. the opposite of a directory |
| 2100 |
# is .. |
| 2101 |
} else { |
| 2102 |
_o = $(DOTDOT) $(_o) ; |
| 2103 |
_d += $(_i) ; |
| 2104 |
} |
| 2105 |
} |
| 2106 |
if ! $(_o) { |
| 2107 |
_o = $(DOT) ; |
| 2108 |
} |
| 2109 |
|
| 2110 |
#Echo "_InvertPath returning '" $(_o) "'" ; |
| 2111 |
return $(_o) ; |
| 2112 |
} |
| 2113 |
|
| 2114 |
# Variables containing (possible) relative paths that are to remain |
| 2115 |
# anchored to where they were declared. This is to prevent |
| 2116 |
# NormPath in a sub-Jamfile assuming they are relative to that Jamfile. |
| 2117 |
# (This is a bit messy. How could it be avoided ? If there were |
| 2118 |
# a simple way of making paths absolute, rather than computing eveything |
| 2119 |
# relative to the invokation directory, it could help.) |
| 2120 |
ANCHORED_PATH_VARS = ; |
| 2121 |
|
| 2122 |
# Variables to save before starting a new Jamfile, then |
| 2123 |
# restore once it's finished. |
| 2124 |
|
| 2125 |
SUBDIR_VARS = SUBDIR _SUBDIR TOP _TOP SRCDIR DSTDIR |
| 2126 |
P_ASFLAGS P_CCFLAGS P_C++FLAGS P_LINKFLAGS P_SHLINKFLAGS |
| 2127 |
ASFLAGS CCFLAGS C++FLAGS LINKFLAGS SHLINKFLAGS |
| 2128 |
P_PREF_ASFLAGS P_PREF_CCFLAGS P_PREF_C++FLAGS P_PREF_LINKFLAGS |
| 2129 |
PREF_ASFLAGS PREF_CCFLAGS PREF_C++FLAGS PREF_LINKFLAGS PREF_SHLINKFLAGS |
| 2130 |
P_HDRS HDRS |
| 2131 |
P_DEFINES DEFINES |
| 2132 |
P_LINKOBJS LINKOBJS |
| 2133 |
P_LINKLIBS LINKLIBS |
| 2134 |
P_LINKSHLIBS LINKSHLIBS |
| 2135 |
P_SHLINKOBJS SHLINKOBJS |
| 2136 |
P_SHLINKLIBS SHLINKLIBS |
| 2137 |
P_SHLINKSHLIBS SHLINKSHLIBS |
| 2138 |
; |
| 2139 |
|
| 2140 |
# Implement including a Jamfile from a sub or peer directory, |
| 2141 |
# Sub includes cause flags/headers/options to be inhereted |
| 2142 |
# from the calling Jamfile, while Peer includes do not. |
| 2143 |
# The global _JAMINCLUDE_PEER variable controls whether |
| 2144 |
# this is a sub or peer include. |
| 2145 |
# _JamInclude dir ; |
| 2146 |
rule _JamInclude |
| 2147 |
{ |
| 2148 |
#Echo "_JamInclude called with '" $(<) "' SUBDIR '" $(SUBDIR) "' and _JAMINCLUDE_PEER '" $(_JAMINCLUDE_PEER) "'" ; |
| 2149 |
|
| 2150 |
# Save certain variables so that sub-Jamfiles don't affect them |
| 2151 |
local _jamfile ; |
| 2152 |
local _SUBDIR_VARS = $(SUBDIR_VARS) $(ANCHORED_PATH_VARS) ; |
| 2153 |
local _i parent_$(_SUBDIR_VARS) ; |
| 2154 |
|
| 2155 |
for _i in $(_SUBDIR_VARS) { |
| 2156 |
parent_$(_i) = $($(_i)) ; |
| 2157 |
} |
| 2158 |
|
| 2159 |
if $(_JAMINCLUDE_PEER) != "true" { |
| 2160 |
# Incorporate this levels extra flags & header paths into the base |
| 2161 |
P_ASFLAGS += $(ASFLAGS) ; ASFLAGS = "" ; |
| 2162 |
P_CCFLAGS += $(CCFLAGS) ; CCFLAGS = "" ; |
| 2163 |
P_C++FLAGS += $(C++FLAGS) ; C++FLAGS = "" ; |
| 2164 |
P_LINKFLAGS += $(LINKFLAGS) ; LINKFLAGS = "" ; |
| 2165 |
P_SHLINKFLAGS += $(SHLINKFLAGS) ; SHLINKFLAGS = "" ; |
| 2166 |
P_HDRS = [ NormPaths $(HDRS) ] $(P_HDRS) ; HDRS = "" ; |
| 2167 |
P_DEFINES += $(DEFINES) ; DEFINES = "" ; |
| 2168 |
P_LINKOBJS = [ NormPaths $(LINKOBJS) ] $(P_LINKOBJS) ; LINKOBJS = "" ; |
| 2169 |
P_LINKLIBS = [ NormPaths $(LINKLIBS) ] $(P_LINKLIBS) ; LINKLIBS = "" ; |
| 2170 |
P_LINKSHLIBS = [ NormPaths $(LINKSHLIBS) ] $(P_LINKSHLIBS) ; LINKSHLIBS = "" ; |
| 2171 |
P_SHLINKOBJS = [ NormPaths $(SHLINKOBJS) ] $(P_SHLINKOBJS) ; SHLINKOBJS = "" ; |
| 2172 |
P_SHLINKLIBS = [ NormPaths $(SHLINKLIBS) ] $(P_SHLINKLIBS) ; SHLINKLIBS = "" ; |
| 2173 |
P_SHLINKSHLIBS = [ NormPaths $(SHLINKSHLIBS) ] $(P_SHLINKSHLIBS) ; SHLINKSHLIBS = "" ; |
| 2174 |
|
| 2175 |
# Set parent flags no existing parent flags |
| 2176 |
if ! $(P_PREF_ASFLAGS) { |
| 2177 |
P_PREF_ASFLAGS = $(PREF_ASFLAGS) ; } |
| 2178 |
if ! $(P_PREF_CCFLAGS) { |
| 2179 |
P_PREF_CCFLAGS = $(PREF_CCFLAGS) ; } |
| 2180 |
if ! $(P_PREF_C++FLAGS) { |
| 2181 |
P_PREF_C++FLAGS = $(PREF_C++FLAGS) ; } |
| 2182 |
if ! $(P_PREF_LINKFLAGS) { |
| 2183 |
P_PREF_LINKFLAGS = $(PREF_LINKFLAGS) ; } |
| 2184 |
if ! $(P_PREF_SHLINKFLAGS) { |
| 2185 |
P_PREF_SHLINKFLAGS = $(PREF_SHLINKFLAGS) ; } |
| 2186 |
} |
| 2187 |
|
| 2188 |
# Set default for new Jamfile extra and preferred flags |
| 2189 |
ASFLAGS = ; |
| 2190 |
CCFLAGS = ; |
| 2191 |
C++FLAGS = ; |
| 2192 |
LINKFLAGS = ; |
| 2193 |
SHLINKFLAGS = ; |
| 2194 |
HDRS = ; |
| 2195 |
DEFINES = ; |
| 2196 |
LINKOBJS = ; |
| 2197 |
LINKLIBS = ; |
| 2198 |
LINKSHLIBS = ; |
| 2199 |
SHLINKOBJS = ; |
| 2200 |
SHLINKLIBS = ; |
| 2201 |
SHLINKSHLIBS = ; |
| 2202 |
|
| 2203 |
PREF_ASFLAGS = ; |
| 2204 |
PREF_CCFLAGS = ; |
| 2205 |
PREF_C++FLAGS = ; |
| 2206 |
PREF_LINKFLAGS = ; |
| 2207 |
PREF_SHLINKFLAGS = ; |
| 2208 |
|
| 2209 |
_SUBDIR = [ _RatPath [ _RootPath $(_SUBDIR) : [ _SepPath $(<) ] ] ] ; |
| 2210 |
_INVSUBDIR = [ _InvertPath $(_SUBDIR) ] ; |
| 2211 |
SUBDIR = [ _DirName $(_SUBDIR) ] ; |
| 2212 |
|
| 2213 |
#Echo "new _SUBDIR =" $(_SUBDIR) ; |
| 2214 |
#Echo "new _INVSUBDIR =" $(_INVSUBDIR) ; |
| 2215 |
|
| 2216 |
if $(_INVSUBDIR) != "." { |
| 2217 |
# Keep paths relative to where they were defined, so that |
| 2218 |
# NormPaths doesn't think they are relative to the sub-Jamfile. |
| 2219 |
#Echo "Before ANCHORED_PATH_VARS = $(ANCHORED_PATH_VARS) vals $($(ANCHORED_PATH_VARS))" ; |
| 2220 |
for _i in $(ANCHORED_PATH_VARS) { |
| 2221 |
$(_i) = [ RootPaths $(_INVSUBDIR) : $($(_i)) ] ; |
| 2222 |
} |
| 2223 |
#Echo "After ANCHORED_PATH_VARS = $(ANCHORED_PATH_VARS) vals $($(ANCHORED_PATH_VARS))" ; |
| 2224 |
} |
| 2225 |
|
| 2226 |
# Translate SRCDIR for new SUBDIR |
| 2227 |
#Echo "SRCDIR olddir '" $(SRCDIR) "'" ; |
| 2228 |
if $(SRCDIR) { |
| 2229 |
local subdir = $(_SUBDIR[2-]) ; |
| 2230 |
local invsubdir = [ FReverse $(_INVSUBDIR) ] ; |
| 2231 |
invsubdir = [ FReverse $(invsubdir[2-]) ] ; |
| 2232 |
#Echo "subdir-1 =" $(subdir) ; |
| 2233 |
#Echo "invsubdir-1 =" $(invsubdir) ; |
| 2234 |
SRCDIR = [ _SepPath $(SRCDIR) ] ; |
| 2235 |
SRCDIR = [ _RootPath $(invsubdir) : [ _RootPath $(SRCDIR) : $(subdir) ] ] ; |
| 2236 |
SRCDIR = [ _DirName [ _RatPath $(SRCDIR) ] ] ; |
| 2237 |
#Echo "SRCDIR newdir '" $(SRCDIR) "'" ; |
| 2238 |
} |
| 2239 |
|
| 2240 |
_jamfile = [ NormSrcPaths $(JAMFILE) ] ; |
| 2241 |
|
| 2242 |
#Echo "About to include " $(_jamfile) ; |
| 2243 |
include $(_jamfile) ; |
| 2244 |
|
| 2245 |
# Restore variable before returning |
| 2246 |
for _i in $(_SUBDIR_VARS) { |
| 2247 |
$(_i) = $(parent_$(_i)) ; |
| 2248 |
} |
| 2249 |
|
| 2250 |
#Echo "Done include " $(JAMFILE:D=$(_subdir)) ; |
| 2251 |
#Echo "restored SUBDIR =" $(SUBDIR) ; |
| 2252 |
#Echo "_JamInclude done" ; |
| 2253 |
} |
| 2254 |
|
| 2255 |
# Invoke a Jamfile as a sub Jamfile |
| 2256 |
# SubInclude dir ; |
| 2257 |
rule SubInclude |
| 2258 |
{ |
| 2259 |
#Echo "### SubInclude called with '" $(<[1]) "' and SUBDIR = '" $(SUBDIR) "'" ; |
| 2260 |
_JAMINCLUDE_PEER = "false" ; # This is a sub include |
| 2261 |
return [ _JamInclude $(<) ] ; |
| 2262 |
} |
| 2263 |
|
| 2264 |
# Invoke a Jamfile in as a peer Jamfile |
| 2265 |
# PeerInclude dir ; |
| 2266 |
rule PeerInclude |
| 2267 |
{ |
| 2268 |
#Echo "### PeerInclude called with '" $(<[1]) "' and SUBDIR = '" $(SUBDIR) "'" ; |
| 2269 |
_JAMINCLUDE_PEER = "true" ; # This is a peer include |
| 2270 |
return [ _JamInclude $(<) ] ; |
| 2271 |
} |
| 2272 |
|
| 2273 |
# =========================================================== |
| 2274 |
# |
| 2275 |
# Rules |
| 2276 |
# |
| 2277 |
|
| 2278 |
# Public As |
| 2279 |
# As obj : source.s ; .s -> .o |
| 2280 |
rule As |
| 2281 |
{ |
| 2282 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2283 |
local _t = [ NormDstTargets $(<[1]:S=$(SUFOBJ)) ] ; |
| 2284 |
local _s = [ NormSrcTargets $(>) ] ; |
| 2285 |
|
| 2286 |
Depends $(_t) : $(_s) ; |
| 2287 |
Depends obj : $(_t) ; |
| 2288 |
MakeLocate $(_t) ; |
| 2289 |
|
| 2290 |
HDRS on $(_t) = [ geton $(_t) : SEARCH ] [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 2291 |
} |
| 2292 |
|
| 2293 |
# Internal As |
| 2294 |
rule As_ |
| 2295 |
{ |
| 2296 |
local pref_asflags = $(P_PREF_ASFLAGS) ; |
| 2297 |
pref_asflags ?= $(PREF_ASFLAGS) ; |
| 2298 |
ASFLAGS1 on $(<) = $(P_ASFLAGS) $(ASFLAGS) ; |
| 2299 |
ASFLAGS2 on $(<) = $(pref_asflags) ; |
| 2300 |
ASFLAGS on $(<) = [ geton $(<) : ASFLAGS1 ] [ geton $(<) : ASFLAGS2 ] ; |
| 2301 |
ASHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ; |
| 2302 |
} |
| 2303 |
|
| 2304 |
# copies sources into directory. |
| 2305 |
# SRCDIR and DSTDIR will be ignored. |
| 2306 |
# Bulk directory : sources ; |
| 2307 |
rule Bulk |
| 2308 |
{ |
| 2309 |
#Echo "Bulk got '" $(<) "' and '" $(>) "'" ; |
| 2310 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 2311 |
local _s = [ NormSrcTargets $(>) ] ; # Sources |
| 2312 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 2313 |
local _is _it ; # individual source and target |
| 2314 |
|
| 2315 |
for _is in $(_s) |
| 2316 |
{ |
| 2317 |
_it = $(_t[1]) ; |
| 2318 |
_t = $(_t[2-]) ; # Track _is |
| 2319 |
|
| 2320 |
Depends files : $(_it) ; |
| 2321 |
Depends $(_it) : $(_is) ; |
| 2322 |
MakeLocate $(_it) ; |
| 2323 |
File_ $(_it) : $(_is) ; |
| 2324 |
MODE on $(_it) = $(FILEMODE) ; |
| 2325 |
Chmod_ $(_it) ; |
| 2326 |
} |
| 2327 |
} |
| 2328 |
|
| 2329 |
# Cc object : source : flags : defines : hdrpaths ; |
| 2330 |
rule Cc |
| 2331 |
{ |
| 2332 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2333 |
local _t = [ NormDstTargets $(<[1]:S=$(SUFOBJ)) ] ; |
| 2334 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 2335 |
|
| 2336 |
Depends $(_t) : $(_s) ; |
| 2337 |
Depends obj : $(_t) ; |
| 2338 |
Clean clean : $(_t) ; |
| 2339 |
MakeLocate $(_t) ; |
| 2340 |
|
| 2341 |
HDRS on $(_t) = [ geton $(_t) : SEARCH ] [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 2342 |
SOURCE on $(_t) = $(_s) ; |
| 2343 |
|
| 2344 |
HDRRULE on $(_s) = HdrRule ; |
| 2345 |
HDRSCAN on $(_s) = $(HDRPATTERN) ; |
| 2346 |
# Construct HDRSEARCH so that we can know where to look for headers |
| 2347 |
local _dot = [ geton $(_>) : NOMLOC ] ; |
| 2348 |
if ! $(_dot) { _dot = $(DOT) ; } |
| 2349 |
HDRSEARCH1 on $(_s) = $(_dot) ; |
| 2350 |
HDRSEARCH2 on $(_s) = [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 2351 |
HDRSEARCH3 on $(_s) = [ NormPaths $(STDHDRS) ] ; |
| 2352 |
HDRSEARCH on $(_s) = [ geton $(_s) : HDRSEARCH1 ] [ geton $(_s) : HDRSEARCH2 ] |
| 2353 |
[ geton $(_s) : HDRSEARCH3 ] ; |
| 2354 |
#Echo "Cc set HDRSEARCH on '" $(_s) "' to '" [ geton $(_s) : HDRSEARCH ] "'" ; |
| 2355 |
|
| 2356 |
# propagate target specific-defines |
| 2357 |
|
| 2358 |
DEFINES on $(_t) = $(P_DEFINES) $(DEFINES) ; |
| 2359 |
|
| 2360 |
Cc_ $(_t) : $(_s) : $(3) ; |
| 2361 |
|
| 2362 |
if $(3) { |
| 2363 |
ObjectCcFlags $(<) : $(3) ; |
| 2364 |
} |
| 2365 |
if $(4) { |
| 2366 |
ObjectDefines $(<) : $(4) ; |
| 2367 |
} |
| 2368 |
if $(5) { |
| 2369 |
ObjectHdrs $(<) : $(5) ; |
| 2370 |
} |
| 2371 |
} |
| 2372 |
|
| 2373 |
# Internal Cc |
| 2374 |
# Cc_ object : sources ; |
| 2375 |
rule Cc_ |
| 2376 |
{ |
| 2377 |
# If the compiler's -o flag doesn't work, relocate the .o |
| 2378 |
if $(RELOCATE) |
| 2379 |
{ |
| 2380 |
CcMv $(<) : $(>) ; |
| 2381 |
} |
| 2382 |
|
| 2383 |
local pref_ccflags = $(P_PREF_CCFLAGS) ; |
| 2384 |
pref_ccflags ?= $(PREF_CCFLAGS) ; |
| 2385 |
# Make sure we incorporate any CCFLAGS[12] on object into total |
| 2386 |
CCFLAGS1 on $(<) += $(P_CCFLAGS) $(CCFLAGS) ; |
| 2387 |
CCFLAGS2 on $(<) += $(pref_ccflags) ; |
| 2388 |
CCFLAGS on $(<) = [ geton $(<) : CCFLAGS1 ] [ geton $(<) : CCFLAGS2 ] ; |
| 2389 |
|
| 2390 |
#Echo "Cc object '" $(<) "' got CCFLAGS1 '" [ geton $(<) : CCFLAGS1 ] "' and CCFLAGS2 '" [ geton $(<) : CCFLAGS2 ] "' for total CCFLAGS '" [ geton $(<) : CCFLAGS ] "'" ; |
| 2391 |
|
| 2392 |
# Make sure the CCHDRS and CCDEFS are formatter correctly |
| 2393 |
CCHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ; |
| 2394 |
CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ; |
| 2395 |
} |
| 2396 |
|
| 2397 |
# C++ object : source : flags : defines : hdrpaths ; |
| 2398 |
rule C++ |
| 2399 |
{ |
| 2400 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2401 |
local _t = [ NormDstTargets $(<[1]:S=$(SUFOBJ)) ] ; |
| 2402 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 2403 |
|
| 2404 |
Depends $(_t) : $(_s) ; |
| 2405 |
Depends obj : $(_t) ; |
| 2406 |
Clean clean : $(_t) ; |
| 2407 |
MakeLocate $(_t) ; |
| 2408 |
|
| 2409 |
HDRS on $(_t) = [ geton $(_t) : SEARCH ] [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 2410 |
SOURCE on $(_t) = $(_s) ; |
| 2411 |
|
| 2412 |
HDRRULE on $(_s) = HdrRule ; |
| 2413 |
HDRSCAN on $(_s) = $(HDRPATTERN) ; |
| 2414 |
# Construct HDRSEARCH so that we can know where to look for headers |
| 2415 |
local _dot = [ geton $(_>) : NOMLOC ] ; |
| 2416 |
if ! $(_dot) { _dot = $(DOT) ; } |
| 2417 |
HDRSEARCH1 on $(_s) = $(_dot) ; |
| 2418 |
HDRSEARCH2 on $(_s) = [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 2419 |
HDRSEARCH3 on $(_s) = [ NormPaths $(STDHDRS) ] ; |
| 2420 |
HDRSEARCH on $(_s) = [ geton $(_s) : HDRSEARCH1 ] [ geton $(_s) : HDRSEARCH2 ] |
| 2421 |
[ geton $(_s) : HDRSEARCH3 ] ; |
| 2422 |
|
| 2423 |
# propagate target specific-defines |
| 2424 |
|
| 2425 |
DEFINES on $(_t) = $(P_DEFINES) $(DEFINES) ; |
| 2426 |
|
| 2427 |
C++_ $(_t) : $(_s) ; |
| 2428 |
|
| 2429 |
if $(3) { |
| 2430 |
ObjectC++Flags $(<) : $(3) ; |
| 2431 |
} |
| 2432 |
if $(4) { |
| 2433 |
ObjectDefines $(<) : $(4) ; |
| 2434 |
} |
| 2435 |
if $(5) { |
| 2436 |
ObjectHdrs $(<) : $(5) ; |
| 2437 |
} |
| 2438 |
} |
| 2439 |
|
| 2440 |
# Internal C++ |
| 2441 |
# C++_ object : sources ; |
| 2442 |
rule C++_ |
| 2443 |
{ |
| 2444 |
# If the compiler's -o flag doesn't work, relocate the .o |
| 2445 |
if $(RELOCATE) |
| 2446 |
{ |
| 2447 |
CcMv $(<) : $(>) ; |
| 2448 |
} |
| 2449 |
|
| 2450 |
local pref_c++flags = $(P_PREF_C++FLAGS) ; |
| 2451 |
pref_c++flags ?= $(PREF_C++FLAGS) ; |
| 2452 |
# Make sure we incorporate any C++FLAGS[12] on object into total |
| 2453 |
C++FLAGS1 on $(<) += $(P_C++FLAGS) $(C++FLAGS) ; |
| 2454 |
C++FLAGS2 on $(<) += $(pref_c++flags) ; |
| 2455 |
C++FLAGS on $(<) = [ geton $(<) : C++FLAGS1 ] [ geton $(<) : C++FLAGS2 ] ; |
| 2456 |
|
| 2457 |
# Make sure the CCHDRS and CCDEFS are formatter correctly |
| 2458 |
CCHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ; |
| 2459 |
CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ; |
| 2460 |
} |
| 2461 |
|
| 2462 |
rule Chmod_ |
| 2463 |
{ |
| 2464 |
#Echo "Chmod_ on '" $(<) "' with MODE = '" [ geton $(<) : MODE ] "'" ; |
| 2465 |
if $(CHMOD) { Chmod1 $(<) ; } |
| 2466 |
} |
| 2467 |
|
| 2468 |
# Public use Depends that does normalisation of its targets |
| 2469 |
# (non-normalizing Depends is a built in) |
| 2470 |
# NDepends dest : source ; make dependency |
| 2471 |
rule NDepends { |
| 2472 |
local _t _s ; |
| 2473 |
local _p = ; |
| 2474 |
|
| 2475 |
#Echo "NDepends got '" $(<) "' and '" $(>) "'" ; |
| 2476 |
|
| 2477 |
# Don't anchor psuedo targets |
| 2478 |
switch $(<) |
| 2479 |
{ |
| 2480 |
case all : _p = true ; |
| 2481 |
case first : _p = true ; |
| 2482 |
case shell : _p = true ; |
| 2483 |
case files : _p = true ; |
| 2484 |
case lib : _p = true ; |
| 2485 |
case exe : _p = true ; |
| 2486 |
case obj : _p = true ; |
| 2487 |
case dirs : _p = true ; |
| 2488 |
case clean : _p = true ; |
| 2489 |
case install : _p = true ; |
| 2490 |
case uninstall : _p = true ; |
| 2491 |
} |
| 2492 |
|
| 2493 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2494 |
if ! $(_p) { |
| 2495 |
_t = [ NormDstTargets $(<) ] ; |
| 2496 |
} else { |
| 2497 |
_t = $(<) ; |
| 2498 |
} |
| 2499 |
_s = [ NormSrcTargets $(>) ] ; |
| 2500 |
|
| 2501 |
#Echo "Passing Depends '" $(_t) "' and '" $(_s) "'" ; |
| 2502 |
|
| 2503 |
Depends $(_t) : $(_s) ; |
| 2504 |
} |
| 2505 |
|
| 2506 |
# Public use NoUpdate that does normalisation of its targets |
| 2507 |
# (non-normalizing NoUpdate is a built in) |
| 2508 |
# NNoUpdate dest ; Make sure created, but don't update |
| 2509 |
rule NNoUpdate { |
| 2510 |
local _t ; |
| 2511 |
local _p = ; |
| 2512 |
|
| 2513 |
#Echo "NNoUpdate got '" $(<) "'" ; |
| 2514 |
|
| 2515 |
# Don't anchor psuedo targets |
| 2516 |
switch $(<) |
| 2517 |
{ |
| 2518 |
case all : _p = true ; |
| 2519 |
case first : _p = true ; |
| 2520 |
case shell : _p = true ; |
| 2521 |
case files : _p = true ; |
| 2522 |
case lib : _p = true ; |
| 2523 |
case exe : _p = true ; |
| 2524 |
case obj : _p = true ; |
| 2525 |
case dirs : _p = true ; |
| 2526 |
case clean : _p = true ; |
| 2527 |
case install : _p = true ; |
| 2528 |
case uninstall : _p = true ; |
| 2529 |
} |
| 2530 |
|
| 2531 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2532 |
if ! $(_p) { |
| 2533 |
_t = [ NormDstTargets $(<) ] ; |
| 2534 |
} else { |
| 2535 |
_t = $(<) ; |
| 2536 |
} |
| 2537 |
_s = [ NormSrcTargets $(>) ] ; |
| 2538 |
|
| 2539 |
#Echo "Passing NoUpdate '" $(_t) "'" ; |
| 2540 |
|
| 2541 |
NoUpdate $(_t) ; |
| 2542 |
} |
| 2543 |
|
| 2544 |
# Public use Includes that does normalisation of its targets |
| 2545 |
# (non-normalizing Includes is a built in) |
| 2546 |
# NDepends dest : source ; make dependency |
| 2547 |
rule NIncludes { |
| 2548 |
local _t _s ; |
| 2549 |
local _p = ; |
| 2550 |
|
| 2551 |
#Echo "NIncludes got '" $(<) "' and '" $(>) "'" ; |
| 2552 |
|
| 2553 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2554 |
_t = [ NormDstTargets $(<) ] ; |
| 2555 |
_s = [ NormSrcTargets $(>) ] ; |
| 2556 |
|
| 2557 |
#Echo "Passing Includes '" $(_t) "' and '" $(_s) "'" ; |
| 2558 |
|
| 2559 |
Includes $(_t) : $(_s) ; |
| 2560 |
} |
| 2561 |
|
| 2562 |
# sets mode of file |
| 2563 |
# Mod target : mode ; |
| 2564 |
rule Mod |
| 2565 |
{ |
| 2566 |
local _t = [ NormIDstTargets $(<[1]) ] ; |
| 2567 |
MODE on $(_t) = $(>) ; |
| 2568 |
Chmod_ $(_t) ; |
| 2569 |
} |
| 2570 |
|
| 2571 |
# copies source onto target. |
| 2572 |
# SRCDIR and DSTDIR will be ignored. |
| 2573 |
# File target : source ; |
| 2574 |
rule File |
| 2575 |
{ |
| 2576 |
local _t = [ NormIDstTargets $(<[1]) ] ; |
| 2577 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 2578 |
|
| 2579 |
Depends files : $(_t) ; |
| 2580 |
Depends $(_t) : $(_s) ; |
| 2581 |
Clean clean : $(_t) ; |
| 2582 |
MakeLocate $(_t) ; |
| 2583 |
File_ $(_t) : $(_s) ; |
| 2584 |
MODE on $(_t) = $(FILEMODE) ; |
| 2585 |
Chmod_ $(_t) ; |
| 2586 |
} |
| 2587 |
|
| 2588 |
# copies source onto target, but doesn't clean source. |
| 2589 |
# SRCDIR and DSTDIR will be ignored. |
| 2590 |
# File target : source ; |
| 2591 |
rule FileNoClean |
| 2592 |
{ |
| 2593 |
local _t = [ NormIDstTargets $(<[1]) ] ; |
| 2594 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 2595 |
|
| 2596 |
Depends files : $(_t) ; |
| 2597 |
Depends $(_t) : $(_s) ; |
| 2598 |
MakeLocate $(_t) ; |
| 2599 |
File_ $(_t) : $(_s) ; |
| 2600 |
MODE on $(_t) = $(FILEMODE) ; |
| 2601 |
Chmod_ $(_t) ; |
| 2602 |
} |
| 2603 |
|
| 2604 |
# Fake file copy. Creates a dependence to work around |
| 2605 |
# problem that Jam doesn't understand two products from one action. |
| 2606 |
# FakeFile target : source ; |
| 2607 |
rule FakeFile |
| 2608 |
{ |
| 2609 |
local _t = [ NormIDstTargets $(<[1]) ] ; |
| 2610 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 2611 |
|
| 2612 |
FakeFile_ $(_t) : $(_s) ; |
| 2613 |
} |
| 2614 |
|
| 2615 |
rule FakeFile_ |
| 2616 |
{ |
| 2617 |
local _t = $(<) ; |
| 2618 |
local _s = $(>) ; |
| 2619 |
|
| 2620 |
Depends files : $(_t) ; |
| 2621 |
Depends $(_t) : $(_s) ; |
| 2622 |
Clean clean : $(_t) ; |
| 2623 |
MakeLocate $(_t) ; |
| 2624 |
} |
| 2625 |
|
| 2626 |
|
| 2627 |
# Compile Fortran source file into object |
| 2628 |
# Fortran object : source ; |
| 2629 |
rule Fortran |
| 2630 |
{ |
| 2631 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2632 |
local _t = [ NormDstTargets $(<[1]:S=$(SUFOBJ)) ] ; |
| 2633 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 2634 |
|
| 2635 |
Depends $(_t) : $(_s) ; |
| 2636 |
Depends obj : $(_t) ; |
| 2637 |
Clean clean : $(_t) ; |
| 2638 |
MakeLocate $(_t) ; |
| 2639 |
|
| 2640 |
Fortran_ $(_t) : $(_s) ; |
| 2641 |
} |
| 2642 |
|
| 2643 |
# Internal Fortran |
| 2644 |
rule Fortran_ |
| 2645 |
{ |
| 2646 |
} |
| 2647 |
|
| 2648 |
|
| 2649 |
# NOTE! Perhaps GenFileND and GenFileNND could be replaced by a GenFile |
| 2650 |
# with a $(3) for the dependecies ? |
| 2651 |
|
| 2652 |
# All > are assumed to be files that < is dependent on |
| 2653 |
# with >[1] being an executable |
| 2654 |
# SRCDIR and DSTDIR are ignored. |
| 2655 |
rule GenFile |
| 2656 |
{ |
| 2657 |
#Echo "GenFile got '" $(<) "' and '" $(>) "'" ; |
| 2658 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2659 |
local _t = [ NormIDstTargets $(<) ] ; |
| 2660 |
local _s = [ NormISrcTargets $(>[1]:S=$(SUFEXE)) ] ; |
| 2661 |
local _a = [ NormISrcTargets $(>[2-]) ] ; |
| 2662 |
|
| 2663 |
#Echo "GenFile normed '" $(_t) "' and '" $(_s) "' plus '" $(_a) "'" ; |
| 2664 |
|
| 2665 |
Depends $(_t) : $(_s) $(_a) ; |
| 2666 |
if ! $(_s[1]:G) { # In case PATH doesn't have . in it. |
| 2667 |
_s = $(DOT)$(SLASH)$(_s[1]:G=) $(_s[2-]) ; |
| 2668 |
NotTargets $(_s) ; |
| 2669 |
NoCare $(_s) ; |
| 2670 |
NotFile $(_s) ; |
| 2671 |
} |
| 2672 |
GenFile1 $(_t) : $(_s) $(_a) ; |
| 2673 |
Clean clean : $(_t) ; |
| 2674 |
} |
| 2675 |
|
| 2676 |
rule GenFile1 |
| 2677 |
{ |
| 2678 |
MakeLocate $(<) ; |
| 2679 |
} |
| 2680 |
|
| 2681 |
# Only >[1] is assumed to be an executable that < is dependent on. |
| 2682 |
# $(3) are optional extra dependecies |
| 2683 |
# SRCDIR and DSTDIR are ignored. |
| 2684 |
rule GenFileND |
| 2685 |
{ |
| 2686 |
#Echo "GenFileND got '$(<)' and '$(>)' and src targets '$(_d)'" ; |
| 2687 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2688 |
local _t = [ NormIDstTargets $(<[1]) ] ; |
| 2689 |
local _s = [ NormISrcTargets $(>[1]:S=$(SUFEXE)) ] ; |
| 2690 |
local _a = $(>[2-]) ; |
| 2691 |
_a = $(_a:J=" ") ; |
| 2692 |
local _d = [ NormSrcTargets $(3) ] ; |
| 2693 |
|
| 2694 |
#Echo "GenFileND normed '$(_t)' and '$(_s)' plus '$(_a)' and src targets '$(_d)'" ; |
| 2695 |
|
| 2696 |
NotTargets $(_a) ; |
| 2697 |
NoCare $(_a) ; |
| 2698 |
NotFile $(_a) ; # Supresses "independent target", but may mark a directory wrongly |
| 2699 |
Depends $(_t) : $(_s) $(_d) ; |
| 2700 |
#Echo "GenFileND set Depends '$(_t)' and '$(_s)' and '$(_d)'" ; |
| 2701 |
|
| 2702 |
if ! $(_s[1]:G) { # In case PATH doesn't have . in it. |
| 2703 |
_s = $(DOT)$(SLASH)$(_s[1]) $(_s[2-]) ; |
| 2704 |
NotTargets $(_s) ; |
| 2705 |
NoCare $(_s) ; |
| 2706 |
NotFile $(_s) ; |
| 2707 |
} |
| 2708 |
GenFileND1 $(_t) : $(_s) $(_a) ; |
| 2709 |
|
| 2710 |
Clean clean : $(_t) ; |
| 2711 |
} |
| 2712 |
|
| 2713 |
rule GenFileND1 |
| 2714 |
{ |
| 2715 |
MakeLocate $(<) ; |
| 2716 |
} |
| 2717 |
|
| 2718 |
# GenFileNND target : program args : extra_dependecies ; |
| 2719 |
# None of > is assumed to be a file. |
| 2720 |
# $(3) are optional extra dependecies |
| 2721 |
# SRCDIR and DSTDIR are ignored. |
| 2722 |
rule GenFileNND |
| 2723 |
{ |
| 2724 |
#Echo "GenFileNND got '$(<)' and '$(>)' and src targets '$(3)' " ; |
| 2725 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2726 |
local _t = [ NormIDstTargets $(<) ] ; |
| 2727 |
local _a = $(>) ; |
| 2728 |
_a = $(_a:J=" ") ; # Split up by space delimeter ? |
| 2729 |
local _d = [ NormSrcTargets $(3) ] ; |
| 2730 |
|
| 2731 |
#Echo "GenFileNND normed '$(_t)' plus '$(_a)' and src targets '$(_d)'" ; |
| 2732 |
|
| 2733 |
Depends files : $(_t) ; |
| 2734 |
Depends $(_t) : $(_d) ; |
| 2735 |
|
| 2736 |
NotTargets $(_a) ; |
| 2737 |
NoCare $(_a) ; |
| 2738 |
NotFile $(_a) ; # Supresses "independent target", but may mark a directory wrongly |
| 2739 |
|
| 2740 |
GenFileNND1 $(_t) : $(_a) ; |
| 2741 |
Clean clean : $(_t) ; |
| 2742 |
} |
| 2743 |
|
| 2744 |
rule GenFileNND1 |
| 2745 |
{ |
| 2746 |
#Echo "GenFileNND1 got "' $(<) "' and "' $(>) "'" ; |
| 2747 |
MakeLocate $(<) ; |
| 2748 |
} |
| 2749 |
|
| 2750 |
# GenFileNNDnc target : program args : extra_dependecies ; |
| 2751 |
# Same as GenFileNND but don't clean the target. |
| 2752 |
# None of > is assumed to be a file. |
| 2753 |
# $(3) are optional extra dependecies |
| 2754 |
# SRCDIR and DSTDIR are ignored. |
| 2755 |
rule GenFileNNDnc |
| 2756 |
{ |
| 2757 |
#Echo "GenFileNNDnc got '$(<)' and '$(>)' and src targets '$(3)' " ; |
| 2758 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2759 |
local _t = [ NormIDstTargets $(<) ] ; |
| 2760 |
local _a = $(>) ; |
| 2761 |
_a = $(_a:J=" ") ; # Split up by space delimeter ? |
| 2762 |
local _d = [ NormSrcTargets $(3) ] ; |
| 2763 |
|
| 2764 |
#Echo "GenFileNNDnc normed '$(_t)' plus '$(_a)' and src targets '$(_d)'" ; |
| 2765 |
|
| 2766 |
Depends files : $(_t) ; |
| 2767 |
Depends $(_t) : $(_d) ; |
| 2768 |
|
| 2769 |
NotTargets $(_a) ; |
| 2770 |
NoCare $(_a) ; |
| 2771 |
NotFile $(_a) ; # Supresses "independent target", but may mark a directory wrongly |
| 2772 |
|
| 2773 |
GenFileNND1 $(_t) : $(_a) ; |
| 2774 |
} |
| 2775 |
|
| 2776 |
# Concatenate all the argument to the file |
| 2777 |
# Each argument to a separate line |
| 2778 |
# If no arguments, create empty file |
| 2779 |
# SRCDIR and DSTDIR are ignored. |
| 2780 |
rule CatToFile |
| 2781 |
{ |
| 2782 |
#Echo "CatToFile got '" $(<) "' and '" $(>) "'" ; |
| 2783 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 2784 |
local _t = [ NormIDstTargets $(<) ] ; |
| 2785 |
|
| 2786 |
MakeLocate $(_t) ; |
| 2787 |
Depends files : $(_t) ; |
| 2788 |
NotFile $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) ; |
| 2789 |
|
| 2790 |
Clean clean : $(_t) ; |
| 2791 |
|
| 2792 |
if ! $(>) { |
| 2793 |
CreateCatFile_ $(_t) ; |
| 2794 |
|
| 2795 |
} else { |
| 2796 |
if $(2) { |
| 2797 |
CatToFile_ $(_t) : $(2) ; |
| 2798 |
} |
| 2799 |
if $(3) { |
| 2800 |
CatToFile_ $(_t) : $(3) ; |
| 2801 |
} |
| 2802 |
if $(4) { |
| 2803 |
CatToFile_ $(_t) : $(4) ; |
| 2804 |
} |
| 2805 |
if $(5) { |
| 2806 |
CatToFile_ $(_t) : $(5) ; |
| 2807 |
} |
| 2808 |
if $(6) { |
| 2809 |
CatToFile_ $(_t) : $(6) ; |
| 2810 |
} |
| 2811 |
if $(7) { |
| 2812 |
CatToFile_ $(_t) : $(7) ; |
| 2813 |
} |
| 2814 |
if $(8) { |
| 2815 |
CatToFile_ $(_t) : $(8) ; |
| 2816 |
} |
| 2817 |
if $(9) { |
| 2818 |
CatToFile_ $(_t) : $(9) ; |
| 2819 |
} |
| 2820 |
} |
| 2821 |
} |
| 2822 |
|
| 2823 |
rule HardLink |
| 2824 |
{ |
| 2825 |
local _t = [ NormDstTargets $(<) ] ; |
| 2826 |
local _s = [ NormSrcTargets $(>) ] ; |
| 2827 |
|
| 2828 |
Depends files : $(_t) ; |
| 2829 |
Depends $(_t) : $(_s) ; |
| 2830 |
|
| 2831 |
HardLink_ $(_t) : $(_s) ; |
| 2832 |
} |
| 2833 |
|
| 2834 |
# Mark executable as GUI applications (ie. OS X Bundle) |
| 2835 |
# GuiImages images ; |
| 2836 |
rule GuiBin |
| 2837 |
{ |
| 2838 |
local _t = [ NormDstTargets $(<:S=$(SUFEXE)) ] ; |
| 2839 |
GUIAPP on $(_t) = "true" ; |
| 2840 |
} |
| 2841 |
|
| 2842 |
# Mark MSWindows executable as needing UAC |
| 2843 |
# GuiImages images ; |
| 2844 |
rule UACBin |
| 2845 |
{ |
| 2846 |
local _t = [ NormDstTargets $(<:S=$(SUFEXE)) ] ; |
| 2847 |
WIN_UAC on $(_t) = "true" ; |
| 2848 |
} |
| 2849 |
|
| 2850 |
rule GUIAPP |
| 2851 |
{ |
| 2852 |
} |
| 2853 |
|
| 2854 |
# /HdrMacroFile |
| 2855 |
# |
| 2856 |
# this rule is specific to FT-Jam. It is used to indicate that a given file |
| 2857 |
# contains definitions for filename macros (e.g. "#define MYFILE_H <myfile>.h") |
| 2858 |
# that can later be used in #include statements in the rest of the source |
| 2859 |
# |
| 2860 |
# these files must be parsed before any make is tried. |
| 2861 |
# |
| 2862 |
rule HdrMacroFile |
| 2863 |
{ |
| 2864 |
HDRMACRO $(<) ; |
| 2865 |
} |
| 2866 |
|
| 2867 |
# Handle #includes that are found. |
| 2868 |
# Try and locate them to asociate them with declared targets, as |
| 2869 |
# well as tracing any further #includes they may have. |
| 2870 |
# HdrRule NormedSource : headers ; |
| 2871 |
rule HdrRule |
| 2872 |
{ |
| 2873 |
# N.B. This rule is called during binding, potentially after |
| 2874 |
# the fate of many targets has been determined, and must be |
| 2875 |
# used with caution: don't add dependencies to unrelated |
| 2876 |
# targets, and don't set variables on $(<). |
| 2877 |
|
| 2878 |
#Echo "HdrRule got '" $(<) "' and '" $(>) "'" ; |
| 2879 |
|
| 2880 |
local _d = [ geton $(<) : NOMLOC ] ; # Directory location of source file |
| 2881 |
local _schpath = [ geton $(<) : HDRSEARCH ] ; # Search path used to find these |
| 2882 |
local _s _ts ; # include source targets, sources to trace |
| 2883 |
|
| 2884 |
#Echo "HDRSEARCH on '" $(<) "' is = '" $(_schpath) "'" ; |
| 2885 |
|
| 2886 |
# See if we can locate the header amongst the generated files. |
| 2887 |
#Echo "Checking for matches of known targets" ; |
| 2888 |
local _i _j _k _ss _sp _n ; |
| 2889 |
local _stdhdrs = [ NormPaths $(STDHDRS) ] ; |
| 2890 |
_st = ; |
| 2891 |
for _j in $(>) { |
| 2892 |
_sp = ; # Search path |
| 2893 |
_ss = ; # Resolved source target |
| 2894 |
#Echo "Checking include '" $(_j) "'" ; |
| 2895 |
for _k in $(_schpath) "__unknown__" { # search path and plain |
| 2896 |
_n = [ NormPaths $(_j) : $(_k) ] ; # Normalized path for that search path |
| 2897 |
_i = [ _TargetIDs $(_n) ] ; # Target ID/name if it exitsts |
| 2898 |
#Echo "Checking target ID '" $(_i)-target "' value '" $($(_i)-target) "'" ; |
| 2899 |
if $($(_i)-target) { # Target exists |
| 2900 |
_ss = $(_i) ; |
| 2901 |
_s += $(_ss) ; |
| 2902 |
#Echo "Found existing target '" $(_ss) "'" ; |
| 2903 |
break ; |
| 2904 |
} else if ! $($(_i)-target) { # unknown state |
| 2905 |
#Echo "Unknown statis target '" $(_i) "'" ; |
| 2906 |
_sp += [ NormPaths $(_j:D) : $(_k) ] ; # paths to search |
| 2907 |
} |
| 2908 |
} |
| 2909 |
if ! $(_ss) && $(_sp) { # We've not seen that target |
| 2910 |
local _found = ; |
| 2911 |
#Echo "Searching for '" $(_j) "' in paths '" $(_sp) "'" ; |
| 2912 |
# See if we can find the header |
| 2913 |
_found = [ GLOB $(_sp) : $(_j:BS) ] ; |
| 2914 |
|
| 2915 |
# Hmm. This sort of works around Windows problem of std include files being upper case. |
| 2916 |
# It won't solve the problem of tracing them if TRACESTDHDRS is true though. |
| 2917 |
if $(NT) && ! $(_found) { |
| 2918 |
_found = [ GLOB $(_sp) : $(_j:UBS) ] ; |
| 2919 |
_found = $(_found:D)\\$(_found:LBS) ; |
| 2920 |
} |
| 2921 |
if $(_found) { |
| 2922 |
_ss = [ NormSrcTargets $(_found[1]) ] ; # Add it to our list |
| 2923 |
#Echo "Using new found target '" $(_ss) "'" ; |
| 2924 |
_s += $(_ss) ; |
| 2925 |
} |
| 2926 |
# Mark off not found targets |
| 2927 |
for _k in $(_schpath) { |
| 2928 |
_n = [ NormPaths $(_j) : $(_k) ] ; # Normalized path for that search path |
| 2929 |
_i = [ _TargetIDs $(_n) ] ; # Target ID/name if it exitsts |
| 2930 |
if $(_i) = $(_ss) { |
| 2931 |
break ; # The one we found |
| 2932 |
} |
| 2933 |
#Echo "marking off '" $(_i) "' as non-existant" ; |
| 2934 |
$(_i)-target = "false" ; # That combination doesn't exist |
| 2935 |
} |
| 2936 |
if ! $(_found) { |
| 2937 |
_k = "__unknown__" ; |
| 2938 |
_ss = [ NormSrcTargets $(_j) : $(_k) ] ; |
| 2939 |
# ~~99 This would make good warning information ? |
| 2940 |
#Echo "Include unresolved: '" $(_ss) "'" ; |
| 2941 |
_s += $(_ss) ; # Use plain header name as target ID |
| 2942 |
} |
| 2943 |
} |
| 2944 |
# We're left with $(_ss_) being the target and $(_k) being the search path |
| 2945 |
|
| 2946 |
# Add this to our list that will also be scanned for #includes |
| 2947 |
#Echo "Dealt with'" $(_j) "', _ss = '" $(_ss) "' and _k = '" $(_k) "'" ; |
| 2948 |
if ( ! $(_k) in "__unknown__" ) |
| 2949 |
&& ( $(TRACESTDHDRS) = true || ! $(_k) in $(_stdhdrs) ) { |
| 2950 |
_st += $(_ss) ; |
| 2951 |
} |
| 2952 |
} |
| 2953 |
|
| 2954 |
#Echo "Normalized includes = '" $(_s) "'" ; |
| 2955 |
#Echo "Includes to be traced = '" $(_st) "'" ; |
| 2956 |
|
| 2957 |
# Propagate on $(<) to $(>) |
| 2958 |
# Compute header search path for any #includes in these #includes |
| 2959 |
|
| 2960 |
if $(_st) { |
| 2961 |
HDRSEARCH2 on $(_st) = [ geton $(<) : HDRSEARCH2 ] ; |
| 2962 |
HDRSEARCH3 on $(_st) = [ geton $(<) : HDRSEARCH3 ] ; |
| 2963 |
for _i in $(_st) { |
| 2964 |
# Replace file dot/HDRSEARCH1 with one for this file |
| 2965 |
local _dot = [ geton $(_i) : NOMLOC ] ; |
| 2966 |
if ! $(_dot) { _dot = $(DOT) ; } |
| 2967 |
HDRSEARCH1 on $(_i) = $(_dot) ; |
| 2968 |
HDRSEARCH on $(_i) = [ geton $(_i) : HDRSEARCH1 ] [ geton $(_i) : HDRSEARCH2 ] |
| 2969 |
[ geton $(_i) : HDRSEARCH3 ] ; |
| 2970 |
} |
| 2971 |
HDRSCAN on $(_st) = [ geton $(<) : HDRSCAN ] ; |
| 2972 |
HDRRULE on $(_st) = [ geton $(<) : HDRRULE ] ; |
| 2973 |
HDRGRIST on $(_st) = [ geton $(<) : HDRGRIST ] ; |
| 2974 |
#Echo "HdrRule SEARCH on '" $(_st) "' set to '" [ geton $(_st) : SEARCH ] "'" ; |
| 2975 |
#Echo "HdrRule HDRSEARCH on '" $(_st) "' set to '" [ geton $(_st) : HDRSEARCH ] "'" ; |
| 2976 |
#Echo "HdrRule HDRSCAN on '" $(_st) "' set to '" [ geton $(_st) : HDRSCAN ] "'" ; |
| 2977 |
#Echo "HdrRule HDRRULE on '" $(_st) "' set to '" [ geton $(_st) : HDRRULE ] "'" ; |
| 2978 |
} |
| 2979 |
|
| 2980 |
# Tell Jam that anything depending on $(<) also depends on $(>), |
| 2981 |
# set SEARCH so Jam can find the headers, but then say we don't |
| 2982 |
# care if we can't actually find the headers (they may have been |
| 2983 |
# within ifdefs), |
| 2984 |
|
| 2985 |
NoCare $(_s) ; |
| 2986 |
SEARCH on $(_s) = $(_schpath) ; # Use search path used to find these #includes as Jam SEARCH path. |
| 2987 |
Includes $(<) : $(_s) ; |
| 2988 |
} |
| 2989 |
|
| 2990 |
# Public InstallInto |
| 2991 |
# InstallInto dir : sources ; install any files |
| 2992 |
rule InstallInto |
| 2993 |
{ |
| 2994 |
#Echo "InstallInto got '" $(<) "' and '" $(>) "'" ; |
| 2995 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 2996 |
local _s = [ NormSrcTargets $(>) ] ; # Sources |
| 2997 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 2998 |
_InstallInto $(_t) : $(_s) ; |
| 2999 |
} |
| 3000 |
|
| 3001 |
# Private InstallInto |
| 3002 |
# Note that the install rules ignore SRDDIR and DSTDIR. |
| 3003 |
# InstallInto destinations : sources ; install any files |
| 3004 |
rule _InstallInto |
| 3005 |
{ |
| 3006 |
#Echo "_InstallInto got '" $(<) "' and '" $(>) "'" ; |
| 3007 |
|
| 3008 |
local _t = $(<) ; # targets |
| 3009 |
local _s = $(>) ; # sources |
| 3010 |
local _is _it ; # individual source and target |
| 3011 |
|
| 3012 |
# Arrange for jam install |
| 3013 |
# Arrange for jam uninstall |
| 3014 |
# targets are in dir |
| 3015 |
|
| 3016 |
Depends install : $(_t) ; |
| 3017 |
Clean uninstall : $(_t) ; |
| 3018 |
MakeLocate $(_t) ; # create directories |
| 3019 |
|
| 3020 |
# For each source, Install, Chmod, Chown, and Chgrp |
| 3021 |
|
| 3022 |
for _is in $(_s) |
| 3023 |
{ |
| 3024 |
_it = $(_t[1]) ; |
| 3025 |
_t = $(_t[2-]) ; # Track _is |
| 3026 |
|
| 3027 |
#Echo "_InstallInto installing target '" $(_it) "' from src '" $(_is) "'" ; |
| 3028 |
Depends $(_it) : $(_is) ; |
| 3029 |
Install $(_it) : $(_is) ; |
| 3030 |
Chmod_ $(_it) ; |
| 3031 |
|
| 3032 |
if $(OWNER) && $(CHOWN) |
| 3033 |
{ |
| 3034 |
Chown_ $(_it) ; |
| 3035 |
OWNER on $(_it) = $(OWNER) ; |
| 3036 |
} |
| 3037 |
|
| 3038 |
if $(GROUP) && $(CHGRP) |
| 3039 |
{ |
| 3040 |
Chgrp_ $(_it) ; |
| 3041 |
GROUP on $(_it) = $(GROUP) ; |
| 3042 |
} |
| 3043 |
} |
| 3044 |
} |
| 3045 |
|
| 3046 |
# InstallBin dir : sources ; install binaries |
| 3047 |
rule InstallBin |
| 3048 |
{ |
| 3049 |
#Echo "InstallBin got '" $(<) "' and '" $(>) "'" ; |
| 3050 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 3051 |
local _s = [ NormSrcTargets $(>:S=$(SUFEXE)) ] ; # Sources |
| 3052 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 3053 |
#Echo "InstallBin norm '" $(_d) "' and '" $(_s) "' and '" $(_t) "'" ; |
| 3054 |
MODE on $(_t) = $(EXEMODE) ; |
| 3055 |
_InstallInto $(_t) : $(_s) ; |
| 3056 |
#Echo "InstallBin done " ; |
| 3057 |
} |
| 3058 |
|
| 3059 |
# InstallFile dir : sources ; install files |
| 3060 |
rule InstallFile |
| 3061 |
{ |
| 3062 |
#Echo "InstallFile got '" $(<) "' and '" $(>) "'" ; |
| 3063 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 3064 |
local _s = [ NormSrcTargets $(>) ] ; # Sources |
| 3065 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 3066 |
#Echo "InstallFile normed targ '" $(_t) "' src '" $(_s) "' and dir '" $(_d) "'" ; |
| 3067 |
MODE on $(_t) = $(FILEMODE) ; |
| 3068 |
_InstallInto $(_t) : $(_s) ; |
| 3069 |
} |
| 3070 |
|
| 3071 |
# InstallLib dir : sources ; install static library files |
| 3072 |
rule InstallLib |
| 3073 |
{ |
| 3074 |
#Echo "InstallLib got '" $(<) "' and '" $(>) "'" ; |
| 3075 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 3076 |
local _s = [ NormSrcTargets $(>:S=$(SUFLIB)) ] ; # Sources |
| 3077 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 3078 |
MODE on $(_t) = $(FILEMODE) ; |
| 3079 |
_InstallInto $(_t) : $(_s) ; |
| 3080 |
} |
| 3081 |
|
| 3082 |
# InstallShLib dir : sources ; install shared library files |
| 3083 |
rule InstallShLib |
| 3084 |
{ |
| 3085 |
#Echo "InstallShLib got '" $(<) "' and '" $(>) "'" ; |
| 3086 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 3087 |
local _s = [ NormSrcTargets $(>:S=$(SUFSHLIB)) ] ; # Sources |
| 3088 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 3089 |
MODE on $(_t) = $(FILEMODE) ; |
| 3090 |
_InstallInto $(_t) : $(_s) ; |
| 3091 |
} |
| 3092 |
|
| 3093 |
# InstallShell dir : sources ; install files |
| 3094 |
rule InstallShell |
| 3095 |
{ |
| 3096 |
#Echo "InstallShell got '" $(<) "' and '" $(>) "'" ; |
| 3097 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 3098 |
local _s = [ NormSrcTargets $(>) ] ; # Sources |
| 3099 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 3100 |
MODE on $(_t) = $(SHELLMODE) ; |
| 3101 |
_InstallInto $(_t) : $(_s) ; |
| 3102 |
} |
| 3103 |
|
| 3104 |
# InstallMan dir : sources ; install files |
| 3105 |
rule InstallMan |
| 3106 |
{ |
| 3107 |
#Echo "InstallMan got '" $(<) "' and '" $(>) "'" ; |
| 3108 |
local _d = [ NormPaths $(<) ] ; # Directory |
| 3109 |
local _s = [ NormSrcTargets $(>) ] ; # Sources |
| 3110 |
local _t = [ CreateIDstTargets $(_s) : $(_d) ] ; # Relocate targs to dir |
| 3111 |
|
| 3112 |
# Really this just strips the . from the suffix |
| 3113 |
|
| 3114 |
local _is _it _tt _s _id ; |
| 3115 |
|
| 3116 |
_tt = $(_t) ; |
| 3117 |
for _is in $(_s) |
| 3118 |
{ |
| 3119 |
_it = $(_tt[1]) ; |
| 3120 |
_tt = $(_tt[2-]) ; |
| 3121 |
|
| 3122 |
switch $(_is:S) |
| 3123 |
{ |
| 3124 |
case .1 : s = 1 ; case .2 : s = 2 ; case .3 : s = 3 ; |
| 3125 |
case .4 : s = 4 ; case .5 : s = 5 ; case .6 : s = 6 ; |
| 3126 |
case .7 : s = 7 ; case .8 : s = 8 ; case .l : s = l ; |
| 3127 |
case .n : s = n ; case .man : s = 1 ; |
| 3128 |
} |
| 3129 |
|
| 3130 |
_id = [ RootPaths $(_d) : man$(_s) ] ; |
| 3131 |
CreateIDstTargets $(_it) : $(_id) ; |
| 3132 |
MODE on $(_it) = $(FILEMODE) ; |
| 3133 |
_InstallInto $(_it) : $(_is) ; |
| 3134 |
} |
| 3135 |
} |
| 3136 |
|
| 3137 |
# Lex |
| 3138 |
# Lex source.c : source.l ; |
| 3139 |
rule Lex |
| 3140 |
{ |
| 3141 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3142 |
local _t = [ NormDstTargets $(<[1]) ] ; |
| 3143 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 3144 |
|
| 3145 |
Depends $(_t) : $(_s) ; |
| 3146 |
Clean clean : $(_t) ; |
| 3147 |
MakeLocate $(_t) ; |
| 3148 |
|
| 3149 |
Lex_ $(_t) : $(_s) ; |
| 3150 |
} |
| 3151 |
|
| 3152 |
# Internal Lex |
| 3153 |
rule Lex_ |
| 3154 |
{ |
| 3155 |
LexMv_ $(<) : $(>) ; |
| 3156 |
} |
| 3157 |
|
| 3158 |
# Library - create a static library from sources. |
| 3159 |
# Library library : sources : flags : defines : hdrpaths : objects ; |
| 3160 |
rule Library |
| 3161 |
{ |
| 3162 |
LibraryFromObjects $(<) : $(>) $(6) ; |
| 3163 |
Objects $(>) : $(3) : $(4) : $(5) ; |
| 3164 |
} |
| 3165 |
|
| 3166 |
# LibraryFromObjects - create a static library from object files. |
| 3167 |
# LibraryFromObjects library : objects ; |
| 3168 |
rule LibraryFromObjects |
| 3169 |
{ |
| 3170 |
local _i ; |
| 3171 |
|
| 3172 |
#Echo "LibraryFromObjects got " $(<) "and" $(>) "'" ; |
| 3173 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3174 |
local _l = [ NormDstTargets $(<[1]:S=$(SUFLIB)) ] ; |
| 3175 |
local _s = [ NormSrcTargets $(>:S=$(SUFOBJ)) ] ; |
| 3176 |
#Echo "LibraryFromObjects nomed = " $(_l) "and" $(_s) ; |
| 3177 |
|
| 3178 |
Depends lib : $(_l) ; |
| 3179 |
|
| 3180 |
MakeLocate $(_l) ; |
| 3181 |
|
| 3182 |
if $(NOARSCAN) |
| 3183 |
{ |
| 3184 |
# If we can't scan the library to timestamp its contents, |
| 3185 |
# we have to just make the library depend directly on the |
| 3186 |
# on-disk object files. |
| 3187 |
|
| 3188 |
Depends $(_l) : $(_s) ; |
| 3189 |
} |
| 3190 |
else |
| 3191 |
{ |
| 3192 |
# If we can scan the library, we make the library depend |
| 3193 |
# on its members and each member depend on the on-disk |
| 3194 |
# object file. |
| 3195 |
|
| 3196 |
for _i in $(_s) |
| 3197 |
{ |
| 3198 |
local _m ; |
| 3199 |
_m = $(_l:M=$(_i:BS)) ; |
| 3200 |
CopyTarget $(_m) : $(_l) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 3201 |
Depends $(_l) : $(_m) ; |
| 3202 |
Depends $(_m) : $(_i) ; |
| 3203 |
} |
| 3204 |
} |
| 3205 |
|
| 3206 |
Clean clean : $(_l) ; |
| 3207 |
|
| 3208 |
if $(CRELIB) { |
| 3209 |
CreLib $(_l) : $(_s[1]) ; |
| 3210 |
} |
| 3211 |
|
| 3212 |
Archive $(_l) : $(_s) ; |
| 3213 |
|
| 3214 |
if $(RANLIB) { |
| 3215 |
Ranlib $(_l) ; |
| 3216 |
} |
| 3217 |
|
| 3218 |
# If we can't scan the library, we have to leave the .o's around. |
| 3219 |
if ! ( $(NOARSCAN) || $(NOARUPDATE) ) { |
| 3220 |
local _ds ; |
| 3221 |
for _i in $(_s) { |
| 3222 |
# Don't delete any objects that we've marked with KEEPOBJS |
| 3223 |
if ! [ geton $(_i) : KEEPOBJS ] { |
| 3224 |
_ds += $(_i) ; |
| 3225 |
} |
| 3226 |
} |
| 3227 |
if $(_ds) { |
| 3228 |
RmTemps_ $(_l) : $(_ds) ; |
| 3229 |
} |
| 3230 |
} |
| 3231 |
} |
| 3232 |
|
| 3233 |
# LibraryFromLibraries - create a static library from object files and static libraries. |
| 3234 |
# LibraryFromLibraries library : libraries ; |
| 3235 |
rule LibraryFromLibraries |
| 3236 |
{ |
| 3237 |
local _i ; |
| 3238 |
|
| 3239 |
#Echo "LibraryFromLibraries got " $(<) "and" $(>) ; |
| 3240 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3241 |
local _l = [ NormDstTargets $(<[1]:S=$(SUFLIB)) ] ; |
| 3242 |
local _s = [ NormSrcTargets $(>:S=$(SUFLIB)) ] ; |
| 3243 |
#Echo "LibraryFromObjects nomed = " $(_l) "and" $(_s) ; |
| 3244 |
|
| 3245 |
Depends lib : $(_l) ; |
| 3246 |
Depends $(_l) : $(_s) ; |
| 3247 |
|
| 3248 |
MakeLocate $(_l) ; |
| 3249 |
|
| 3250 |
Clean clean : $(_l) ; |
| 3251 |
|
| 3252 |
if $(CRELIB) { |
| 3253 |
CreLib $(_l) : $(_s[1]) ; |
| 3254 |
} |
| 3255 |
|
| 3256 |
ArchiveArchive $(_l) : $(_s) ; |
| 3257 |
} |
| 3258 |
|
| 3259 |
# ShLibrary - create a shared library from sources. |
| 3260 |
# ShLibrary library : sources : flags : defines : hdrpaths : objects : libs : shlibs ; |
| 3261 |
rule ShLibrary |
| 3262 |
{ |
| 3263 |
ShLibraryFromObjects $(<) : $(>) $(6) : $(7) : $(8) ; |
| 3264 |
Objects $(>) : $(CCSHOBJFLAG) $(3) : $(4) : $(5) ; |
| 3265 |
} |
| 3266 |
|
| 3267 |
# ShLibraryFromObjects - create a shared library from object files. |
| 3268 |
# Both the import (if used on the system) and shared library will be created. |
| 3269 |
# ShLibraryFromObjects shlib : objects : libs : shlibs ; |
| 3270 |
rule ShLibraryFromObjects |
| 3271 |
{ |
| 3272 |
local _i _l ; |
| 3273 |
|
| 3274 |
#Echo "ShLibraryFromObjects got " $(<) "and" $(>) ; |
| 3275 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3276 |
local _sl = [ NormDstTargets $(<[1]:S=$(SUFSHLIB)) ] ; |
| 3277 |
if $(NT) { |
| 3278 |
_l = [ NormDstTargets $(<[1]:S=$(SUFIMPLIB)) ] ; |
| 3279 |
} |
| 3280 |
local _s = [ NormSrcTargets $(>:S=$(SUFOBJ)) ] ; |
| 3281 |
#Echo "ShLibraryFromObjects nomed =" $(_sl) "and" $(_l) "and" $(_s) ; |
| 3282 |
|
| 3283 |
Depends lib : $(_sl) ; |
| 3284 |
# Depends lib : $(_l) ; |
| 3285 |
MakeLocate $(_sl) ; |
| 3286 |
|
| 3287 |
Depends $(_sl) : $(_s) ; |
| 3288 |
Clean clean : $(_sl) $(_l) ; |
| 3289 |
|
| 3290 |
if $(_l) { |
| 3291 |
Depends $(_l) : $(_s) ; |
| 3292 |
Clean clean : $(_l:S=.exp) ; |
| 3293 |
} |
| 3294 |
|
| 3295 |
#Echo "ShLibraryFromObjects SHLINKFLAGS = '" $(SHLINKFLAGS) "' and P_SHLINKFLAGS ='" $(P_LSHINKFLAGS) "'" ; |
| 3296 |
|
| 3297 |
if $(SHLINKFLAGS) || $(P_SHLINKFLAGS) |
| 3298 |
|| $(PREF_SHLINKFLAGS) || $(P_PREF_SHLINKFLAGS) { |
| 3299 |
local pref_shlinkflags = $(P_PREF_SHLINKFLAGS) ; |
| 3300 |
pref_shlinkflags ?= $(PREF_SHLINKFLAGS) ; |
| 3301 |
SHLINKFLAGS on $(_sl) += $(P_SHLINKFLAGS) $(SHLINKFLAGS) $(pref_shlinkflags) ; |
| 3302 |
} |
| 3303 |
|
| 3304 |
#Echo "ShLibraryFromObjects SHLINKOBJS = '" $(SHLINKOBJS) "' and P_SHLINKOBJS ='" $(P_SHLINKOBJS) "'" ; |
| 3305 |
if $(SHLINKOBJS) || $(P_SHLINKOBJS) { |
| 3306 |
local _o = [ NormSrcTargets $(SHLINKOBJS:S=$(SUFOBJ)) ] $(P_SHLINKOBJS:S=$(SUFOBJ)) ; |
| 3307 |
Depends $(_sl) : $(_o) ; |
| 3308 |
SHLINKOBJS on $(_sl) += $(_o) ; |
| 3309 |
} |
| 3310 |
|
| 3311 |
#Echo "ShLibraryFromObjects SHLINKLIBS = '" $(SHLINKLIBS) "' and P_SHLINKLIBS ='" $(P_SHLINKLIBS) "'" ; |
| 3312 |
if $(SHLINKLIBS) || $(P_SHLINKLIBS) { |
| 3313 |
local _l = [ NormSrcTargets $(SHLINKLIBS:S=$(SUFLIB)) ] $(P_SHLINKLIBS:S=$(SUFLIB)) ; |
| 3314 |
Depends $(_sl) : $(_l) ; |
| 3315 |
SHLINKLIBS on $(_sl) += $(_l) ; |
| 3316 |
} |
| 3317 |
|
| 3318 |
#Echo "ShLibraryFromObjects SHLINKSHLIBS = '" $(SHLINKSHLIBS) "' and P_SHLINKSHLIBS ='" $(P_SHLINKSHLIBS) "'" ; |
| 3319 |
if $(SHLINKSHLIBS) || $(P_SHLINKSHLIBS) { |
| 3320 |
local _l = [ NormSrcTargets $(SHLINKSHLIBS:S=$(SUFSHLIB)) ] $(P_SHLINKSHLIBS:S=$(SUFSHLIB)) ; |
| 3321 |
Depends $(_sl) : $(_l) ; |
| 3322 |
SHLINKSHLIBS on $(_sl) += $(_l) ; |
| 3323 |
} |
| 3324 |
|
| 3325 |
if $(SHLINKDEFFILE) { # Windows special option |
| 3326 |
SHLINKDEFFILE on $(_sl) $(_l) = [ NormSrcTargets $(SHLINKDEFFILE) ] ; |
| 3327 |
Depends $(_sl) : [ geton $(_sl) : SHLINKDEFFILE ] ; |
| 3328 |
FakeFile_ $(_l) : $(_sl) ; # .lib is created with .dll |
| 3329 |
ShLinkDef_ $(_sl) $(_l) : $(_s) ; |
| 3330 |
} else { |
| 3331 |
if (SHLINKSEARCHEXEPATH) { # UNIX special option |
| 3332 |
|
| 3333 |
if $(OS) = MACOSX { # OS X version of ld |
| 3334 |
SHLINKSEARCHEXEPATH = @executable_path/ ; |
| 3335 |
} else { |
| 3336 |
# SHLINKSEARCHEXEPATH = \\$PATH/ ; |
| 3337 |
SHLINKSEARCHEXEPATH = \\$ORIGIN/ ; |
| 3338 |
} |
| 3339 |
} |
| 3340 |
ShLink_ $(_sl) $(_l) : $(_s) ; |
| 3341 |
} |
| 3342 |
|
| 3343 |
# Try and make sure the objects are build with the correct flag |
| 3344 |
ObjectCcFlags $(>) : $(CCSHOBJFLAG) ; |
| 3345 |
ObjectC++Flags $(>) : $(CCSHOBJFLAG) ; |
| 3346 |
|
| 3347 |
if $(3) { |
| 3348 |
ShLibraryLibraries $(<) : $(3) ; |
| 3349 |
} |
| 3350 |
if $(4) { |
| 3351 |
ShLibraryShLibraries $(<) : $(4) ; |
| 3352 |
} |
| 3353 |
} |
| 3354 |
|
| 3355 |
# Internal link |
| 3356 |
rule Link_ |
| 3357 |
{ |
| 3358 |
MODE on $(<) = $(EXEMODE) ; |
| 3359 |
Chmod_ $(<) ; |
| 3360 |
} |
| 3361 |
|
| 3362 |
# Make the shared library link with the given objects. |
| 3363 |
# This is just a way of adding common object files to many shlibs. |
| 3364 |
# ShLibraryObjects shlib : objects ; |
| 3365 |
rule ShLibraryObjects |
| 3366 |
{ |
| 3367 |
#Echo "ShLibraryObjects got '" $(<) "' and '" $(>) "'" ; |
| 3368 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3369 |
local _t = [ NormDstTargets $(<:S=$(SUFSHLIB)) ] ; |
| 3370 |
local _o = [ NormSrcTargets $(>:S=$(SUFOBJ)) ] ; |
| 3371 |
|
| 3372 |
Depends $(_t) : $(_o) ; |
| 3373 |
|
| 3374 |
SHLINKOBJS on $(_t) += $(_o) ; |
| 3375 |
} |
| 3376 |
|
| 3377 |
# Make the executables link with the given static libraries. |
| 3378 |
# ShLibraryLibraries shlib : libraries ; |
| 3379 |
rule ShLibraryLibraries |
| 3380 |
{ |
| 3381 |
#Echo "ShLibraryLibraries got '" $(<) "' and '" $(>) "'" ; |
| 3382 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3383 |
local _t = [ NormDstTargets $(<:S=$(SUFSHLIB)) ] ; |
| 3384 |
local _l = [ NormSrcTargets $(>:S=$(SUFLIB)) ] ; |
| 3385 |
|
| 3386 |
Depends $(_t) : $(_l) ; |
| 3387 |
|
| 3388 |
SHLINKLIBS on $(_t) += $(_l) ; |
| 3389 |
} |
| 3390 |
|
| 3391 |
# Make the executables link with the given shared libraries. |
| 3392 |
# ShLibraryShLibraries shlib : shlibraries ; |
| 3393 |
rule ShLibraryShLibraries |
| 3394 |
{ |
| 3395 |
#Echo "ShLibraryShLibraries got '" $(<) "' and '" $(>) "'" ; |
| 3396 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3397 |
local _t = [ NormDstTargets $(<:S=$(SUFSHLIB)) ] ; |
| 3398 |
local _l = [ NormSrcTargets $(>:S=$(SUFSHIMPLIB)) ] ; |
| 3399 |
|
| 3400 |
Depends $(_t) : $(_l) ; |
| 3401 |
|
| 3402 |
SHLINKSHLIBS on $(_t) += $(_l) ; |
| 3403 |
} |
| 3404 |
|
| 3405 |
# Add extra LINKFLAGS to mains |
| 3406 |
# MainLinkFlags mains : flags ; |
| 3407 |
rule MainLinkFlags |
| 3408 |
{ |
| 3409 |
#Echo "MainLinkFlags got '" $(<) "' and '" $(>) "'" ; |
| 3410 |
local _t = [ NormDstTargets $(<:S=$(SUFEXE)) ] ; |
| 3411 |
local _i ; |
| 3412 |
|
| 3413 |
for _i in $(_t) { |
| 3414 |
LINKFLAGS on $(_i) += $(>) ; |
| 3415 |
#Echo "exes '" $(_i) "' got LINKFLAGS '" [ geton $(_i) : LINKFLAGS ] "'" ; |
| 3416 |
} |
| 3417 |
} |
| 3418 |
|
| 3419 |
# Make an executable from sources |
| 3420 |
# Main image : sources : flags : defines : hdrpaths : objects : libs : shlibs ; |
| 3421 |
rule Main |
| 3422 |
{ |
| 3423 |
MainFromObjects $(<) : $(>) $(6) : $(7) : $(8) ; |
| 3424 |
Objects $(>) : $(3) : $(4) : $(5) ; |
| 3425 |
} |
| 3426 |
|
| 3427 |
# Make a variant executable from sources |
| 3428 |
# Objects are distiguished by appending "_image" |
| 3429 |
# MainVariant image : sources : flags : defines : hdrpaths : objects : libs : shlibs ; |
| 3430 |
rule MainVariant |
| 3431 |
{ |
| 3432 |
local _i _t _o ; |
| 3433 |
|
| 3434 |
#Echo "MainVariant got '" $(<) "' and '" $(>) "'" ; |
| 3435 |
for _i in $(>) { |
| 3436 |
_t = $(_i:DB)_$(<[1]) ; |
| 3437 |
Object $(_t) : $(_i) : $(3) : $(4) : $(5) ; |
| 3438 |
#Echo "MainVariant object '" $(_t) "' and src '" $(_i) "'" ; |
| 3439 |
_o += $(_t) ; |
| 3440 |
} |
| 3441 |
#Echo "MainVariant image '" $(<) "' and objs '" $(_o) "'" ; |
| 3442 |
MainFromObjects $(<) : $(_o) $(6) : $(7) : $(8) ; |
| 3443 |
} |
| 3444 |
|
| 3445 |
# Make an executable from objects |
| 3446 |
# MainFromObjects image : objects : libs : shlibs ; |
| 3447 |
rule MainFromObjects |
| 3448 |
{ |
| 3449 |
#Echo "MainFromObjects got" $(<) "and" $(>) ; |
| 3450 |
|
| 3451 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3452 |
local _t = [ NormDstTargets $(<[1]:S=$(SUFEXE)) ] ; |
| 3453 |
local _s = [ NormSrcTargets $(>:S=$(SUFOBJ)) ] ; |
| 3454 |
|
| 3455 |
#Echo "MainFromObjects _t" $(_t) "and _s" $(_s) ; |
| 3456 |
|
| 3457 |
# so 'jam foo' works when it's really foo.exe |
| 3458 |
if $(_t:S=) != $(_t) |
| 3459 |
{ |
| 3460 |
Depends $(_t:S=) : $(_t) ; |
| 3461 |
NotFile $(_t:S=) ; |
| 3462 |
} |
| 3463 |
|
| 3464 |
# make compiled sources a dependency of target |
| 3465 |
|
| 3466 |
Depends exe : $(_t) ; |
| 3467 |
Depends $(_t) : $(_s) ; |
| 3468 |
Clean clean : $(_t) ; |
| 3469 |
MakeLocate $(_t) ; |
| 3470 |
|
| 3471 |
if $(3) { |
| 3472 |
LinkLibraries $(<) : $(3) ; |
| 3473 |
} |
| 3474 |
if $(4) { |
| 3475 |
LinkShLibraries $(<) : $(4) ; |
| 3476 |
} |
| 3477 |
|
| 3478 |
#Echo "MainFromObjects LINKFLAGS = '" $(LINKFLAGS) "' and P_LINKFLAGS ='" $(P_LINKFLAGS) "'" ; |
| 3479 |
#Echo " PREF_LINKFLAGS = '" $(PREF_LINKFLAGS) "' and P_PREF_LINKFLAGS ='" $(P_PREF_LINKFLAGS) "'" ; |
| 3480 |
#Echo " pref_linkflags = '" $(pref_linkflags) "'" ; |
| 3481 |
if $(LINKFLAGS) || $(P_LINKFLAGS) |
| 3482 |
|| $(PREF_LINKFLAGS) || $(P_PREF_LINKFLAGS) { |
| 3483 |
local pref_linkflags = $(P_PREF_LINKFLAGS) ; |
| 3484 |
pref_linkflags ?= $(PREF_LINKFLAGS) ; |
| 3485 |
LINKFLAGS on $(_t) += $(P_LINKFLAGS) $(LINKFLAGS) $(pref_linkflags) ; |
| 3486 |
#Echo "LINKFLAGS on $(_t) = '" [ geton $(_t) : LINKFLAGS ] "'" ; |
| 3487 |
} |
| 3488 |
|
| 3489 |
#Echo "MainFromObjects LINKOBJS = '" $(LINKOBJS) "' and P_LINKOBJS ='" $(P_LINKOBJS) "'" ; |
| 3490 |
if $(LINKOBJS) || $(P_LINKOBJS) { |
| 3491 |
local _o = [ NormSrcTargets $(LINKOBJS:S=$(SUFOBJ)) ] $(P_LINKOBJS:S=$(SUFOBJ)) ; |
| 3492 |
Depends $(_t) : $(_o) ; |
| 3493 |
LINKOBJS on $(_t) += $(_o) ; |
| 3494 |
} |
| 3495 |
|
| 3496 |
#Echo "MainFromObjects LINKLIBS = '" $(LINKLIBS) "' and P_LINKLIBS ='" $(P_LINKLIBS) "'" ; |
| 3497 |
if $(LINKLIBS) || $(P_LINKLIBS) { |
| 3498 |
local _l = [ NormSrcTargets $(LINKLIBS:S=$(SUFLIB)) ] $(P_LINKLIBS:S=$(SUFLIB)) ; |
| 3499 |
Depends $(_t) : $(_l) ; |
| 3500 |
LINKLIBS on $(_t) += $(_l) ; |
| 3501 |
} |
| 3502 |
|
| 3503 |
#Echo "MainFromObjects LINKSHLIBS = '" $(LINKSHLIBS) "' and P_LINKSHLIBS ='" $(P_LINKSHLIBS) "'" ; |
| 3504 |
if $(LINKSHLIBS) || $(P_LINKSHLIBS) { |
| 3505 |
local _l = [ NormSrcTargets $(LINKSHLIBS:S=$(SUFIMPLIB)) ] $(P_LINKSHLIBS:S=$(SUFIMPLIB)) ; |
| 3506 |
Depends $(_t) : $(_l) ; |
| 3507 |
LINKSHLIBS on $(_t) += $(_l) ; |
| 3508 |
} |
| 3509 |
|
| 3510 |
Link_ $(_t) : $(_s) ; |
| 3511 |
|
| 3512 |
# Some OS's need to post process GUI apps to work (ie. OS X bundle) |
| 3513 |
if [ geton $(_t) : GUIAPP ] = "true" { |
| 3514 |
GUIAPP $(_t) ; |
| 3515 |
} |
| 3516 |
|
| 3517 |
# On MSWin10 we may want to use UTF-8 for text |
| 3518 |
if $(WIN_MT_AVAIL) = true && $(WIN_UTF8) = true { |
| 3519 |
WIN_UTF8_MANIFEST $(_t) ; |
| 3520 |
SET_WIN_UTF8 = true ; |
| 3521 |
} |
| 3522 |
|
| 3523 |
# On MSWin we may want to trigger UAC |
| 3524 |
if $(WIN_MT_AVAIL) = true && [ geton $(_t) : WIN_UAC ] = true { |
| 3525 |
WIN_UAC_COMBINE on $(_t) = "outputresource" ; |
| 3526 |
if $(SET_WIN_UTF8) { |
| 3527 |
WIN_UAC_COMBINE on $(_t) = "updateresource" ; |
| 3528 |
} |
| 3529 |
WIN_UAC_MANIFEST $(_t) ; |
| 3530 |
} |
| 3531 |
|
| 3532 |
#Echo "MainFromObjects done" ; |
| 3533 |
} |
| 3534 |
|
| 3535 |
# A rule to make several mains from each of their single source files. |
| 3536 |
# MainsFromSources executables ; |
| 3537 |
rule MainsFromSources |
| 3538 |
{ |
| 3539 |
local _i ; |
| 3540 |
for _i in $(<) { |
| 3541 |
Main $(_i) : $(_i) ; |
| 3542 |
} |
| 3543 |
} |
| 3544 |
|
| 3545 |
# Make the executables link with the given objects. |
| 3546 |
# This is just a way of adding common object files to many mains. |
| 3547 |
# LinkObjects image : objects ; |
| 3548 |
rule LinkObjects |
| 3549 |
{ |
| 3550 |
#Echo "LinkObjects got '" $(<) "' and '" $(>) "'" ; |
| 3551 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3552 |
local _t = [ NormDstTargets $(<:S=$(SUFEXE)) ] ; |
| 3553 |
local _o = [ NormSrcTargets $(>:S=$(SUFOBJ)) ] ; |
| 3554 |
|
| 3555 |
Depends $(_t) : $(_o) ; |
| 3556 |
|
| 3557 |
LINKOBJS on $(_t) += $(_o) ; |
| 3558 |
} |
| 3559 |
|
| 3560 |
# Make the executables link with the given static libraries. |
| 3561 |
# LinkLibraries image : libraries ; |
| 3562 |
rule LinkLibraries |
| 3563 |
{ |
| 3564 |
#Echo "LinkLibraries got '" $(<) "' and '" $(>) "'" ; |
| 3565 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3566 |
local _t = [ NormDstTargets $(<:S=$(SUFEXE)) ] ; |
| 3567 |
local _l = [ NormSrcTargets $(>:S=$(SUFLIB)) ] ; |
| 3568 |
|
| 3569 |
Depends $(_t) : $(_l) ; |
| 3570 |
|
| 3571 |
LINKLIBS on $(_t) += $(_l) ; |
| 3572 |
} |
| 3573 |
|
| 3574 |
# Make the executables link with the given shared libraries. |
| 3575 |
# LinkShLibraries image : shlibraries ; |
| 3576 |
rule LinkShLibraries |
| 3577 |
{ |
| 3578 |
#Echo "LinkShLibraries got '" $(<) "' and '" $(>) "'" ; |
| 3579 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3580 |
local _t = [ NormDstTargets $(<:S=$(SUFEXE)) ] ; |
| 3581 |
local _l = [ NormSrcTargets $(>:S=$(SUFSHIMPLIB)) ] ; |
| 3582 |
|
| 3583 |
Depends $(_t) : $(_l) ; |
| 3584 |
|
| 3585 |
LINKSHLIBS on $(_t) += $(_l) ; |
| 3586 |
} |
| 3587 |
|
| 3588 |
# Ensure that each targets directories are created |
| 3589 |
# Makelocate targets ; |
| 3590 |
rule MakeLocate |
| 3591 |
{ |
| 3592 |
#Echo "MakeLocate got '" $(<) "'" ; |
| 3593 |
local _i ; |
| 3594 |
# Uses special variable LOCATE of targets, and arranges |
| 3595 |
# with MkDir to create target directory. |
| 3596 |
# The directory itself becomes a target |
| 3597 |
|
| 3598 |
for _i in $(<) { |
| 3599 |
local _t = [ geton $(_i) : LOCATE ] ; |
| 3600 |
if $(_t) { |
| 3601 |
MkDir_ $(_t) : $(_i) ; |
| 3602 |
} |
| 3603 |
} |
| 3604 |
} |
| 3605 |
|
| 3606 |
# Make the directories and all their parent directories. |
| 3607 |
# MkDir directories ; |
| 3608 |
rule MkDir |
| 3609 |
{ |
| 3610 |
#Echo "MkDir got '" $(<) "'" ; |
| 3611 |
# Ignore timestamps on directories: we only care if they exist. |
| 3612 |
local _t= [ NormPaths $(<) ] ; |
| 3613 |
local _i ; |
| 3614 |
|
| 3615 |
for _i in $(_t) { |
| 3616 |
MkDir_ $(_i) ; |
| 3617 |
} |
| 3618 |
} |
| 3619 |
|
| 3620 |
# Internal MkDir |
| 3621 |
# MkDir dir [ : dependency ] |
| 3622 |
rule MkDir_ |
| 3623 |
{ |
| 3624 |
#Echo "MkDir_ got '" $(<) "' : '" $(>) "'" ; |
| 3625 |
|
| 3626 |
if ! $(<:BS) { |
| 3627 |
return ; |
| 3628 |
} |
| 3629 |
|
| 3630 |
local _t ; |
| 3631 |
local _d = $(<:D) ; # Form target id from path + last directory |
| 3632 |
if ! $(_d) { |
| 3633 |
_d = $(DOT) ; |
| 3634 |
} |
| 3635 |
local _t = [ NormIDstTargets $(<:BS) : $(_d) ] ; |
| 3636 |
|
| 3637 |
#Echo "MkDir_ target = '" $(_t) "' dependant = '" $(>) "'" ; |
| 3638 |
|
| 3639 |
if $(>) { # Thing that depends on this directory |
| 3640 |
Depends $(>) : $(_t) ; |
| 3641 |
} |
| 3642 |
NoUpdate $(_t) ; |
| 3643 |
|
| 3644 |
# Don't create . or any directory already created. |
| 3645 |
|
| 3646 |
if $(_t) != $(DOT) && ! $($(_t)-mkdir) |
| 3647 |
{ |
| 3648 |
# Cheesy gate to prevent multiple invocations on same dir |
| 3649 |
# Arrange for jam dirs |
| 3650 |
# MkDir1 has the actions |
| 3651 |
|
| 3652 |
#Echo "Making '" $(_t) "'" ; |
| 3653 |
$(_t)-mkdir = true ; |
| 3654 |
Depends dirs : $(_t) ; |
| 3655 |
MkDir1 $(_t) ; |
| 3656 |
|
| 3657 |
# Recursively make parent directories. |
| 3658 |
# $(_t:P) = $(_t)'s parent, & we recurse until root |
| 3659 |
|
| 3660 |
local _s = $(<:P) ; |
| 3661 |
#Echo "parent = '" $(_s) "'" ; |
| 3662 |
|
| 3663 |
# Don't try to create A: or A:\ on windows |
| 3664 |
|
| 3665 |
if $(NT) |
| 3666 |
{ |
| 3667 |
switch $(_s) |
| 3668 |
{ |
| 3669 |
case *: : _s = ; |
| 3670 |
case *:\\ : _s = ; |
| 3671 |
case *:/ : _s = ; |
| 3672 |
} |
| 3673 |
} |
| 3674 |
|
| 3675 |
#Echo "parent now = '" $(_s) "'" ; |
| 3676 |
if $(_s) = $(SLASH) # Hmm. Was $(_s) = $(<). How could that work ? |
| 3677 |
{ |
| 3678 |
#Echo "At root, ignore '" $(_s) "' = '" $(<) "'" ; |
| 3679 |
# The parent is the same as the dir. |
| 3680 |
# We're at the root, which some OS's can't stat, so we mark |
| 3681 |
# it as NotFile. |
| 3682 |
|
| 3683 |
NotFile $(_s) ; |
| 3684 |
} |
| 3685 |
else if $(_s) |
| 3686 |
{ |
| 3687 |
# There's a parent; recurse. |
| 3688 |
|
| 3689 |
#Echo "Doing Depends '" $(_t) "' with '" [ _TargetIDs $(_s) ] "'" ; |
| 3690 |
Depends $(_t) : [ _TargetIDs $(_s) ] ; |
| 3691 |
#Echo "Recursing with parent '" $(_s) "'" ; |
| 3692 |
MkDir_ $(_s) ; |
| 3693 |
} |
| 3694 |
} else { |
| 3695 |
#Echo "Not making '" $(_t) "' because it's dot, or it's been made before" ; |
| 3696 |
} |
| 3697 |
} |
| 3698 |
|
| 3699 |
# Deal with a single source to object. |
| 3700 |
# Object object : sources : flags : defines : hdrpaths |
| 3701 |
rule Object |
| 3702 |
{ |
| 3703 |
#Echo "Object got " $(<) "and" $(>) "' flags '" $(3) "' defs '" $(4) "' hds '" $(5) "'" ; |
| 3704 |
|
| 3705 |
# Normalize target names and set Grist LOCATE and SOURCE |
| 3706 |
local _t = [ NormDstTargets $(<[1]:S=$(SUFOBJ)) ] ; |
| 3707 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 3708 |
local _dot ; |
| 3709 |
|
| 3710 |
#Echo "Object norms " $(_t) "and" $(_s) ; |
| 3711 |
|
| 3712 |
Depends $(_t) : $(_s) ; |
| 3713 |
Depends obj : $(_t) ; |
| 3714 |
Clean clean : $(_t) ; |
| 3715 |
MakeLocate $(_t) ; |
| 3716 |
|
| 3717 |
# HDRS is used to provide the -I$(HDRS) options on compile. |
| 3718 |
|
| 3719 |
#Echo "Object sets HDRS on '" $(_t) "' to HDRS '" $(HDRS) "' and P_HDRS '" $(P_HDRS) "'" ; |
| 3720 |
HDRS on $(_t) = [ geton $(_t) : SEARCH ] [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 3721 |
#Echo "HDRS on '" $(_t) "' is now '" [ geton $(_t) : HDRS ] "'" ; |
| 3722 |
|
| 3723 |
# we need to mark what the associated source is so |
| 3724 |
# that if we want to change HDRS we can propogate |
| 3725 |
# it to the #include files. |
| 3726 |
|
| 3727 |
SOURCE on $(_t) = $(_s) ; # ~~99 should check source is the same as any previous ? |
| 3728 |
|
| 3729 |
# handle #includes for source: Jam scans for headers with |
| 3730 |
# the regexp pattern $(HDRSCAN) and then invokes $(HDRRULE) |
| 3731 |
# with the scanned file as the target and the found headers |
| 3732 |
# as the sources. HDRSEARCH is the value of SEARCH used for |
| 3733 |
# the found header files. |
| 3734 |
|
| 3735 |
HDRRULE on $(_s) = HdrRule ; |
| 3736 |
HDRSCAN on $(_s) = $(HDRPATTERN) ; |
| 3737 |
|
| 3738 |
# Construct HDRSEARCH so that we can latter add to HDRS |
| 3739 |
local _dot = [ geton $(_s) : NOMLOC ] ; |
| 3740 |
if ! $(_dot) { _dot = $(DOT) ; } |
| 3741 |
HDRSEARCH1 on $(_s) = $(_dot) ; |
| 3742 |
HDRSEARCH2 on $(_s) = [ NormPaths $(HDRS) ] $(P_HDRS) ; |
| 3743 |
HDRSEARCH3 on $(_s) = [ NormPaths $(STDHDRS) ] ; |
| 3744 |
HDRSEARCH on $(_s) = [ geton $(_s) : HDRSEARCH1 ] [ geton $(_s) : HDRSEARCH2 ] |
| 3745 |
[ geton $(_s) : HDRSEARCH3 ] ; |
| 3746 |
#Echo "Object: HDRSEARCH on '" $(_s) "' set to '" [ geton $(_s) : HDRSEARCH ] "'" ; |
| 3747 |
|
| 3748 |
# propagate target specific-defines |
| 3749 |
|
| 3750 |
DEFINES on $(_t) = $(P_DEFINES) $(DEFINES) ; |
| 3751 |
|
| 3752 |
# if source is not .c, generate .c with specific rule |
| 3753 |
|
| 3754 |
switch $(_s:S) |
| 3755 |
{ |
| 3756 |
case .asm : As_ $(_t) : $(_s) ; |
| 3757 |
case .s : As_ $(_t) : $(_s) ; |
| 3758 |
case .S : As_ $(_t) : $(_s) ; |
| 3759 |
|
| 3760 |
case .c : Cc_ $(_t) : $(_s) ; |
| 3761 |
|
| 3762 |
case .C : C++_ $(_t) : $(_s) ; |
| 3763 |
case .cc : C++_ $(_t) : $(_s) ; |
| 3764 |
case .cpp : C++_ $(_t) : $(_s) ; |
| 3765 |
case .cxx : C++_ $(_t) : $(_s) ; |
| 3766 |
|
| 3767 |
case .m : Cc_ $(_t) : $(_s) ; |
| 3768 |
|
| 3769 |
case .f : Fortran_ $(_t) : $(_s) ; |
| 3770 |
|
| 3771 |
case .l : { |
| 3772 |
local _c = $(_t:S=.c) ; |
| 3773 |
CopyTarget $(_c) : $(_t) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 3774 |
Lex_ $(_c) : $(_s) ; |
| 3775 |
Cc_ $(_t) : $(_c) ; |
| 3776 |
} |
| 3777 |
|
| 3778 |
case .y : { |
| 3779 |
local _c = $(_t:S=$(YACCGEN)) ; |
| 3780 |
CopyTarget $(_c) : $(_t) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 3781 |
Yacc_ $(_c) : $(_s) ; |
| 3782 |
Cc_ $(_t) : $(_c) ; |
| 3783 |
} |
| 3784 |
# Note user object gets normalized target and source |
| 3785 |
case * : UserObject $(_t) : $(_s) : $(3) : $(4) : $(5) ; |
| 3786 |
} |
| 3787 |
#Echo ; |
| 3788 |
|
| 3789 |
if $(3) { |
| 3790 |
ObjectCcFlags $(<) : $(3) ; |
| 3791 |
switch $(_s:S) |
| 3792 |
{ |
| 3793 |
case .c : ObjectCcFlags $(_t) : $(3) ; |
| 3794 |
|
| 3795 |
case .C : ObjectC++Flags $(_t) : $(3) ; |
| 3796 |
case .cc : ObjectC++Flags $(_t) : $(3) ; |
| 3797 |
case .cpp : ObjectC++Flags $(_t) : $(3) ; |
| 3798 |
case .cxx : ObjectC++Flags $(_t) : $(3) ; |
| 3799 |
|
| 3800 |
case .l : ObjectCcFlags $(_t) : $(3) ; |
| 3801 |
case .y : ObjectCcFlags $(_t) : $(3) ; |
| 3802 |
} |
| 3803 |
} |
| 3804 |
if $(4) { |
| 3805 |
ObjectDefines $(<) : $(4) ; |
| 3806 |
} |
| 3807 |
if $(5) { |
| 3808 |
ObjectHdrs $(<) : $(5) ; |
| 3809 |
} |
| 3810 |
} |
| 3811 |
|
| 3812 |
# Add extra CCFLAGS to objects |
| 3813 |
# ObjectCcFlags objects : flags ; |
| 3814 |
rule ObjectCcFlags |
| 3815 |
{ |
| 3816 |
#Echo "ObjectCcFLags got '" $(<) "' and '" $(>) "'" ; |
| 3817 |
local _t = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3818 |
local _i ; |
| 3819 |
|
| 3820 |
for _i in $(_t) { |
| 3821 |
CCFLAGS1 on $(_i) += $(>) ; |
| 3822 |
CCFLAGS on $(_i) = [ geton $(_i) : CCFLAGS1 ] [ geton $(_i) : CCFLAGS2 ] ; |
| 3823 |
#Echo "object '" $(_i) "' got CCFLAGS1 '" [ geton $(_i) : CCFLAGS1 ] "' and CCFLAGS2 '" [ geton $(_i) : CCFLAGS2 ] "' for total CCFLAGS '" [ geton $(_i) : CCFLAGS ] "'" ; |
| 3824 |
} |
| 3825 |
} |
| 3826 |
|
| 3827 |
# Add extra PREF_CCFLAGS to objects |
| 3828 |
# ObjectPrefCcFlags objects : flags ; |
| 3829 |
rule ObjectPrefCcFlags |
| 3830 |
{ |
| 3831 |
#Echo "ObjectPrefCcFLags got '" $(<) "' and '" $(>) "'" ; |
| 3832 |
if ! $(P_PREF_CCFLAGS) { |
| 3833 |
local _t = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3834 |
local _i ; |
| 3835 |
|
| 3836 |
for _i in $(_t) { |
| 3837 |
CCFLAGS2 on $(_i) += $(>) ; |
| 3838 |
CCFLAGS on $(_i) = [ geton $(_i) : CCFLAGS1 ] [ geton $(_i) : CCFLAGS2 ] ; |
| 3839 |
#Echo "object '" $(_i) "' got CCFLAGS1 '" [ geton $(_i) : CCFLAGS1 ] "' and CCFLAGS2 '" [ geton $(_i) : CCFLAGS2 ] "' for total CCFLAGS '" [ geton $(_i) : CCFLAGS ] "'" ; |
| 3840 |
} |
| 3841 |
} |
| 3842 |
} |
| 3843 |
|
| 3844 |
# Add extra C++FLAGS to objects |
| 3845 |
# ObjectC++Flags objects : flags ; |
| 3846 |
rule ObjectC++Flags |
| 3847 |
{ |
| 3848 |
#Echo "ObjectC++FLags got '" $(<) "' and '" $(>) "'" ; |
| 3849 |
local _t = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3850 |
local _i ; |
| 3851 |
|
| 3852 |
for _i in $(_t) { |
| 3853 |
C++FLAGS1 on $(_i) += $(>) ; |
| 3854 |
C++FLAGS on $(_i) = [ geton $(_i) : C++FLAGS1 ] [ geton $(_i) : C++FLAGS2 ] ; |
| 3855 |
} |
| 3856 |
} |
| 3857 |
|
| 3858 |
# Add extra PREF_C++FLAGS to objects |
| 3859 |
# ObjectPrefC++Flags objects : flags ; |
| 3860 |
rule ObjectPrefC++Flags |
| 3861 |
{ |
| 3862 |
#Echo "ObjectPrefC++FLags got '" $(<) "' and '" $(>) "'" ; |
| 3863 |
if ! $(P_PREF_C++FLAGS) { |
| 3864 |
local _t = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3865 |
local _i ; |
| 3866 |
|
| 3867 |
for _i in $(_t) { |
| 3868 |
C++FLAGS2 on $(_i) += $(>) ; |
| 3869 |
C++FLAGS on $(_i) = [ geton $(_i) : C++FLAGS1 ] [ geton $(_i) : C++FLAGS2 ] ; |
| 3870 |
} |
| 3871 |
} |
| 3872 |
} |
| 3873 |
|
| 3874 |
# Add extra DEFINES to objects |
| 3875 |
# ObjectDefines objects : defines ; |
| 3876 |
rule ObjectDefines |
| 3877 |
{ |
| 3878 |
# must reformat CCDEFS according to current defines |
| 3879 |
|
| 3880 |
local s = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3881 |
|
| 3882 |
DEFINES on $(s) += $(>) ; |
| 3883 |
CCDEFS on $(s) = [ on $(s) FDefines $(DEFINES) ] ; |
| 3884 |
} |
| 3885 |
|
| 3886 |
# Add extra header search paths to objects. |
| 3887 |
# ObjectHdrs objects : dirs ; |
| 3888 |
rule ObjectHdrs |
| 3889 |
{ |
| 3890 |
#Echo "ObjectHdrs HDRS got '" $(<) "' and '" $(>) "'" ; |
| 3891 |
# Add to HDRS for CCHDRS benefit. |
| 3892 |
local _t = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3893 |
local _h = [ NormSrcPaths $(>) ] ; |
| 3894 |
local _i _s ; |
| 3895 |
|
| 3896 |
#Echo "ObjectHdrs changed HDRS on '" $(_t) "' from '" [ geton $(_t) : HDRS ] "'" ; |
| 3897 |
HDRS on $(_t) += $(_h) ; |
| 3898 |
#Echo " to '" [ geton $(_t) : HDRS ] "'" ; |
| 3899 |
for _i in $(_t) { |
| 3900 |
_s = [ geton $(_i) : SOURCE ] ; |
| 3901 |
#Echo " obj '" $(_i) "' has source '" $(_s) "'" ; |
| 3902 |
#Echo " ObjectHdrs changed HDRSEARCH on '" $(_s) "' from '" [ geton $(_s) : HDRSEARCH ] "'" ; |
| 3903 |
HDRSEARCH2 on $(_s) += $(_h) ; |
| 3904 |
HDRSEARCH on $(_s) = [ geton $(_s) : HDRSEARCH1 ] [ geton $(_s) : HDRSEARCH2 ] |
| 3905 |
[ geton $(_s) : HDRSEARCH3 ] ; |
| 3906 |
#Echo " to '" [ geton $(_s) : HDRSEARCH ] "'" ; |
| 3907 |
CCHDRS on $(_i) = [ on $(_i) FIncludes $(HDRS) ] ; |
| 3908 |
} |
| 3909 |
} |
| 3910 |
|
| 3911 |
# Set KEEPOBJS on the given headers |
| 3912 |
# ObjectKeep objects ; |
| 3913 |
rule ObjectKeep |
| 3914 |
{ |
| 3915 |
#Echo "ObjectKeep got '" $(<) "" ; |
| 3916 |
local _t = [ NormDstTargets $(<:S=$(SUFOBJ)) ] ; |
| 3917 |
|
| 3918 |
KEEPOBJS on $(_t) = "true" ; |
| 3919 |
#Echo "ObjectHdrs changed KEEPOBJS on '" $(_t) "' to '" [ geton $(_t[1]) : KEEPOBJS ] "'" ; |
| 3920 |
} |
| 3921 |
|
| 3922 |
# Create object files from sources. |
| 3923 |
# Objects sources : flags : defines : hdrpaths ; |
| 3924 |
rule Objects |
| 3925 |
{ |
| 3926 |
#Echo "Objects got src '" $(<) "' flags '" $(2) "' def '" $(3) "' hdrs '" $(4) "'" ; |
| 3927 |
local _i ; |
| 3928 |
|
| 3929 |
for _i in $(<) { |
| 3930 |
Object $(_i) : $(_i) : $(2) : $(3) : $(4) ; |
| 3931 |
} |
| 3932 |
} |
| 3933 |
|
| 3934 |
# Marks sources as temporary with the TEMPORARY rule, and deletes sources once targets are built. |
| 3935 |
# Must be the last rule invoked on targets. |
| 3936 |
# RmTemps targets : sources ; |
| 3937 |
rule RmTemps |
| 3938 |
{ |
| 3939 |
local _s = [ NormPaths $(>) ] ; |
| 3940 |
if $(_s) { |
| 3941 |
RmTemps_ $(<) : $(_s) ; |
| 3942 |
} |
| 3943 |
} |
| 3944 |
|
| 3945 |
# internal RmTemps |
| 3946 |
rule RmTemps_ |
| 3947 |
{ |
| 3948 |
Temporary $(>) ; |
| 3949 |
} |
| 3950 |
|
| 3951 |
# Setuid |
| 3952 |
rule Setuid |
| 3953 |
{ |
| 3954 |
local _t = [ NormPaths $(>:S=$(SUFEXE)) ] ; |
| 3955 |
MODE on $(_t) = 4755 ; |
| 3956 |
} |
| 3957 |
|
| 3958 |
# Shell |
| 3959 |
rule Shell |
| 3960 |
{ |
| 3961 |
local _t = [ NormTargs $(>:S=$(SUFSH)) ] ; |
| 3962 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 3963 |
Shell_ $(_t) : $(_s) ; |
| 3964 |
} |
| 3965 |
|
| 3966 |
# internal Shell |
| 3967 |
rule Shell_ |
| 3968 |
{ |
| 3969 |
Depends shell : $(<) ; |
| 3970 |
Depends $(<) : $(>) ; |
| 3971 |
MODE on $(<) = $(SHELLMODE) ; |
| 3972 |
Clean clean : $(<) ; |
| 3973 |
Chmod_ $(<) ; |
| 3974 |
} |
| 3975 |
|
| 3976 |
# SoftLink |
| 3977 |
rule SoftLink |
| 3978 |
{ |
| 3979 |
local _t = [ NormDstTargets $(<) ] ; |
| 3980 |
local _s = [ NormSrcTargets $(>) ] ; |
| 3981 |
|
| 3982 |
SoftLink_ $(_t) : $(_s) ; |
| 3983 |
} |
| 3984 |
|
| 3985 |
# internal SoftLink |
| 3986 |
rule SoftLink_ |
| 3987 |
{ |
| 3988 |
Depends files : $(<) ; |
| 3989 |
Depends $(<) : $(>) ; |
| 3990 |
Clean clean : $(<) ; |
| 3991 |
} |
| 3992 |
|
| 3993 |
#Adds flags to mark symbols as undefined on link command for images |
| 3994 |
rule Undefines |
| 3995 |
{ |
| 3996 |
local _t = [ NormDstTargets $(<) ] ; |
| 3997 |
UNDEFS on [ $(_t:S=$(SUFEXE)) ] += $(UNDEFFLAG)$(>) ; |
| 3998 |
} |
| 3999 |
|
| 4000 |
# User routine to handle objects. Note that |
| 4001 |
# targets and sources are in normalized form. |
| 4002 |
rule UserObject |
| 4003 |
{ |
| 4004 |
Exit "Unknown suffix on" $(>) "- see UserObject rule in Jamfile(5)." ; |
| 4005 |
} |
| 4006 |
|
| 4007 |
# Yacc source.c : source.y ; |
| 4008 |
rule Yacc |
| 4009 |
{ |
| 4010 |
local _t = [ NormDstTargets $(<[1]) ] ; |
| 4011 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 4012 |
|
| 4013 |
Yacc_ $(_t) : $(_s) ; |
| 4014 |
} |
| 4015 |
|
| 4016 |
# internal Yacc |
| 4017 |
rule Yacc_ |
| 4018 |
{ |
| 4019 |
local _h ; |
| 4020 |
|
| 4021 |
_h = $(<:S=.h) ; |
| 4022 |
CopyTarget $(_h) : $(<) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 4023 |
|
| 4024 |
# Some places don't have a yacc. |
| 4025 |
|
| 4026 |
MakeLocate $(<) $(_h) ; |
| 4027 |
|
| 4028 |
if $(YACC) |
| 4029 |
{ |
| 4030 |
Depends $(<) : $(>) ; |
| 4031 |
FakeFile_ $(_h) : $(<) ; # .h is created with .c |
| 4032 |
Yacc1_ $(<) $(_h) : $(>) ; |
| 4033 |
YaccMv_ $(<) $(_h) ; |
| 4034 |
Clean clean : $(<) $(_h) ; |
| 4035 |
} |
| 4036 |
|
| 4037 |
# make sure someone includes $(_h) else it will be |
| 4038 |
# a deadly independent target |
| 4039 |
|
| 4040 |
Includes $(<) : $(_h) ; |
| 4041 |
} |
| 4042 |
|
| 4043 |
# Aswig : source.i ; |
| 4044 |
# Argyll C class generator. Creates C class declaration source.h, |
| 4045 |
# C class partial implementation source_i.c, C++ class wrapper |
| 4046 |
# declaration & implementation source.hpp. |
| 4047 |
rule Aswig |
| 4048 |
{ |
| 4049 |
#Echo "Aswig called with $(>) " ; |
| 4050 |
local _s = [ NormSrcTargets $(>[1]) ] ; |
| 4051 |
|
| 4052 |
Aswig_ : $(_s) ; |
| 4053 |
} |
| 4054 |
|
| 4055 |
# internal Aswig |
| 4056 |
rule Aswig_ |
| 4057 |
{ |
| 4058 |
#Echo "Aswig_ called with $(>)" ; |
| 4059 |
local _i = $(>[1]) ; |
| 4060 |
local _h = $(_i:S=.h) ; |
| 4061 |
CopyTarget $(_h) : $(_i) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 4062 |
local _c = $(_i:B=$(_i:B)_i:S=.c) ; |
| 4063 |
CopyTarget $(_c) : $(_i) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 4064 |
local _hpp = $(_i:S=.hpp) ; |
| 4065 |
CopyTarget $(_hpp) : $(_i) ; # Transfer LOCATE, SEARCH, NOMLOC |
| 4066 |
|
| 4067 |
#Echo "Aswig_ creates $(_h) $(_c) $(_hpp) from $(_i) " ; |
| 4068 |
|
| 4069 |
MakeLocate $(_h) $(_c) $(_hpp) ; |
| 4070 |
|
| 4071 |
Depends $(_h) : $(_i) ; |
| 4072 |
FakeFile_ $(_c) : $(_h) ; # _i.c is created with .h |
| 4073 |
FakeFile_ $(_hpp) : $(_h) ; # _.hpp is created with .h |
| 4074 |
Aswig1_ $(_h) : $(_i) ; |
| 4075 |
Clean clean : $(_h) $(_c) $(_hpp) ; |
| 4076 |
} |
| 4077 |
|
| 4078 |
# |
| 4079 |
# Utility rules; no side effects on these |
| 4080 |
# |
| 4081 |
|
| 4082 |
# FReverse a1 a2 a3 ... ; |
| 4083 |
# return ... a3 a2 a1 ; |
| 4084 |
rule FReverse |
| 4085 |
{ |
| 4086 |
|
| 4087 |
local _i _o = ; |
| 4088 |
for _i in $(1) |
| 4089 |
{ |
| 4090 |
_o = $(_i) $(_o) ; |
| 4091 |
} |
| 4092 |
return $(_o) ; |
| 4093 |
} |
| 4094 |
|
| 4095 |
# Strip common initial elements of variables v1 and v2. |
| 4096 |
# Modifies the variable values themselves. |
| 4097 |
# FStripCommon v1 : v2 ; |
| 4098 |
rule FStripCommon |
| 4099 |
{ |
| 4100 |
|
| 4101 |
if $($(<)[1]) && $($(<)[1]) = $($(>)[1]) |
| 4102 |
{ |
| 4103 |
$(<) = $($(<)[2-]) ; |
| 4104 |
$(>) = $($(>)[2-]) ; |
| 4105 |
FStripCommon $(<) : $(>) ; |
| 4106 |
} |
| 4107 |
} |
| 4108 |
|
| 4109 |
# Append suffix if there is not already one |
| 4110 |
# E.g., "FAppendSuffix yacc lex foo.bat : $(SUFEXE) ;" |
| 4111 |
# returns (yacc,lex,foo.bat) on Unix and |
| 4112 |
# (yacc.exe,lex.exe,foo.bat) on NT. |
| 4113 |
# FAppendSuffix files : suffix ; |
| 4114 |
rule FAppendSuffix |
| 4115 |
{ |
| 4116 |
|
| 4117 |
if $(>) |
| 4118 |
{ |
| 4119 |
local _i _o ; |
| 4120 |
|
| 4121 |
for _i in $(<) |
| 4122 |
{ |
| 4123 |
if $(_i:S) |
| 4124 |
{ |
| 4125 |
_o += $(_i) ; |
| 4126 |
} |
| 4127 |
else |
| 4128 |
{ |
| 4129 |
_o += $(_i:S=$(>)) ; |
| 4130 |
} |
| 4131 |
} |
| 4132 |
return $(_o) ; |
| 4133 |
} |
| 4134 |
else |
| 4135 |
{ |
| 4136 |
return $(<) ; |
| 4137 |
} |
| 4138 |
} |
| 4139 |
|
| 4140 |
# return a1 a2 ... with any empty elements deleted |
| 4141 |
# FDelEmpty a1 a2 ... ; |
| 4142 |
rule FDelEmpty |
| 4143 |
{ |
| 4144 |
|
| 4145 |
local _i _o = ; |
| 4146 |
for _i in $(<) |
| 4147 |
{ |
| 4148 |
if $(_i) { |
| 4149 |
_o += $(_i) ; |
| 4150 |
} |
| 4151 |
} |
| 4152 |
return $(_o) ; |
| 4153 |
} |
| 4154 |
|
| 4155 |
# |
| 4156 |
# Operating system specific utility rules |
| 4157 |
# First, the (generic) UNIX versions |
| 4158 |
# |
| 4159 |
|
| 4160 |
rule FQuote { return \\\"$(<)\\\" ; } |
| 4161 |
rule FDefines { local _t = [ FDelEmpty $(<) ] ; return -D$(_t) ; } |
| 4162 |
rule FIncludes { local _t = [ FDelEmpty $(<) ] ; return -I$(_t) ; } |
| 4163 |
|
| 4164 |
if $(OS2) |
| 4165 |
{ |
| 4166 |
rule FQuote { return \"$(<)\" ; } |
| 4167 |
rule FIncludes { local _t = [ FDelEmpty $(<) ] ; return /I$(_t) ; } |
| 4168 |
} |
| 4169 |
|
| 4170 |
else if $(NT) |
| 4171 |
{ |
| 4172 |
if ! $(MINGW) { |
| 4173 |
rule FDefines { local _t = [ FDelEmpty $(<) ] ; return /D$(_t) ; } |
| 4174 |
rule FIncludes { local _t = [ FDelEmpty $(<) ] ; return /I$(_t) ; } |
| 4175 |
} |
| 4176 |
} |
| 4177 |
|
| 4178 |
else if $(MAC) |
| 4179 |
{ |
| 4180 |
rule FQuote { return \"$(<)\" ; } |
| 4181 |
rule FDefines { local _t = [ FDelEmpty $(<) ] ; return "-define '$(_t)'" ; } |
| 4182 |
rule FIncludes { local _t = [ FDelEmpty $(<) ] ; return \"$(_t:J=,)\" ; } |
| 4183 |
} |
| 4184 |
|
| 4185 |
else if $(VMS) |
| 4186 |
{ |
| 4187 |
rule FQuote { return \"\"\"$(<)\"\"\" ; } |
| 4188 |
rule FDefines { local _t = [ FDelEmpty $(<) ] ; return "/define=( $(_t:J=,) )" ; } |
| 4189 |
rule FIncludes { local _t = [ FDelEmpty $(<) ] ; return "/inc=( $(_t:J=,) )" ; } |
| 4190 |
|
| 4191 |
rule FDirName |
| 4192 |
{ |
| 4193 |
local _s _i ; |
| 4194 |
|
| 4195 |
# Turn individual elements in $(<) into a usable path. |
| 4196 |
|
| 4197 |
if ! $(<) |
| 4198 |
{ |
| 4199 |
_s = $(DOT) ; |
| 4200 |
} |
| 4201 |
else |
| 4202 |
{ |
| 4203 |
# This handles the following cases: |
| 4204 |
# a -> [.a] |
| 4205 |
# a b c -> [.a.b.c] |
| 4206 |
# x: -> x: |
| 4207 |
# x: a -> x:[a] |
| 4208 |
# x:[a] b -> x:[a.b] |
| 4209 |
|
| 4210 |
switch $(<[1]) |
| 4211 |
{ |
| 4212 |
case *:* : _s = $(<[1]) ; |
| 4213 |
case \\[*\\] : _s = $(<[1]) ; |
| 4214 |
case * : _s = [.$(<[1])] ; |
| 4215 |
} |
| 4216 |
|
| 4217 |
for _i in [.$(<[2-])] |
| 4218 |
{ |
| 4219 |
_s = $(_i:R=$(_s)) ; |
| 4220 |
} |
| 4221 |
} |
| 4222 |
|
| 4223 |
return $(_s) ; |
| 4224 |
} |
| 4225 |
} |
| 4226 |
|
| 4227 |
# |
| 4228 |
# Actions |
| 4229 |
# |
| 4230 |
|
| 4231 |
# |
| 4232 |
# First the defaults |
| 4233 |
# |
| 4234 |
|
| 4235 |
actions updated together piecemeal Archive |
| 4236 |
{ |
| 4237 |
$(AR) $(<) $(>) |
| 4238 |
} |
| 4239 |
|
| 4240 |
actions together ArchiveArchive |
| 4241 |
{ |
| 4242 |
mkdir .jamArchiveArchive$PPID |
| 4243 |
cp $(>) .jamArchiveArchive$PPID |
| 4244 |
cd .jamArchiveArchive$PPID |
| 4245 |
for i in $(>:BS) |
| 4246 |
do |
| 4247 |
ar -xo $i |
| 4248 |
done |
| 4249 |
cd .. |
| 4250 |
ar -r $(<) .jamArchiveArchive$PPID/*.o |
| 4251 |
rm -rf .jamArchiveArchive$PPID |
| 4252 |
} |
| 4253 |
|
| 4254 |
actions As_ |
| 4255 |
{ |
| 4256 |
$(AS) $(ASFLAGS) $(ASHDRS) -o $(<) $(>) |
| 4257 |
} |
| 4258 |
|
| 4259 |
actions C++_ |
| 4260 |
{ |
| 4261 |
$(C++) -c -o $(<) $(C++FLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4262 |
} |
| 4263 |
|
| 4264 |
actions Cc_ |
| 4265 |
{ |
| 4266 |
$(CC) -c -o $(<) $(CCFLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4267 |
} |
| 4268 |
|
| 4269 |
actions Chgrp_ |
| 4270 |
{ |
| 4271 |
$(CHGRP) $(GROUP) $(<) |
| 4272 |
} |
| 4273 |
|
| 4274 |
actions Chmod1 |
| 4275 |
{ |
| 4276 |
$(CHMOD) $(MODE) $(<) |
| 4277 |
} |
| 4278 |
|
| 4279 |
actions Chown_ |
| 4280 |
{ |
| 4281 |
$(CHOWN) $(OWNER) $(<) |
| 4282 |
} |
| 4283 |
|
| 4284 |
actions piecemeal together existing Clean |
| 4285 |
{ |
| 4286 |
$(RM) $(>) |
| 4287 |
} |
| 4288 |
|
| 4289 |
actions File_ |
| 4290 |
{ |
| 4291 |
$(CP) $(>) $(<) |
| 4292 |
} |
| 4293 |
|
| 4294 |
#actions FakeFile_ { } |
| 4295 |
|
| 4296 |
actions GenFile1 |
| 4297 |
{ |
| 4298 |
$(>[1]) $(<) $(>[2-]) |
| 4299 |
} |
| 4300 |
|
| 4301 |
actions GenFileND1 |
| 4302 |
{ |
| 4303 |
$(>) |
| 4304 |
} |
| 4305 |
|
| 4306 |
actions GenFileNND1 |
| 4307 |
{ |
| 4308 |
$(>) |
| 4309 |
} |
| 4310 |
|
| 4311 |
actions CreateCatFile_ |
| 4312 |
{ |
| 4313 |
$(CP) /Y nul $(<) > nul |
| 4314 |
} |
| 4315 |
|
| 4316 |
actions CatToFile_ |
| 4317 |
{ |
| 4318 |
echo $(>) >> $(<) |
| 4319 |
} |
| 4320 |
|
| 4321 |
actions Fortran_ |
| 4322 |
{ |
| 4323 |
$(FORTRAN) $(FORTRANFLAGS) -o $(<) $(>) |
| 4324 |
} |
| 4325 |
|
| 4326 |
actions HardLink_ |
| 4327 |
{ |
| 4328 |
$(RM) $(<) && $(LN) $(>) $(<) |
| 4329 |
} |
| 4330 |
|
| 4331 |
actions Install |
| 4332 |
{ |
| 4333 |
$(CP) $(>) $(<) |
| 4334 |
} |
| 4335 |
|
| 4336 |
actions Lex_ |
| 4337 |
{ |
| 4338 |
$(LEX) $(>) |
| 4339 |
} |
| 4340 |
|
| 4341 |
actions LexMv_ |
| 4342 |
{ |
| 4343 |
$(MV) lex.yy.c $(<) |
| 4344 |
} |
| 4345 |
|
| 4346 |
# Old: $(LINK) $(LINKFLAGS) $(LINKOUTFLAG)$(<) $(UNDEFS) $(>) $(LINKOBJS) $(LINKLIBS) $(LINKSHLIBS) $(STDLIBS) |
| 4347 |
# $(LINK) $(LINKOUTFLAG)$(<) $(UNDEFS) $(>) $(LINKFLAGS) $(LINKOBJS) $(LINKLIBS) $(LINKSHLIBS) $(STDLIBS) |
| 4348 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4349 |
{ |
| 4350 |
$(LINK) $(LINKOUTFLAG)$(<) $(UNDEFS) $(>) $(LINKOBJS) $(LINKLIBS) $(LINKSHLIBS) $(LINKFLAGS) $(STDLIBS) |
| 4351 |
} |
| 4352 |
|
| 4353 |
if $(OS) = MACOSX { # OS X version of ld |
| 4354 |
|
| 4355 |
# Link .o and .a into a .dylib |
| 4356 |
# gcc -dynamiclib -Wl,-headerpad_max_install_names,-undefined,dynamic_lookup,-compatibility_version,1.0,-current_version,1.0,-install_name,/usr/local/lib/libfoo.1.dylib -o libfoo.1.dylib $(OBJ) |
| 4357 |
# -Wl,-install_name,@executable_path ??? |
| 4358 |
actions ShLink_ bind SHLINKOBJS SHLINKLIBS SHLINKSHLIBS |
| 4359 |
{ |
| 4360 |
$(LINK) -dynamiclib -Wl,-undefined,dynamic_lookup,-install_name,$(SHLINKSEARCHEXEPATH)$(<[1]:BS) $(LINKOUTFLAG)$(<[1]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHLINKFLAGS) $(SHSTDLIBS) |
| 4361 |
} |
| 4362 |
|
| 4363 |
} else { # General gcc |
| 4364 |
|
| 4365 |
# Link .o and .a into a .so |
| 4366 |
# To set .so search path: -Wl,-rpath,$(LINKSHLIBS:D) |
| 4367 |
# or set LD_LIBRARY_PATH |
| 4368 |
# or set /etc/ld.so.conf.d/*.conf |
| 4369 |
# To set .so search path (after flag): -Wl,-soname=$(<[1]:BS) |
| 4370 |
# Old: $(LINK) -shared -Wl,-soname=$(SHLINKSEARCHEXEPATH)$(<[1]:BS) $(SHLINKFLAGS) $(LINKOUTFLAG)$(<[1]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHSTDLIBS) |
| 4371 |
actions ShLink_ bind SHLINKOBJS SHLINKLIBS SHLINKSHLIBS |
| 4372 |
{ |
| 4373 |
$(LINK) -shared -Wl,-soname=$(SHLINKSEARCHEXEPATH)$(<[1]:BS) $(LINKOUTFLAG)$(<[1]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHLINKFLAGS) $(SHSTDLIBS) |
| 4374 |
} |
| 4375 |
} |
| 4376 |
|
| 4377 |
actions MkDir1 |
| 4378 |
{ |
| 4379 |
$(MKDIR) $(<) |
| 4380 |
} |
| 4381 |
|
| 4382 |
actions together Ranlib |
| 4383 |
{ |
| 4384 |
$(RANLIB) $(<) |
| 4385 |
} |
| 4386 |
|
| 4387 |
actions quietly updated piecemeal together RmTemps_ |
| 4388 |
{ |
| 4389 |
$(RM) $(>) |
| 4390 |
} |
| 4391 |
|
| 4392 |
actions Shell_ |
| 4393 |
{ |
| 4394 |
$(AWK) ' |
| 4395 |
NR == 1 { print "$(SHELLHEADER)" } |
| 4396 |
NR == 1 && /^[#:]/ { next } |
| 4397 |
/^##/ { next } |
| 4398 |
{ print } |
| 4399 |
' < $(>) > $(<) |
| 4400 |
} |
| 4401 |
|
| 4402 |
actions SoftLink_ |
| 4403 |
{ |
| 4404 |
$(RM) $(<) && $(LN) -s $(>) $(<) |
| 4405 |
} |
| 4406 |
|
| 4407 |
actions Yacc1_ |
| 4408 |
{ |
| 4409 |
$(YACC) $(YACCFLAGS) $(>) |
| 4410 |
} |
| 4411 |
|
| 4412 |
actions YaccMv_ |
| 4413 |
{ |
| 4414 |
$(MV) $(YACCFILES).c $(<[1]) |
| 4415 |
$(MV) $(YACCFILES).h $(<[2]) |
| 4416 |
} |
| 4417 |
|
| 4418 |
actions Aswig1_ |
| 4419 |
{ |
| 4420 |
aswig $(ASWIGFLAGS) -c++ -a2c $(>) |
| 4421 |
} |
| 4422 |
|
| 4423 |
# |
| 4424 |
# RELOCATE - for compilers with broken -o flags |
| 4425 |
# |
| 4426 |
|
| 4427 |
if $(RELOCATE) |
| 4428 |
{ |
| 4429 |
actions C++_ |
| 4430 |
{ |
| 4431 |
$(C++) -c $(C++FLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4432 |
} |
| 4433 |
|
| 4434 |
actions Cc_ |
| 4435 |
{ |
| 4436 |
$(CC) -c $(CCFLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4437 |
} |
| 4438 |
|
| 4439 |
actions ignore CcMv |
| 4440 |
{ |
| 4441 |
[ $(<) != $(>:BS=$(SUFOBJ)) ] && $(MV) $(>:BS=$(SUFOBJ)) $(<) |
| 4442 |
} |
| 4443 |
} |
| 4444 |
|
| 4445 |
# |
| 4446 |
# NOARUPDATE - can't update an archive |
| 4447 |
# |
| 4448 |
|
| 4449 |
if $(NOARUPDATE) |
| 4450 |
{ |
| 4451 |
actions Archive |
| 4452 |
{ |
| 4453 |
$(AR) $(<) $(>) |
| 4454 |
} |
| 4455 |
} |
| 4456 |
|
| 4457 |
# |
| 4458 |
# UNIX specific actions |
| 4459 |
# |
| 4460 |
|
| 4461 |
if $(UNIX) |
| 4462 |
{ |
| 4463 |
actions GenFile1 |
| 4464 |
{ |
| 4465 |
PATH="$PATH:." |
| 4466 |
$(>[1]) $(<) $(>[2-]) |
| 4467 |
} |
| 4468 |
|
| 4469 |
actions CreateCatFile_ |
| 4470 |
{ |
| 4471 |
$(CP) /dev/null $(<) |
| 4472 |
} |
| 4473 |
|
| 4474 |
actions CatToFile_ |
| 4475 |
{ |
| 4476 |
echo "$(>)" >> $(<) |
| 4477 |
} |
| 4478 |
|
| 4479 |
# Make OS X GUI apps work |
| 4480 |
if $(OS) = MACOSX |
| 4481 |
{ |
| 4482 |
|
| 4483 |
# Used to use /Developer/Tools/Rez -t APPL Carbon.r -o $(<) |
| 4484 |
# but this no longer works in OS X 10.5, and we don't need this |
| 4485 |
# stuff with TransformProcessType() |
| 4486 |
# Another alternative is to use link option "-sectcreate __TEXT __info_plist Info.plist" ??? |
| 4487 |
# to embed the plist in the executable, but not sure what should be in plist. |
| 4488 |
# Pure GUI app |
| 4489 |
actions GUIAPP |
| 4490 |
{ |
| 4491 |
rm -rf $(<).app |
| 4492 |
mkdir -p $(<).app |
| 4493 |
mkdir $(<).app/Contents |
| 4494 |
mkdir $(<).app/Contents/Resources |
| 4495 |
mkdir $(<).app/Contents/MacOS |
| 4496 |
echo APPLnone > $(<).app/Contents/PkgInfo |
| 4497 |
mv $(<) $(<).app/Contents/MacOS |
| 4498 |
chmod 755 $(<).app/Contents/MacOS/$(<:BS) |
| 4499 |
cat << EOF > $(<).app/Contents/info.plist |
| 4500 |
<?xml version="1.0" encoding="UTF-8"?> |
| 4501 |
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> |
| 4502 |
<plist version="0.9"> |
| 4503 |
<dict> |
| 4504 |
<key>CFBundleName</key> |
| 4505 |
<string>$(<:BS)</string> |
| 4506 |
<key>CFBundlePackageType</key> |
| 4507 |
<string>APPL</string> |
| 4508 |
<key>CFBundleVersion</key> |
| 4509 |
<string>59</string> |
| 4510 |
<key>CFBundleShortVersionString</key> |
| 4511 |
<string>1.1</string> |
| 4512 |
<key>CFBundleSignature</key> |
| 4513 |
<string>none</string> |
| 4514 |
</dict> |
| 4515 |
</plist> |
| 4516 |
EOF |
| 4517 |
cat << EOF > $(<) |
| 4518 |
#!/bin/sh |
| 4519 |
\$0.app/Contents/MacOS/$(<:BS) |
| 4520 |
EOF |
| 4521 |
chmod 755 $(<) |
| 4522 |
} |
| 4523 |
} |
| 4524 |
} |
| 4525 |
|
| 4526 |
# |
| 4527 |
# NT specific actions |
| 4528 |
# |
| 4529 |
|
| 4530 |
if $(NT) |
| 4531 |
{ |
| 4532 |
# Ensure timestamp is updated |
| 4533 |
|
| 4534 |
actions File_ |
| 4535 |
{ |
| 4536 |
$(CP) /b $(>) + nul $(<) > nul |
| 4537 |
} |
| 4538 |
|
| 4539 |
actions Install |
| 4540 |
{ |
| 4541 |
$(CP) /b $(>) + nul $(<) > nul |
| 4542 |
} |
| 4543 |
|
| 4544 |
# Allow MSWin10 apps to use UTF-8 |
| 4545 |
actions WIN_UTF8_MANIFEST |
| 4546 |
{ |
| 4547 |
(echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> |
| 4548 |
echo ^<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"^> |
| 4549 |
echo ^<assemblyIdentity type="win32" name="..." version="6.0.0.0"/^> |
| 4550 |
echo ^<application xmlns="urn:schemas-microsoft-com:asm.v3"^> |
| 4551 |
echo ^<windowsSettings^> |
| 4552 |
echo ^<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings"^>UTF-8^</activeCodePage^> |
| 4553 |
echo ^</windowsSettings^> |
| 4554 |
echo ^</application^> |
| 4555 |
echo ^</assembly^>)>$(<).tmp |
| 4556 |
mt.exe -nologo -manifest $(<).tmp -outputresource:$(<);#1 |
| 4557 |
del $(<).tmp |
| 4558 |
} |
| 4559 |
|
| 4560 |
# Make MSWin10 app trigger UAC |
| 4561 |
actions WIN_UAC_MANIFEST |
| 4562 |
{ |
| 4563 |
(echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> |
| 4564 |
echo ^<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"^> |
| 4565 |
echo ^<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"^> |
| 4566 |
echo ^<security^> |
| 4567 |
echo ^<requestedPrivileges^> |
| 4568 |
echo ^<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/^> |
| 4569 |
echo ^</requestedPrivileges^> |
| 4570 |
echo ^</security^> |
| 4571 |
echo ^</trustInfo^> |
| 4572 |
echo ^</assembly^>)>$(<).tmp |
| 4573 |
mt.exe -nologo -manifest $(<).tmp -$(WIN_UAC_COMBINE):$(<);#1 |
| 4574 |
del $(<).tmp |
| 4575 |
} |
| 4576 |
} |
| 4577 |
|
| 4578 |
if $(NT) && $(MSVCNT) |
| 4579 |
{ |
| 4580 |
# actions updated together piecemeal Archive |
| 4581 |
# { |
| 4582 |
# if exist $(<) set _$(<:B)_=$(<) |
| 4583 |
# $(AR) /out:$(<) %_$(<:B)_% $(>) |
| 4584 |
# } |
| 4585 |
|
| 4586 |
# This is slightly dodgy if you've got multiple |
| 4587 |
# libraries with the same name in different directories with |
| 4588 |
# jam -j n, or you have .obj's distinguished only by their directory |
| 4589 |
# being combined into the same library, but it overcomes |
| 4590 |
# the problem of lib not updating a library properly if |
| 4591 |
# jam is involked from different directories. |
| 4592 |
actions updated together piecemeal Archive |
| 4593 |
{ |
| 4594 |
if exist $(<:BS)_ RMDIR /S/Q $(<:BS)_ |
| 4595 |
MKDIR $(<:BS)_ |
| 4596 |
for %%i in ( $(>) ) do COPY %%i $(<:BS)_ 1>nul |
| 4597 |
if exist $(<) set _$(<:B)_=$(<) |
| 4598 |
$(AR) /out:$(<) %_$(<:B)_% $(<:BS)_\* |
| 4599 |
DEL /F/S/Q $(<:BS)_\* 1>nul |
| 4600 |
RMDIR /Q $(<:BS)_ |
| 4601 |
} |
| 4602 |
|
| 4603 |
actions together ArchiveArchive |
| 4604 |
{ |
| 4605 |
$(AR) /out:$(<) $(>) |
| 4606 |
} |
| 4607 |
|
| 4608 |
actions As |
| 4609 |
{ |
| 4610 |
$(AS) /Ml /p /v /w2 $(>) $(<) ,nul,nul; |
| 4611 |
} |
| 4612 |
|
| 4613 |
actions Cc_ |
| 4614 |
{ |
| 4615 |
$(CC) /c /Fo$(<) $(CCFLAGS) $(CCDEFS) $(CCHDRS) /I$(STDHDRS) $(>) |
| 4616 |
} |
| 4617 |
|
| 4618 |
actions C++_ |
| 4619 |
{ |
| 4620 |
$(C++) /c /Fo$(<) $(C++FLAGS) $(CCDEFS) $(CCHDRS) /I$(STDHDRS) /Tp $(>) |
| 4621 |
} |
| 4622 |
|
| 4623 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4624 |
{ |
| 4625 |
$(LINK) $(LINKFLAGS) $(P_LINKFLAGS) /out:$(<) $(UNDEFS) $(>) $(LINKOBJS) $(LINKLIBS) $(LINKSHLIBS) $(STDLIBS) |
| 4626 |
} |
| 4627 |
|
| 4628 |
# Create DLL using export attribute |
| 4629 |
actions ShLink_ bind SHLINKOBJS SHLINKLIBS SHLINKSHLIBS |
| 4630 |
{ |
| 4631 |
$(LINK) /DLL $(SHLINKFLAGS) /out:$(<[1]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHSTDLIBS) |
| 4632 |
} |
| 4633 |
|
| 4634 |
# Create DLL using .def file |
| 4635 |
actions ShLinkDef_ bind SHLINKDEFFILE SHLINKOBJS SHLINKLIBS SHLINKSHLIBS |
| 4636 |
{ |
| 4637 |
$(LINK) /DLL /DEF:$(SHLINKDEFFILE) $(SHLINKFLAGS) /out:$(<[1]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHSTDLIBS) |
| 4638 |
} |
| 4639 |
} |
| 4640 |
else if $(NT) && $(MSVC) |
| 4641 |
{ |
| 4642 |
actions updated together piecemeal Archive |
| 4643 |
{ |
| 4644 |
$(AR) $(<) -+$(>) |
| 4645 |
} |
| 4646 |
|
| 4647 |
actions Cc_ |
| 4648 |
{ |
| 4649 |
$(CC) /c /Fo$(<) $(CCFLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4650 |
} |
| 4651 |
|
| 4652 |
actions C++_ |
| 4653 |
{ |
| 4654 |
$(C++) /c /Fo$(<) $(C++FLAGS) $(CCDEFS) $(CCHDRS) /Tp $(>) |
| 4655 |
} |
| 4656 |
|
| 4657 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4658 |
{ |
| 4659 |
$(LINK) $(LINKFLAGS) $(P_LINKFLAGS) /out:$(<) $(UNDEFS) $(>) $(LINKOBJS) $(LINKLIBS) $(LINKSHLIBS) $(STDLIBS) |
| 4660 |
} |
| 4661 |
} |
| 4662 |
else if $(NT) && $(BCCROOT) |
| 4663 |
{ |
| 4664 |
actions updated together piecemeal Archive |
| 4665 |
{ |
| 4666 |
$(AR) $(<) -+$(>) |
| 4667 |
} |
| 4668 |
|
| 4669 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4670 |
{ |
| 4671 |
$(LINK) -e$(<) $(LINKFLAGS) $(P_LINKFLAGS) $(UNDEFS) -L$(STDLIBS) $(LINKLIBS) $(LINKSHLIBS) $(>) $(LINKOBJS) |
| 4672 |
} |
| 4673 |
|
| 4674 |
actions C++_ |
| 4675 |
{ |
| 4676 |
$(C++) -c -o$(<) $(C++FLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4677 |
} |
| 4678 |
|
| 4679 |
actions Cc_ |
| 4680 |
{ |
| 4681 |
$(CC) -c -o$(<) $(CCFLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4682 |
} |
| 4683 |
} |
| 4684 |
|
| 4685 |
else if $(NT) && $(MINGW) { |
| 4686 |
|
| 4687 |
# Create DLL using export attribute |
| 4688 |
actions ShLink_ bind SHLINKOBJS SHLINKLIBS SHLINKSHLIBS |
| 4689 |
{ |
| 4690 |
$(LINK) -shared $(SHLINKFLAGS) $(LINKOUTFLAG)$(<[1]) -Wl,--out-implib,$(<[2]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHSTDLIBS) |
| 4691 |
} |
| 4692 |
# Create DLL using .def file |
| 4693 |
actions ShLinkDef_ bind SHLINKOBJS SHLINKLIBS SHLINKSHLIBS SHLINKDEFFILE |
| 4694 |
{ |
| 4695 |
$(LINK) -shared $(SHLINKFLAGS) $(LINKOUTFLAG)$(<[1]) -Wl,--out-implib,$(<[2]) $(>) $(SHLINKOBJS) $(SHLINKLIBS) $(SHLINKSHLIBS) $(SHSTDLIBS) $(SHLINKDEFFILE) |
| 4696 |
} |
| 4697 |
} |
| 4698 |
|
| 4699 |
# |
| 4700 |
# OS2 specific actions |
| 4701 |
# |
| 4702 |
|
| 4703 |
else if $(OS2) && $(WATCOM) |
| 4704 |
{ |
| 4705 |
actions together piecemeal Archive |
| 4706 |
{ |
| 4707 |
$(AR) $(<) +-$(>) |
| 4708 |
} |
| 4709 |
|
| 4710 |
actions Cc_ |
| 4711 |
{ |
| 4712 |
$(CC) /Fo=$(<) $(CCFLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4713 |
} |
| 4714 |
|
| 4715 |
actions C++_ |
| 4716 |
{ |
| 4717 |
$(C++) /Fo=$(<) $(C++FLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4718 |
} |
| 4719 |
|
| 4720 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4721 |
{ |
| 4722 |
$(LINK) $(LINKFLAGS) $(P_LINKFLAGS) /Fe=$(<) $(UNDEFS) $(>) $(LINKOBJS) $(LINKLIBS) $(LINKSHLIBS) $(STDLIBS) |
| 4723 |
} |
| 4724 |
|
| 4725 |
actions Shell_ |
| 4726 |
{ |
| 4727 |
$(CP) $(>) $(<) |
| 4728 |
} |
| 4729 |
} |
| 4730 |
|
| 4731 |
# |
| 4732 |
# VMS specific actions |
| 4733 |
# |
| 4734 |
|
| 4735 |
else if $(VMS) |
| 4736 |
{ |
| 4737 |
actions updated together piecemeal Archive |
| 4738 |
{ |
| 4739 |
lib/replace $(<) $(>[1]) ,$(>[2-]) |
| 4740 |
} |
| 4741 |
|
| 4742 |
actions Cc_ |
| 4743 |
{ |
| 4744 |
$(CC)/obj=$(<) $(CCFLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4745 |
} |
| 4746 |
|
| 4747 |
actions C++_ |
| 4748 |
{ |
| 4749 |
$(C++)/obj=$(<) $(C++FLAGS) $(CCDEFS) $(CCHDRS) $(>) |
| 4750 |
} |
| 4751 |
|
| 4752 |
actions piecemeal together existing Clean |
| 4753 |
{ |
| 4754 |
$(RM) $(>[1]);* ,$(>[2-]);* |
| 4755 |
} |
| 4756 |
|
| 4757 |
actions together quietly CreLib |
| 4758 |
{ |
| 4759 |
if f$search("$(<)") .eqs. "" then lib/create $(<) |
| 4760 |
} |
| 4761 |
|
| 4762 |
actions GenFile1 |
| 4763 |
{ |
| 4764 |
mcr $(>[1]) $(<) $(>[2-]) |
| 4765 |
} |
| 4766 |
|
| 4767 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4768 |
{ |
| 4769 |
$(LINK)/exe=$(<) $(LINKFLAGS) $(P_LINKFLAGS) $(>:J=,) ,$(LINKOBJS:J=,) ,$(LINKLIBS)/lib ,$(LINKSHLIBS)/lib ,$(STDLIBS) |
| 4770 |
} |
| 4771 |
|
| 4772 |
actions quietly updated piecemeal together RmTemps_ |
| 4773 |
{ |
| 4774 |
$(RM) $(>[1]);* ,$(>[2-]);* |
| 4775 |
} |
| 4776 |
|
| 4777 |
actions Shell_ |
| 4778 |
{ |
| 4779 |
$(CP) $(>) $(<) |
| 4780 |
} |
| 4781 |
} |
| 4782 |
|
| 4783 |
# |
| 4784 |
# Mac specifc actions |
| 4785 |
# |
| 4786 |
|
| 4787 |
else if $(MAC) |
| 4788 |
{ |
| 4789 |
actions together Archive |
| 4790 |
{ |
| 4791 |
$(LINK) -library -o $(<) $(>) |
| 4792 |
} |
| 4793 |
|
| 4794 |
actions Cc_ |
| 4795 |
{ |
| 4796 |
set -e MWCincludes $(CCHDRS) |
| 4797 |
$(CC) -o $(<) $(CCFLAGS) $(CCDEFS) $(>) |
| 4798 |
} |
| 4799 |
|
| 4800 |
actions C++_ |
| 4801 |
{ |
| 4802 |
set -e MWCincludes $(CCHDRS) |
| 4803 |
$(CC) -o $(<) $(C++FLAGS) $(CCDEFS) $(>) |
| 4804 |
} |
| 4805 |
|
| 4806 |
actions Link_ bind LINKOBJS LINKLIBS LINKSHLIBS |
| 4807 |
{ |
| 4808 |
$(LINK) -o $(<) $(LINKOBJS) $(LINKFLAGS) $(P_LINKFLAGS) $(>) $(LINKLIBS) $(LINKSHLIBS) "$(STDLIBS)" |
| 4809 |
} |
| 4810 |
} |
| 4811 |
|
| 4812 |
if $(WIN98) |
| 4813 |
{ |
| 4814 |
actions existing Clean |
| 4815 |
{ |
| 4816 |
del $(>) |
| 4817 |
} |
| 4818 |
} |
| 4819 |
|
| 4820 |
# ========================================= |
| 4821 |
|
| 4822 |
# Now do Argyll init and read default Jamtop |
| 4823 |
DoInit ; |
| 4824 |
|
| 4825 |
# |
| 4826 |
# Now include the user's Jamfile. |
| 4827 |
# |
| 4828 |
|
| 4829 |
#PeerInclude $(DOT) ; |
| 4830 |
SubInclude $(DOT) ; |
| 4831 |
|