Jamfile #37

  • //
  • guest/
  • matt_armstrong/
  • jam/
  • patched_version/
  • Jamfile
  • View
  • Commits
  • Open Download .zip Download (8 KB)
#
# Jamfile to build Jam (a make(1)-like program)
#
# There are no user-serviceable parts in this file.
#
# Put executables in platform-specific  subdirectory.

if $(VMS) 	{ LOCATE_TARGET ?= [.binvms] ; }
else if $(MAC) 	{ LOCATE_TARGET ?= :bin.mac ; }
else 		{ LOCATE_TARGET ?= bin.$(OSFULL[1]:L) ; }

if $(BUILD_J)
{
    LOCATE_TARGET = j$(LOCATE_TARGET) ;
}
# Leave generated source in current directory; it would be nice to use
# these lines below to build the source into the platform-specific
# directory, but getting scan.c to include the right jambase.h is
# hard: with ""'s, it always gets the bootstrap version; with <>'s,
# it won't find the bootstrap version.

# SEARCH_SOURCE ?= $(LOCATE_TARGET) $(DOT) ;
# LOCATE_SOURCE ?= $(LOCATE_TARGET) ;

#
# We have some different files for UNIX, VMS, and NT.
#

if $(NT) 	{ code = execunix.c filent.c pathunix.c ; } 
else if $(MINGW) { code = execunix.c filent.c pathunix.c ; } 
else if $(OS2)	{ code = execunix.c fileos2.c pathunix.c ; } 
else if $(VMS) 	{ code = execvms.c filevms.c pathvms.c ; } 
else if $(MAC)	{ code = execmac.c filemac.c pathmac.c ; }
else 		{ code = execunix.c fileunix.c pathunix.c ; }

# For jam profiling/debugging.

if $(PROFILE)
{
	CCFLAGS += -pg ;
	LINKFLAGS += -pg ;
	LOCATE_TARGET = $(LOCATE_TARGET)/pg ;
}

if $(DEBUG)
{
	if $(OS) != NT {
	    CCFLAGS += -g ;
	    LINKFLAGS += -g ;
	}
	LOCATE_TARGET = $(LOCATE_TARGET)-g ;
	OPTIM = ;
}

# We have to signal jam.h for these

if $(OS) = NT 			{ CCFLAGS += /DNT ; }

# Do we know yacc?

if $(YACC) 	{ code += jamgram.y ; }
else            { code += jamgram.c ; }

### LOCAL CHANGE
#
ALL_OPTIONS = ;

rule Option
{
    LOCAL_DEFINES += $(1) ;

    if $(2) = yes {
        local match = [ MATCH "^OPT_(.*)$" : $(1) ] ;
        if ! $(match) {
            EXIT "Invalid option $(1)" ;
        }
        local match2 = [ MATCH "^(.*)_EXT$" : $(match) ] ;
        if $(match2) {
            match = $(match2) ;
        }
        ALL_OPTIONS += $(match) ;
    }
}

rule Join1
{
    local list = $(1) ;
    local accum = $(2) ;
    if $(list) {
        return [ Join1 $(list[2-]) : "$(list[1]):$(accum)" ] ;
    } else {
        return $(accum) ;
    }
}

rule Join
{
    local list = $(1) ;
    if $(list) {
        return [ Join1 $(list[2-]) : $(list[1]) ] ;
    } else {
        return "" ;
    }
}

