mirror of
https://review.haiku-os.org/buildtools
synced 2024-11-23 15:29:11 +01:00
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:
parent
23c3fee924
commit
a1a02bed3c
@ -52,10 +52,14 @@ if $(OS) = NT { CCFLAGS += /DNT ; }
|
||||
|
||||
### LOCAL CHANGE
|
||||
#
|
||||
# Include header caching.
|
||||
# Include:
|
||||
# * header caching
|
||||
# * jamfile caching
|
||||
# * definition of JAM_TARGETS variable
|
||||
#
|
||||
DEFINES += OPT_HEADER_CACHE_EXT ;
|
||||
DEFINES += OPT_JAMFILE_CACHE_EXT ;
|
||||
DEFINES += OPT_JAM_TARGETS_VARIABLE_EXT ;
|
||||
#
|
||||
### LOCAL CHANGE
|
||||
|
||||
|
49
jam/jam.c
49
jam/jam.c
@ -320,6 +320,26 @@ main( int argc, char **argv, char **arg_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. */
|
||||
|
||||
for( n = 0; s = getoptval( optv, 's', n ); n++ )
|
||||
@ -368,6 +388,35 @@ main( int argc, char **argv, char **arg_environ )
|
||||
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 */
|
||||
|
||||
if( !argc )
|
||||
|
Loading…
Reference in New Issue
Block a user