New feature: Now jam defines a variable JAM_TARGETS, which contains

the targets given on the command line (respectively "all", if none
has been given). The contents of the variable can be changed from
within the Jamrules/Jamfiles. The targets that are in JAM_TARGETS
after Jamfile parsing is done, are those that will be built (and their
dependencies, of course). This allows for interesting build system
features.


git-svn-id: file:///srv/svn/repos/haiku/buildtools/trunk@16345 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2006-02-11 01:57:34 +00:00
parent 23c3fee924
commit a1a02bed3c
2 changed files with 54 additions and 1 deletions

View File

@ -52,10 +52,14 @@ if $(OS) = NT { CCFLAGS += /DNT ; }
### LOCAL CHANGE ### LOCAL CHANGE
# #
# Include header caching. # Include:
# * header caching
# * jamfile caching
# * definition of JAM_TARGETS variable
# #
DEFINES += OPT_HEADER_CACHE_EXT ; DEFINES += OPT_HEADER_CACHE_EXT ;
DEFINES += OPT_JAMFILE_CACHE_EXT ; DEFINES += OPT_JAMFILE_CACHE_EXT ;
DEFINES += OPT_JAM_TARGETS_VARIABLE_EXT ;
# #
### LOCAL CHANGE ### LOCAL CHANGE

View File

@ -320,6 +320,26 @@ main( int argc, char **argv, char **arg_environ )
var_defines( (const char **)use_environ ); var_defines( (const char **)use_environ );
#ifdef OPT_JAM_TARGETS_VARIABLE_EXT
/* define the variable JAM_TARGETS containing the targets specified on
the command line */
{
LIST *l = L0;
int i;
char **targets = argv;
int targetCount = argc;
if (targetCount == 0) {
targets = (char**)&all;
targetCount = 1;
}
for (i = 0; i < targetCount; i++)
l = list_new( l, targets[i], 0 );
var_set( "JAM_TARGETS", l, VAR_SET );
}
#endif
/* Load up variables set on command line. */ /* Load up variables set on command line. */
for( n = 0; s = getoptval( optv, 's', n ); n++ ) for( n = 0; s = getoptval( optv, 's', n ); n++ )
@ -368,6 +388,35 @@ main( int argc, char **argv, char **arg_environ )
globs.noexec++; globs.noexec++;
} }
#ifdef OPT_JAM_TARGETS_VARIABLE_EXT
/* get value of variable JAM_TARGETS and build the targets */
{
LIST *l = var_get( "JAM_TARGETS" );
int targetCount = list_length(l);
char **targets;
int i;
if (targetCount == 0) {
/* No targets. Nothing to do. */
exit( EXITOK );
}
targets = malloc(targetCount * sizeof(char*));
if (!targets) {
printf( "Memory allocation failed!\n" );
exit( EXITBAD );
}
for (i = 0; i < targetCount; i++) {
targets[i] = (char*)l->string;
l = l->next;
}
argv = targets;
argc = targetCount;
}
#endif
/* Now make target */ /* Now make target */
if( !argc ) if( !argc )