if $(BUILD_J)
{
    # Improvements grabbed from //guest/craig_mcpheeters/jam/src/ on the
    # Perforce public depot (some heavily modified).
    Option OPT_HEADER_CACHE_EXT ;
    Option OPT_IMPROVED_WARNINGS_EXT ;
    Option OPT_INTERRUPT_FIX ;
    Option OPT_GRAPH_DEBUG_EXT ;
    Option OPT_SERIAL_OUTPUT_EXT ;
    Option OPT_SEMAPHORE : yes ;

    # Bug Fixes
    Option OPT_FIX_TEMPFILE_CRASH ;
    Option OPT_FIX_NOTFILE_NEWESTFIRST ;
    Option OPT_FIX_NT_ARSCAN_LEAK ;
    Option OPT_FIX_UPDATED ;

    # Improvements developed locally.
    Option OPT_PIECEMEAL_PUNT_EXT ;

    # Improvements
    Option OPT_IMPROVED_MEMUSE_EXT ;
    Option OPT_IMPROVED_PATIENCE_EXT ;
    Option OPT_IMPROVED_PROGRESS_EXT ;
    Option OPT_PRINT_TOTAL_TIME_EXT ;
    Option OPT_IMPROVE_DEBUG_LEVEL_HELP_EXT ;
    Option OPT_IMPROVE_DEBUG_COMPILE_EXT ;
    Option OPT_DEBUG_MAKE_PRINT_TARGET_NAME ;
    Option OPT_DEBUG_MEM_TOTALS_EXT ;
    Option OPT_IMPROVE_JOBS_SETTING_EXT ;

    # Features
    Option OPT_PATCHED_VERSION_VAR_EXT ;
    Option OPT_HDRRULE_BOUNDNAME_ARG_EXT : yes ;
    # No longer in the source.
    # Option OPT_BUILTIN_PWD_EXT : yes ;
    Option OPT_VAR_CWD_EXT : yes ;
    Option OPT_RESPONSE_FILES : yes ;
    Option OPT_BUILTIN_MD5_EXT : yes ;
    Option OPT_DEBUG_MAKE1_LOG_EXT ;
    if $(OS) = NT
    {
	# No longer in the source.
	# Option OPT_BUILTIN_W32_GETREG_EXT : yes ;
	# Option OPT_BUILTIN_W32_SHORTNAME_EXT : yes ;
    }
    Option OPT_EXPAND_RULE_NAMES_EXT : yes ;

    local options = [ Join $(ALL_OPTIONS) ] ;
    LOCAL_DEFINES += JAM_OPTIONS=$(options) ;

    if $(OS) = NT { 
	CCFLAGS += /nologo /W3 ;
	CCFLAGS += /DNT ;
	#CCFLAGS += /D_CONSOLE /D_MBCS ;

	if $(DEBUG) {
	    CCFLAGS += /Zi /MLd /Od ;
	    LINKFLAGS += /DEBUG ;
	} else {
	    CCFLAGS += /ML /O2 ;
	}

	LINKFLAGS += /nologo /subsystem:console /machine:I386 ;

	# Reserve 5 megs for the stack.  The default of 1 meg is too
	# small for the pathalogically recursive make1c()<->make1d()
	# relationship when coupled with targets with large numbers of
	# actions (as can happen with piecemeal Clean targets).
	LINKFLAGS += /stack:5242880 ;

	LINKLIBS = kernel32.lib user32.lib gdi32.lib winspool.lib
                comdlg32.lib advapi32.lib shell32.lib ole32.lib
                oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
                kernel32.lib user32.lib gdi32.lib winspool.lib
                comdlg32.lib advapi32.lib shell32.lib ole32.lib
                oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ;

	DEFINEFLAG ?= /D ;
    }
    else if $(UNIX)
    {
	CC = gcc ;
	LINK = gcc ;
	if ! $(DEBUG) {
	    OPTIM = -O3 -fomit-frame-pointer -fstrength-reduce ;
	}
	CCFLAGS += -Wall ;
	DEFINEFLAG ?= -D ;
    }
    else
    {
	EXIT "Not configured for non-UNIX non-Windows targets" ;
    }
    if $(DEBUG) {
	CCFLAGS += $(DEFINEFLAG)DEBUG_J ;
    }
    CCFLAGS += $(DEFINEFLAG)$(LOCAL_DEFINES) ;
    CCFLAGS += $(DEFINEFLAG)YYSTACKSIZE=5000 ;
}

if $(UNIX) && $(PURE) {
    LOCATE_TARGET = $(LOCATE_TARGET)/pure ;
    CCFLAGS += $(DEFINEFLAG)PURE ;
    LINK = /usr/local/bin/purify cc ;
}
if $(NT) && $(PURE) {
    LOCATE_TARGET = $(LOCATE_TARGET)-pure ;
    CCFLAGS += $(DEFINEFLAG)PURE ;
}
#
### LOCAL CHANGE

#
# Build the jamgram.y from the jamgram.yy
# yyacc is a slippery script that makes grammars a little
# easier to read/maintain.
#

if $(YACC) && $(SUFEXE) = ""
{
	GenFile jamgram.y jamgramtab.h : yyacc jamgram.yy ;
}

### LOCAL CHANGE
# 
# These files contain locally developed improvements.
#
if $(BUILD_J)
{
    # code += pwd.c w32_getreg.c w32_shortname.c ;
    if OPT_BUILTIN_MD5_EXT in $(LOCAL_DEFINES) {
	code += md5c.c ;
    }
    if OPT_IMPROVED_PROGRESS_EXT in $(LOCAL_DEFINES) {
	code += progress.c ;
    }
    if OPT_IMPROVED_MEMUSE_EXT in $(LOCAL_DEFINES) {
	code += mempool.c ;
    }
    # code primarily not written locally, but grabbed from the net
    code += hcache.c tmpunix.c ;
}
#
### LOCAL CHANGE
#
# How to build the compiled in jambase.
#

Main		mkjambase : mkjambase.c ;

if $(VMS)
{
	CC = cxx ;
	LINK = cxxlink ;
	CCFLAGS += /define=VMS ;
}

#
# The guts of the Jamfile: how to build Jam
#

if $(BUILD_J)
{
    Main 		j : jam.c jambase-j.c ;
    LinkLibraries 	j : libjam.a ;
    GenFile 		jambase-j.c : mkjambase Jambase-j ;
}
else
{
    Main 		jam : jam.c jambase.c ;
    LinkLibraries 	jam : libjam.a ;
    GenFile 		jambase.c : mkjambase Jambase ;
}

Library         libjam.a :
		    builtins.c command.c compile.c $(code) expand.c
		    glob.c hash.c headers.c lists.c make.c make1.c
		    newstr.c option.c parse.c regexp.c rules.c scan.c
		    search.c timestamp.c variable.c ;


if $(BINDIR) 	{ InstallBin $(BINDIR) : jam ; }

#
# Distribution making from here on out.
#

ALLSOURCE =
	Build.com Build.mpw Jam.html Jambase Jambase.html Jamfile
	Jamfile.html Makefile Porting README RELNOTES builtins.c builtins.h
	command.c command.h compile.c compile.h execcmd.h execmac.c
	execunix.c execvms.c expand.c expand.h filemac.c filent.c
	fileos2.c filesys.h fileunix.c filevms.c glob.c hash.c hash.h
	headers.c headers.h jam.c jam.h jambase.c jambase.h jamgram.c
	jamgram.h jamgram.y jamgram.yy jamgramtab.h lists.c lists.h
	make.c make.h make1.c mkjambase.c newstr.c newstr.h option.c
	option.h parse.c parse.h patchlevel.h pathmac.c pathsys.h
	pathunix.c pathvms.c regexp.c regexp.h rules.c rules.h scan.c
	scan.h search.c search.h timestamp.c timestamp.h variable.c
	variable.h yyacc ;

### LOCAL CHANGE
#
ALLSOURCE += LOCAL_DIFFERENCES.txt ;
#
### LOCAL CHANGE
rule Ball
{
	NotFile balls ;
	Depends balls : $(<) ;

	DEPENDS $(<) : $(>) ;

	switch $(<) 
	{
	case *.tar : Tar $(<) : $(>) ;
	case *.shar : Shar $(<) : $(>) ;
	case *.zip : Zip $(<) : $(>) ;
	}
}

VERSION = jam-2.5rc1 ;

actions Tar
{
	ln -s . $(VERSION)
	tar cvhf $(<) $(VERSION)/$(>)
	rm $(VERSION)
}

actions Shar
{
	shar $(>) > $(<)
}

actions Zip
{
	zip $(<) $(>) 
}

Ball $(VERSION).shar : $(ALLSOURCE) ;
Ball $(VERSION).tar : $(ALLSOURCE) ;
Ball $(VERSION).zip : $(ALLSOURCE) ;
# Change User Description Committed
#37 4632 Matt Armstrong An OPT_SEMAPHORE feature stolen from Craig McPheeters.
#36 4338 Matt Armstrong Now jam will read the default -j argument from the JAM_JOBS
environment variable.
#35 4337 Matt Armstrong New -dM build flag to get make1.c debug logging.
#34 4336 Matt Armstrong Fix bug for strange make.c and RULE_UPDATED interaction.

If you have a rule with flag RULE_UPDATED, then any dependents
must have fate greater than T_FATE_STABLE to be included.

However, make.c can get confused for dependency trees like
this:

a --> b --> d
  \-> c --> d

In this case, make.c can set the fate of "d" before it ever
gets to "c".  So you will end up with a T_FATE_MISSING target
"c" with dependents with T_FATE_STABLE.

