📄 jambase
字号:
## /+\# +\ Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.# \+/## This file is part of Jam - see jam.c for Copyright information.### JAMBASE - jam 2.5 ruleset providing make(1)-like functionality## Supports UNIX, NT, and VMS.## 12/27/93 (seiwald) - purturb library sources with SOURCE_GRIST# 04/18/94 (seiwald) - use '?=' when setting OS specific vars# 04/21/94 (seiwald) - do RmTemps together# 05/05/94 (seiwald) - all supported C compilers support -o: relegate# RELOCATE as an option; set Ranlib to "" to disable it# 06/01/94 (seiwald) - new 'actions existing' to do existing sources# 08/25/94 (seiwald) - new ObjectCcFlags rule to append to per-target CCFLAGS# 08/29/94 (seiwald) - new ObjectHdrs rule to append to per-target HDRS# 09/19/94 (seiwald) - LinkLibraries and Undefs now append# - Rule names downshifted.# 10/06/94 (seiwald) - Dumb yyacc stuff moved into Jamfile.# 10/14/94 (seiwald) - (Crude) support for .s, .C, .cc, .cpp, and .f files.# 01/08/95 (seiwald) - Shell now handled with awk, not sed# 01/09/95 (seiwald) - Install* now take dest directory as target# 01/10/95 (seiwald) - All entries sorted.# 01/10/95 (seiwald) - NT support moved in, with LauraW's help. # 01/10/95 (seiwald) - VMS support moved in.# 02/06/95 (seiwald) - ObjectC++Flags and SubDirC++Flags added.# 02/07/95 (seiwald) - Iron out when HDRSEARCH uses "" or SEARCH_SOURCE.# 02/08/95 (seiwald) - SubDir works on VMS.# 02/14/95 (seiwald) - MkDir and entourage.# 04/30/95 (seiwald) - Use install -c flag so that it copies, not moves.# 07/10/95 (taylor) - Support for Microsoft C++.# 11/21/96 (peterk) - Support for BeOS# 07/19/99 (sickel) - Support for Mac OS X Server (and maybe client)# 02/18/00 (belmonte)- Support for Cygwin.# Special targets defined in this file:## all - parent of first, shell, files, lib, exe# first - first dependent of 'all', for potential initialization# shell - parent of all Shell targets # files - parent of all File targets# lib - parent of all Library targets# exe - parent of all Main targets# dirs - parent of all MkDir targets# clean - removes all Shell, File, Library, and Main targets# uninstall - removes all Install targets# # Rules defined by this file:## as obj.o : source.s ; .s -> .o# Bulk dir : files ; populate directory with many files# Cc obj.o : source.c ; .c -> .o# C++ obj.o : source.cc ; .cc -> .o# Clean clean : sources ; remove sources with 'jam clean'# File dest : source ; copy file# Fortran obj.o : source.f ; .f -> .o# GenFile source.c : program args ; make custom file# HardLink target : source ; make link from source to target# HdrRule source : headers ; handle #includes# InstallInto dir : sources ; install any files# InstallBin dir : sources ; install binaries# InstallLib dir : sources ; install files# InstallFile dir : sources ; install files# InstallMan dir : sources ; install man pages# InstallShell dir : sources ; install shell scripts# Lex source.c : source.l ; .l -> .c# Library lib : source ; archive library from compiled sources# LibraryFromObjects lib : objects ; archive library from objects# LinkLibraries images : libraries ; bag libraries onto Mains# Main image : source ; link executable from compiled sources# MainFromObjects image : objects ; link executable from objects# MkDir dir ; make a directory, if not there# Object object : source ; compile object from source# ObjectCcFlags source : flags ; add compiler flags for object# ObjectC++Flags source : flags ; add compiler flags for object# ObjectHdrs source : dirs ; add include directories for object# Objects sources ; compile sources# RmTemps target : sources ; remove temp sources after target made# Setuid images ; mark executables Setuid# SoftLink target : source ; make symlink from source to target# SubDir TOP d1 d2 ... ; start a subdirectory Jamfile# SubDirCcFlags flags ; add compiler flags until next SubDir# SubDirC++Flags flags ; add compiler flags until next SubDir# SubDirHdrs d1 d2 ... ; add include dir until next SubDir# SubInclude TOP d1 d2 ... ; include a subdirectory Jamfile# Shell exe : source ; make a shell executable# Undefines images : symbols ; save undef's for linking# UserObject object : source ; handle unknown suffixes for Object# Yacc source.c : source.y ; .y -> .c## Utility rules that have no side effects (not supported):## FAppendSuffix f1 f2 ... : $(SUF) ; return $(<) with suffixes# FDirName d1 d2 ... ; return path from root to dir# FGrist d1 d2 ... ; return d1!d2!...# FGristFiles value ; return $(value:G=$(SOURCE_GRIST))# FGristSourceFiles value ; return $(value:G=$(SOURCE_GRIST))# FStripCommon v1 : v2 ; strip common initial parts of v1 v2# FReverse a1 a2 ... ; return ... a2 a1 # FRelPath d1 : d2 ; return rel path from d1 to d2# FSubDir d1 d2 ... ; return path to root## Brief review of the jam language:## Statements:# rule RULE - statements to process a rule# actions RULE - system commands to carry out target update## Modifiers on actions:# together - multiple instances of same rule on target get executed# once with their sources ($(>)) concatenated# updated - refers to updated sources ($(>)) only# ignore - ignore return status of command# quietly - don't trace its execution unless verbose# piecemeal - iterate command each time with a small subset of $(>)# existing - refers to currently existing sources ($(>)) only# bind vars - subject to binding before expanding in actions## Special rules:# Always - always build a target# Depends - builds the dependency graph# Echo - blurt out targets on stdout# Exit - blurt out targets and exit# Includes - marks sources as headers for target (a codependency)# NoCare - don't panic if the target can't be built# NoUpdate - create the target if needed but never update it # NotFile - ignore the timestamp of the target (it's not a file)# Temporary - target need not be present if sources haven't changed## Special variables set by jam:# $(<) - targets of a rule (to the left of the :)# $(>) - sources of a rule (to the right of the :)# $(xxx) - true on xxx (UNIX, VMS, NT, OS2, MAC)# $(OS) - name of OS - varies wildly# $(JAMVERSION) - version number (2.5)## Special variables used by jam:# SEARCH - where to find something (used during binding and actions)# LOCATE - where to plop something not found with SEARCH# HDRRULE - rule to call to handle include files# HDRSCAN - egrep regex to extract include files## Special targets:# all - default if none given on command line## for perforce use -- jambase versionJAMBASEDATE = 2002.05.09 ;# Initialize variables### OS specific variable settings#if $(NT){ MV ?= move /y ; CP ?= copy ; RM ?= del /f/q ; RMDIR ?= rmdir /s/q ; SLASH ?= \\ ; SUFLIB ?= .lib ; SUFOBJ ?= .obj ; SUFEXE ?= .exe ; if $(BCCROOT) { AR ?= tlib /C /P64 ; CC ?= bcc32 ; CCFLAGS ?= -v -w- -q -DWIN -tWR -tWM -tWC ; C++ ?= $(CC) ; C++FLAGS ?= $(CCFLAGS) -P ; LINK ?= $(CC) ; LINKFLAGS ?= $(CCFLAGS) ; STDLIBPATH ?= $(BCCROOT)\\lib ; STDHDRS ?= $(BCCROOT)\\include ; NOARSCAN ?= true ; } else if $(MSVC) { AR ?= lib /nologo ; CC ?= cl /nologo ; CCFLAGS ?= /D \"WIN\" ; C++ ?= $(CC) ; C++FLAGS ?= $(CCFLAGS) ; LINK ?= $(CC) ; LINKFLAGS ?= $(CCFLAGS) ; LINKLIBS ?= $(MSVC)\\lib\\mlibce.lib $(MSVC)\\lib\\oldnames.lib ; LINKLIBS ?= ; NOARSCAN ?= true ; OPTIM ?= ; STDHDRS ?= $(MSVC)\\include ; UNDEFFLAG ?= "/u _" ; } else if $(MSVCNT) || $(MSVCDIR) { # Visual C++ 6.0 uses MSVCDIR MSVCNT ?= $(MSVCDIR) ; # bury IA64 in the path for the SDK local I ; if $(OSPLAT) = IA64 { I = ia64\\ ; } else { I = "" ; } AR ?= lib ; AS ?= masm386 ; CC ?= cl /nologo ; CCFLAGS ?= "" ; C++ ?= $(CC) ; C++FLAGS ?= $(CCFLAGS) ; LINK ?= link /nologo ; LINKFLAGS ?= "" ; LINKLIBS ?= $(MSVCNT)\\lib\\$(I)libc.lib $(MSVCNT)\\lib\\$(I)oldnames.lib $(MSVCNT)\\lib\\$(I)kernel32.lib ; OPTIM ?= "" ; STDHDRS ?= $(MSVCNT)\\include ; UNDEFFLAG ?= "/u _" ; } else { EXIT On NT, set BCCROOT, MSVCDIR, MSVCNT, or MSVC to the root of the Borland or Microsoft directories. ; }}else if $(MINGW){ Echo "MingW32" ; CC ?= gcc ; C++ ?= g++ ; CCFLAGS += -DMINGW ; RANLIB ?= "ranlib" ; SUFEXE ?= .exe ;}else if $(OS2){ WATCOM ?= $(watcom) ; if ! $(WATCOM) { Exit On OS2, set WATCOM to the root of the Watcom directory. ; } AR ?= wlib ; BINDIR ?= \\os2\\apps ; CC ?= wcc386 ; CCFLAGS ?= /zq /DOS2 /I$(WATCOM)\\h ; # zq=quiet C++ ?= wpp386 ; C++FLAGS ?= $(CCFLAGS) ; CP ?= copy ; DOT ?= . ; DOTDOT ?= .. ; LINK ?= wcl386 ; LINKFLAGS ?= /zq ; # zq=quiet LINKLIBS ?= ; MV ?= move ; NOARSCAN ?= true ; OPTIM ?= ; RM ?= del /f ; SLASH ?= \\ ; STDHDRS ?= $(WATCOM)\\h ; SUFEXE ?= .exe ; SUFLIB ?= .lib ; SUFOBJ ?= .obj ; UNDEFFLAG ?= "/u _" ;}else if $(VMS){ C++ ?= cxx ; C++FLAGS ?= ; CC ?= cc ; CCFLAGS ?= ; CHMOD ?= set file/prot= ; CP ?= copy/replace ; CRELIB ?= true ; DOT ?= [] ; DOTDOT ?= [-] ; EXEMODE ?= (w:e) ; FILEMODE ?= (w:r) ; HDRS ?= ; LINK ?= link ; LINKFLAGS ?= "" ; LINKLIBS ?= ; MKDIR ?= create/dir ; MV ?= rename ; OPTIM ?= "" ; RM ?= delete ; RUNVMS ?= mcr ; SHELLMODE ?= (w:er) ; SLASH ?= . ; STDHDRS ?= decc$library_include ; SUFEXE ?= .exe ; SUFLIB ?= .olb ; SUFOBJ ?= .obj ; switch $(OS) { case OPENVMS : CCFLAGS ?= /stand=vaxc ; case VMS : LINKLIBS ?= sys$library:vaxcrtl.olb/lib ; }}else if $(MAC){ local OPT ; CW ?= "{CW}" ; MACHDRS ?= "$(UMACHDRS):Universal:Interfaces:CIncludes" "$(CW):MSL:MSL_C:MSL_Common:Include" "$(CW):MSL:MSL_C:MSL_MacOS:Include" ; MACLIBS ?= "$(CW):MacOS Support:Universal:Libraries:StubLibraries:Interfacelib" "$(CW):MacOS Support:Universal:Libraries:StubLibraries:Mathlib" ; MPWLIBS ?= "$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_MPWCRuntime_PPC.lib" "$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC_MPW.Lib" ; MPWNLLIBS ?= "$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_MPWCRuntime_PPC.lib" "$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC_MPW(NL).Lib" ; SIOUXHDRS ?= ; SIOUXLIBS ?= "$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_Runtime_PPC.lib" "$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_SIOUX_PPC.Lib" "$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC.Lib" ; C++ ?= mwcppc ; C++FLAGS ?= -w off ; CC ?= mwcppc ; CCFLAGS ?= -w off ; CP ?= duplicate -y ; DOT ?= ":" ; DOTDOT ?= "::" ; HDRS ?= $(MACHDRS) $(MPWHDRS) ; LINK ?= mwlinkppc ; LINKFLAGS ?= -mpwtool -warn ; LINKLIBS ?= $(MACLIBS) $(MPWLIBS) ; MKDIR ?= newfolder ; MV ?= rename -y ; NOARSCAN ?= true ; OPTIM ?= ; RM ?= delete -y ; SLASH ?= ":" ; STDHDRS ?= ; SUFLIB ?= .lib ; SUFOBJ ?= .o ;}else if $(OS) = BEOS && $(OSPLAT) = PPC{ AR ?= mwld -xml -o ; BINDIR ?= /boot/home/config/bin ; CC ?= mwcc ; CCFLAGS ?= -nosyspath ; C++ ?= $(CC) ; C++FLAGS ?= -nosyspath ; CHMOD ?= chmod ; CHGRP ?= chgrp ; CHOWN ?= chown ; FORTRAN ?= "" ; LEX ?= flex ; LIBDIR ?= /boot/home/config/lib ; LINK ?= mwld ; LINKFLAGS ?= "" ; MANDIR ?= /boot/home/config/man ; NOARSCAN ?= true ; RANLIB ?= ranlib ; STDHDRS ?= /boot/develop/headers/posix ; YACC ?= bison -y ; YACCGEN ?= .c ; YACCFILES ?= y.tab ; YACCFLAGS ?= -d ;}else if $(OS) = BEOS { BINDIR ?= /boot/home/config/bin ; CC ?= gcc ; C++ ?= $(CC) ; CHMOD ?= chmod ; CHGRP ?= chgrp ; CHOWN ?= chown ; FORTRAN ?= "" ; LEX ?= flex ; LIBDIR ?= /boot/home/config/lib ; LINK ?= gcc ; MANDIR ?= /boot/home/config/man ; NOARSCAN ?= true ; RANLIB ?= ranlib ; STDHDRS ?= /boot/develop/headers/posix ; YACC ?= bison -y ; YACCGEN ?= .c ; YACCFILES ?= y.tab ; YACCFLAGS ?= -d ;}else if $(UNIX){ switch $(OS) { case AIX : LINKLIBS ?= -lbsd ; case AMIGA : CC ?= gcc ; YACC ?= bison -y ; case CYGWIN : CC ?= gcc ; CCFLAGS += -D__cygwin__ ; LEX ?= flex ; JAMSHELL ?= sh -c ; RANLIB ?= "" ; SUFEXE ?= .exe ; YACC ?= bison -y ; case DGUX : RANLIB ?= "" ; RELOCATE ?= true ; case HPUX : RANLIB ?= "" ; case INTERIX : CC ?= gcc ; JAMSHELL ?= sh -c ; RANLIB ?= "" ; case IRIX : RANLIB ?= "" ; case MPEIX : CC ?= gcc ; C++ ?= gcc ; CCFLAGS += -D_POSIX_SOURCE ; HDRS += /usr/include ; RANLIB ?= "" ; NOARSCAN ?= true ; NOARUPDATE ?= true ; case MVS : RANLIB ?= "" ; case NEXT : AR ?= libtool -o ; RANLIB ?= "" ; case MACOSX : C++ ?= c++ ; MANDIR ?= /usr/local/share/man ; case NCR : RANLIB ?= "" ; case PTX : RANLIB ?= "" ; case QNX : AR ?= wlib ; CC ?= cc ; CCFLAGS ?= -Q ; # quiet C++ ?= $(CC) ; C++FLAGS ?= -Q ; # quiet LINK ?= $(CC) ; LINKFLAGS ?= -Q ; # quiet NOARSCAN ?= true ; RANLIB ?= "" ; case SCO : RANLIB ?= "" ; RELOCATE ?= true ; case SINIX : RANLIB ?= "" ; case SOLARIS : RANLIB ?= "" ; AR ?= "/usr/ccs/bin/ar ru" ; case UNICOS : NOARSCAN ?= true ; OPTIM ?= -O0 ; case UNIXWARE : RANLIB ?= "" ; RELOCATE ?= true ; } # UNIX defaults CCFLAGS ?= ; C++FLAGS ?= $(CCFLAGS) ; CHMOD ?= chmod ; CHGRP ?= chgrp ; CHOWN ?= chown ; LEX ?= lex ; LINKFLAGS ?= $(CCFLAGS) ; LINKLIBS ?= ; OPTIM ?= -O ; RANLIB ?= ranlib ; YACC ?= yacc ; YACCGEN ?= .c ; YACCFILES ?= y.tab ; YACCFLAGS ?= -d ;}## General defaults; a lot like UNIX# AR ?= ar ru ; AS ?= as ; ASFLAGS ?= ; AWK ?= awk ; BINDIR ?= /usr/local/bin ; C++ ?= cc ; C++FLAGS ?= ; CC ?= cc ; CCFLAGS ?= ; CP ?= cp -f ; CRELIB ?= ; DOT ?= . ; DOTDOT ?= .. ; EXEMODE ?= 711 ; FILEMODE ?= 644 ; FORTRAN ?= f77 ; FORTRANFLAGS ?= ; HDRS ?= ; INSTALLGRIST ?= installed ; JAMFILE ?= Jamfile ; JAMRULES ?= Jamrules ; LEX ?= ; LIBDIR ?= /usr/local/lib ; LINK ?= $(CC) ; LINKFLAGS ?= ; LINKLIBS ?= ; LN ?= ln ; MANDIR ?= /usr/local/man ; MKDIR ?= mkdir ; MV ?= mv -f ; OPTIM ?= ; RCP ?= rcp ; RM ?= rm -f ; RMDIR ?= $(RM) ; RSH ?= rsh ; SED ?= sed ; SHELLHEADER ?= "#!/bin/sh" ; SHELLMODE ?= 755 ; SLASH ?= / ; STDHDRS ?= /usr/include ; SUBDIRRULES ?= ; SUBDIRRESET ?= ASFLAGS HDRS C++FLAGS CCFLAGS ; SUFEXE ?= "" ; SUFLIB ?= .a ; SUFOBJ ?= .o ; UNDEFFLAG ?= "-u _" ; YACC ?= ; YACCGEN ?= ; YACCFILES ?= ; YACCFLAGS ?= ; HDRPATTERN = "^[ ]*#[ ]*include[ ]*[<\"]([^\">]*)[\">].*$" ; OSFULL = $(OS)$(OSVER)$(OSPLAT) $(OS)$(OSPLAT) $(OS)$(OSVER) $(OS) ;## Base dependencies - first for "bootstrap" kinds of rules#Depends all : shell files lib exe obj ;Depends all shell files lib exe obj : first ;NotFile all first shell files lib exe obj dirs clean uninstall ;Always clean uninstall ;## Rules#rule As{ Depends $(<) : $(>) ; ASFLAGS on $(<) += $(ASFLAGS) $(SUBDIRASFLAGS) ; ASHDRS on $(<) = [ FIncludes $(SEARCH_SOURCE) $(SUBDIRHDRS) $(HDRS) ] ;}rule Bulk{ local i ; for i in $(>) { File $(i:D=$(<)) : $(i) ; }}rule Cc{ Depends $(<) : $(>) ; # If the compiler's -o flag doesn't work, relocate the .o if $(RELOCATE) { CcMv $(<) : $(>) ; } # Just to clarify here: this sets the per-target CCFLAGS to # be the current value of (global) CCFLAGS and SUBDIRCCFLAGS. # CCHDRS and CCDEFS must be reformatted each time for some # compiles (VMS, NT) that malign multiple -D or -I flags. CCFLAGS on $(<) += $(CCFLAGS) $(SUBDIRCCFLAGS) $(OPTIM) ; CCHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ; CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;}rule C++{ Depends $(<) : $(>) ; if $(RELOCATE) { CcMv $(<) : $(>) ; } C++FLAGS on $(<) += $(C++FLAGS) $(SUBDIRC++FLAGS) $(OPTIM) ; CCHDRS on $(<) = [ on $(<) FIncludes $(HDRS) ] ; CCDEFS on $(<) = [ on $(<) FDefines $(DEFINES) ] ;}rule Chmod{ if $(CHMOD) { Chmod1 $(<) ; }}rule File{ Depends files : $(<) ; Depends $(<) : $(>) ; SEARCH on $(>) = $(SEARCH_SOURCE) ; MODE on $(<) = $(FILEMODE) ; Chmod $(<) ;}rule Fortran{ Depends $(<) : $(>) ;}rule GenFile { local _t = [ FGristSourceFiles $(<) ] ; local _s = [ FAppendSuffix $(>[1]) : $(SUFEXE) ] ; Depends $(_t) : $(_s) $(>[2-]) ; GenFile1 $(_t) : $(_s) $(>[2-]) ; Clean clean : $(_t) ;}rule GenFile1{ MakeLocate $(<) : $(LOCATE_SOURCE) ; SEARCH on $(>) = $(SEARCH_SOURCE) ;}rule HardLink{ Depends files : $(<) ; Depends $(<) : $(>) ; SEARCH on $(>) = $(SEARCH_SOURCE) ;}rule HdrRule{ # HdrRule source : headers ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -