From a14fc5dc1d2b9e8dcd13030e20510b29a23f4f9e Mon Sep 17 00:00:00 2001 From: ketmar Date: Tue, 30 Jun 2009 11:02:54 +0300 Subject: [PATCH] version upgraded; added JAM_TARGET and fixed JAMCMDARGS vars --- BuildSlackPkg | 2 +- Jambase | 4 +-- Jamdopkg | 2 +- Jamfile | 2 +- doc/ChangeLog | 3 +++ jam.c | 74 ++++++++++++++++++++++++++++++++++++++++++++--------- patchlevel.h | 4 +-- target_test/Jamfile | 19 ++++++++++++++ 8 files changed, 91 insertions(+), 19 deletions(-) create mode 100644 target_test/Jamfile diff --git a/BuildSlackPkg b/BuildSlackPkg index 1108042..5b876ec 100755 --- a/BuildSlackPkg +++ b/BuildSlackPkg @@ -3,7 +3,7 @@ # SlackBuild by gallows ~at~ tiscali ~dot~ it NAME=k8jam -VERSION=2.5.4 +VERSION=2.5.5 ARCH=i686 BUILD=1k8 #TMP=./tmp diff --git a/Jambase b/Jambase index 59df2c5..077647e 100644 --- a/Jambase +++ b/Jambase @@ -172,8 +172,8 @@ JAMBASEDATE = 2004.10.07 ; -THIS_IS_KJAM = "tan" ; # we are using kjam -THIS_IS_K8JAM = "tan" ; # we are using kjam +#THIS_IS_KJAM = "tan" ; # we are using kjam; removed as obsolete +THIS_IS_K8JAM = "tan" ; # we are using k8jam # set to 'tan' for old 'libtool' behavior K8_USE_LIBTOOL = ; diff --git a/Jamdopkg b/Jamdopkg index a08b64c..01685c5 100644 --- a/Jamdopkg +++ b/Jamdopkg @@ -66,7 +66,7 @@ rule Package } -VERSION = kjam-2.5.2 ; +VERSION = kjam-2.5.5 ; actions Tar-Gz { diff --git a/Jamfile b/Jamfile index 0156b3b..5b6be62 100644 --- a/Jamfile +++ b/Jamfile @@ -4,7 +4,7 @@ # There are no user-serviceable parts in this file. # # Put executables in platform-specific subdirectory. -VERSION = kjam-2.5.4 ; +VERSION = k8jam-2.5.5 ; include Jamrules ; diff --git a/doc/ChangeLog b/doc/ChangeLog index 71edc98..763f7e4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -80,3 +80,6 @@ ALL_LOCATE_LIBSO = $(TOP)/build/libso ; ALL_LOCATE_BIN = $(TOP)/build ; and have a nice bunch of files in various dirs. + + [*] JAMCMDARGS now set before parsing Jamfiles (and what sense was to set it after? %-) + [+] JAM_TARGETS variable added; scripts are free to modify it, so we can easy define targets from whithin diff --git a/jam.c b/jam.c index e926e86..9768efb 100644 --- a/jam.c +++ b/jam.c @@ -177,9 +177,9 @@ int main (int argc, char **argv, char **arg_environ) { int anyhow = 0; int status; -# ifdef OS_MAC +#ifdef OS_MAC InitGraf(&qd.thePort); -# endif +#endif argc--, argv++; if ((num_targets = getoptions(argc, argv, "d:j:f:gs:t:ano:qv", optv, targets)) < 0) { @@ -202,9 +202,9 @@ int main (int argc, char **argv, char **arg_environ) { /* Version info. */ if ((s = getoptval(optv, 'v', 0))) { - printf( "K-Jam %s. %s. ", VERSION, OSMINOR ); + printf( "K8-Jam %s. %s. ", VERSION, OSMINOR ); printf( "(C) 1993-2003 Christopher Seiwald, see www.freetype.org/jam/\n" ); - printf( "changed by Ketmar, ketmar@ua.fm\n" ); + printf( "changes by Ketmar, psyc://ketmar.no-ip.org/~ketmar\n" ); return EXITOK; } @@ -264,7 +264,7 @@ int main (int argc, char **argv, char **arg_environ) { { struct utsname u; - if (uname( &u ) >= 0) { + if (uname(&u) >= 0) { LIST *l = L0; l = list_new(l, u.machine, 0); l = list_new(l, u.version, 0); @@ -282,14 +282,33 @@ int main (int argc, char **argv, char **arg_environ) { var_defines(othersyms); /* load up environment variables */ var_defines((const char **)use_environ); + /* Load up variables set on command line. */ - for (n = 0; (s = getoptval( optv, 's', n )) != 0; n++) { + for (n = 0; (s = getoptval(optv, 's', n)) != 0; n++) { const char *symv[2]; symv[0] = s; symv[1] = 0; var_defines(symv); } + /* Add JAMCMDARGS */ + { + LIST *l0 = L0, *l1 = L0; + + if (num_targets < 1) { + l0 = list_new(l0, "all", 0); + l1 = list_new(l1, "all", 0); + } else { + for (n = 0; n < num_targets; n++) { + /*printf("target %i: %s\n", n, targets[n]);*/ + l0 = list_new(l0, targets[n], 0); + l1 = list_new(l1, targets[n], 0); + } + } + var_set("JAMCMDARGS", l0, VAR_SET); + var_set("JAM_TARGETS", l1, VAR_SET); /* k8 */ + } + /* Initialize built-in rules */ load_builtins(); @@ -305,19 +324,50 @@ int main (int argc, char **argv, char **arg_environ) { /* If an output file is specified, set globs.cmdout to that */ if ((s = getoptval(optv, 'o', 0)) != 0) { if (!(globs.cmdout = fopen(s, "w"))) { - printf( "Failed to write to '%s'\n", s ); + printf("Failed to write to '%s'\n", s); exit(EXITBAD); } globs.noexec++; } - /* Add JAMCMDARGS */ +#ifndef NO_OPT_JAM_TARGETS_VARIABLE_EXT + /* ported from Haiku */ + /* get value of variable JAM_TARGETS and build the targets */ { - LIST *l = L0; + LIST *l = var_get("JAM_TARGETS"); + int targetCount = list_length(l); + int i; + + if (targetCount == 0) { + /* No targets. Nothing to do. */ + printf("No targets. Nothing to do.\n"); + exit(EXITOK); + } - for (n = 0; n < num_targets; n++) l = list_new(l, targets[n], 0); - var_set("JAMCMDARGS", l, VAR_SET); - } + if (targetCount >= N_TARGETS) { + printf("ERROR: Too many targets!\n"); + exit(EXITBAD); + } + + for (i = 0; i < targetCount; i++) { + const char *s0 = l->string; + targets[i] = malloc((strlen(s0)+1)*sizeof(char)); + if (!targets[i]) { + printf("ERROR: Out of memory!\n"); + exit(EXITBAD); + } + strcpy(targets[i], s0); + l = l->next; + } + num_targets = targetCount; +/* + printf("new targets:\n"); + for (i = 0; i < num_targets; i++) { + printf("target %i: %s\n", i, targets[i]); + } +*/ + } +#endif /* Now make target */ if (!num_targets) status |= make(1, &all, anyhow); diff --git a/patchlevel.h b/patchlevel.h index 678d10d..8965f29 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1,5 +1,5 @@ /* Keep JAMVERSYM in sync with VERSION. */ /* It can be accessed as $(JAMVERSION) in the Jamfile. */ -#define VERSION "2.5.4" -#define JAMVERSYM "JAMVERSION=2.5.4" +#define VERSION "2.5.5" +#define JAMVERSYM "JAMVERSION=2.5.5" diff --git a/target_test/Jamfile b/target_test/Jamfile new file mode 100644 index 0000000..be3c940 --- /dev/null +++ b/target_test/Jamfile @@ -0,0 +1,19 @@ +Echo "OS:" "$(OS)" ; +Echo "DATE:" "$(JAMDATE)" ; +Echo "UNAME:" "$(JAMUNAME)" ; +if $(JAMUNAME) { + Echo "machine:" "$(JAMUNAME[1])" ; + Echo "version:" "$(JAMUNAME[2])" ; + Echo "release:" "$(JAMUNAME[3])" ; + Echo "nodename:" "$(JAMUNAME[4])" ; + Echo "sysname:" "$(JAMUNAME[5])" ; +} + +if $(JAMCMDARGS) { + Echo "cmdargs:" "$(JAMCMDARGS)" ; + Echo "targets:" "$(JAM_TARGETS)" ; +} else { + Echo "cmdargs: none" ; +} + +JAM_TARGETS += test ; -- 2.11.4.GIT