If "c" happens to have a RULE_UPDATED action, RULE_UPDATED,
make1list() will refrain from including it in the list of
targets.

We hack around this here by explicitly checking for this case
and manually tweaking the dependents fate to at least
T_FATE_NEWER.

An alternate fix is to modify make1cmds() to take a TARGET*
instead of an ACTIONS* and, when the target is T_FATE_MISSING,
have it mask off the RULE_UPDATED flag when calling
make1list().
#33 4087 Matt Armstrong Fix typo so the w32 reserved stack size actually is 5 megs.
#32 4081 Matt Armstrong bump up the stack size for w32 j.exe builds, since
the default stack size is too small to handle the
make1c <-> make1d recursion for large Clean actions
lists.
#31 4080 Matt Armstrong j -v will print whether the .exe is a debug version or not
#30 4018 Matt Armstrong Take //guest/matt_armstrong/jam/fix/2/...
changes (again).
#29 4004 Matt Armstrong Back out changes 3969, 3971, 3972 -- they didn't really fix
anything.
#28 3971 Matt Armstrong Take //guest/matt_armstrong/jam/fix/2/...
changes.
#27 3969 Matt Armstrong Integrate from //guest/matt_armstrong/jam/fix/2/...@3963 -- no
real changes.
#26 3952 Matt Armstrong OPT_FIX_CIRCULAR_INCLUDES, to fix
//guest/matt_armstrong/jam/bug/1/...
#25 3950 Matt Armstrong Integrate from //guest/matt_armstrong/jam/fix/1/...
thru change
3948 and make no changes.
#24 3685 Matt Armstrong Compile with gcc correctly.
#23 3683 Matt Armstrong Checkpoint improved memory use canges.
#22 3665 Matt Armstrong Fix debug statement logging.
 Under NT, don't compile debug
versions by default.
#21 3661 Matt Armstrong improve progress indication
#20 3656 Matt Armstrong Partial support for a -T flag that prints out more detailed
memory usage statistics.
#19 3628 Matt Armstrong Add an MD5 function to Jam.
#18 3622 Matt Armstrong Append the features present in this Jam to the
PATCHED_JAM_VERSION variable.
#17 3587 Matt Armstrong Fixups.
#16 3586 Matt Armstrong New patch level.
 Implement serial output.  Fix response file
support so it prints the contents of the response files when
the build fails.
#15 3529 Matt Armstrong DEBUG_MAKE now prints the target's name and not its bound name.
#14 3516 Matt Armstrong Steal OPT_INTERRUPT_FIX and re-steal OPT_GRAPH_DEBUG_EXT from
Craig.
#13 3446 Matt Armstrong enable response files
#12 3335 Matt Armstrong version a.e

turn off response files -- something is broken with them
#11 3327 Matt Armstrong Patchlevel a.c.

Remove OPT_IMPROVE_TEMP_FILE_DELETE_EXT since upstream has a fix.

Implement OPT_FIX_NT_ARSCAN_LEAK to fix a memory leak in the NT arscan
functions.

Get Pure builds running on NT.
#10 3324 Matt Armstrong Get DEBUG builds working on NT
#9 3323 Matt Armstrong Attempt to fix the -g bug's interaction with the "first"
pseudotarget by not sorting the children of NOTFILE targets.
#8 3317 Matt Armstrong #define PURE when compiling for Pure.
#7 2822 Matt Armstrong Initial implementation of response files.
#6 2817 Matt Armstrong Update with current known working version.
#5 2816 Matt Armstrong Integrate from mainline.
 This does not compile.
#4 2089 Matt Armstrong More integrations from upstream.
#3 2087 Matt Armstrong I think most of this is updates from stock jam.
#2 1271 Matt Armstrong This is "my" custom version of Jam.  See the
LOCAL_DIFFERENCES.txt file for a description of differences
from the upstream jam.
#1 1270 Matt Armstrong In prep for publishing all my patches to jam.
//guest/perforce_software/jam/src/Jamfile
#4 556 Perforce staff Patch release jam 2.3.2: reverse NOCARE change.
 NOCARE once
again applies to targets with source and/or actions, so that
buildable header files get built.
#3 486 Perforce staff Jam 2.3.
 See RELNOTES for a list of changes from 2.2.x.

Just about every source file was touched when jam got ANSI-fied.
#2 3 Perforce maintenance Jam/MR 2.2.1 (fix for NT handle leak)
#1 2 laura Add Jam/MR 2.2 source