/* * /+\ * +\ Copyright 1993, 1996 Christopher Seiwald. * \+/ * * This file is part of jam. * * License is hereby granted to use this software and distribute it * freely, as long as this copyright notice is retained and modifications * are clearly marked. * * ALL WARRANTIES ARE HEREBY DISCLAIMED. */ # include "jam.h" # include "option.h" # include "make.h" # ifdef FATFS # include "patchlev.h" # else # include "patchlevel.h" # endif /* These get various function declarations. */ # include "lists.h" # include "parse.h" # include "variable.h" # include "compile.h" # include "rules.h" # include "newstr.h" # include "scan.h" # ifdef FATFS # include "timestam.h" # else # include "timestamp.h" # endif /* Macintosh is "special" */ # ifdef macintosh # include <QuickDraw.h> # endif /* * jam.c - make redux * * See jam(1) and Jamfile(5) for usage information. * * These comments document the code. * * The top half of the code is structured such: * * jam * / | \ * +---+ | \ * / | \ * jamgram option \ * / | \ \ * / | \ \ * / | \ | * scan | compile make * | | / \ / | \ * | | / \ / | \ * | | / \ / | \ * jambase parse rules search make1 * | | \ * | | \ * | | \ * timestamp command execute * * * The support routines are called by all of the above, but themselves * are layered thus: * * variable|expand * / | | | * / | | | * / | | | * lists | | filesys * \ | | * \ | | * \ | | * newstr | * \ | * \ | * \ | * hash * * Roughly, the modules are: * * command.c - maintain lists of commands * compile.c - compile parsed jam statements * execunix.c - execute a shell script on UNIX * execvms.c - execute a shell script, ala VMS * expand.c - expand a buffer, given variable values * fileunix.c - manipulate file names and scan directories on UNIX * filevms.c - manipulate file names and scan directories on VMS * hash.c - simple in-memory hashing routines * headers.c - handle #includes in source files * jambase.c - compilable copy of Jambase * jamgram.y - jam grammar * lists.c - maintain lists of strings * make.c - bring a target up to date, once rules are in place * make1.c - execute command to bring targets up to date * newstr.c - string manipulation routines * option.c - command line option processing * parse.c - make and destroy parse trees as driven by the parser * regexp.c - Henry Spencer's regexp * rules.c - access to RULEs, TARGETs, and ACTIONs * scan.c - the jam yacc scanner * search.c - find a target along $(SEARCH) or $(LOCATE) * timestamp.c - get the timestamp of a file or archive member * variable.c - handle jam multi-element variables * * 05/04/94 (seiwald) - async multiprocess (-j) support * 02/08/95 (seiwald) - -n implies -d2. * 02/22/95 (seiwald) - -v for version info. */ struct globs globs = { 0, /* noexec */ 1, /* jobs */ # ifdef macintosh { 0, 0 }, /* debug - suppress tracing output */ # else { 0, 1 }, /* debug ... */ # endif 1 /* CWM. Always scanheaders by default */ } ; /* Symbols to be defined as true for use in Jambase */ static char *othersyms[] = { OSSYMS OSPLATSYM, JAMVERSYM, 0 } ; # ifndef __WATCOM__ # ifndef __OS2__ # ifndef NT extern char **environ; # endif # endif # endif # ifdef macintosh main( int argc, char **argv, char **environ ) # else main( argc, argv ) char **argv; # endif { int n; char *s; struct option optv[N_OPTS]; char *all = "all"; int anyhow = 0; int status; # ifdef macintosh InitGraf(&qd.thePort); # endif argc--, argv++; #ifndef OPT_HEADER_OPTION_EXT if( ( n = getoptions( argc, argv, "d:j:f:s:t:anv", optv ) ) < 0 ) #else if( ( n = getoptions( argc, argv, "d:j:f:s:t:anvp", optv ) ) < 0 ) #endif { printf( "\nusage: jam [ options ] targets...\n\n" ); printf( "\n" ); printf( "-a Build all targets, even if they are current.\n" ); printf( "-dx Set the debug level to x (0-9).\n" ); printf( "-fx Read x instead of Jambase.\n" ); printf( "-jx Run up to x shell commands concurrently.\n" ); printf( "-n Don't actually execute the updating actions.\n" ); #ifdef OPT_HEADER_OPTION_EXT printf( "-p Partial build. Disregard header timestamps in \n"); printf( " determination of what to build.\n"); #endif printf( "-sx=y Set variable x=y, overriding environment.\n" ); printf( "-tx Rebuild x, even if it is up-to-date.\n" ); printf( "-v Print the version of jam and exit.\n\n" ); printf( "\n" ); /* CWM - Added help on debug levels */ printf( "The debug levels are:\n" ); printf( " 1 - show make actions when executed\n" ); printf( " 2 - show text of actions\n" ); printf( " 3 - show progress of make. Show files when bound\n" ); printf( " 4 - show execcmds()'s work\n" ); printf( " 5 - show rule invocations\n" ); printf( " 6 - show header scan, dir scan, attempts at binding\n" ); printf( " 7 - show variable setting\n" ); printf( " 8 - show variable fetches and expansions. " "show 'if' calculations\n" ); printf( " 9 - show scanner tokens. Show memory use\n" ); #ifdef OPT_GRAPH_DEBUG_EXT printf( " 10 - dump out dependency graph before starting to build\n" ); #endif printf( "\n" ); printf( " To select individual debug levels, try: -d+n -d+n...\n" ); exit( EXITBAD ); } argc -= n, argv += n; /* Version info. */ if( ( s = getoptval( optv, 'v', 0 ) ) ) { printf( "Jam/MR " ); printf( "Version %s.%s. ", VERSION, PATCHLEVEL ); printf( "Copyright 1993, 1997 Christopher Seiwald.\n" ); return EXITOK; } /* Pick up interesting options */ if( ( s = getoptval( optv, 'n', 0 ) ) ) globs.noexec++, globs.debug[2] = 1; if( ( s = getoptval( optv, 'a', 0 ) ) ) anyhow++; #ifdef OPT_HEADER_OPTION_EXT if( ( s = getoptval( optv, 'p', 0 ) ) ) globs.scanheaders = 0; #endif if( ( s = getoptval( optv, 'j', 0 ) ) ) globs.jobs = atoi( s ); /* Turn on/off debugging */ for( n = 0; s = getoptval( optv, 'd', n ); n++ ) { int i; /* First -d, turn off defaults. */ if( !n ) for( i = 0; i < DEBUG_MAX; i++ ) globs.debug[i] = 0; i = atoi( s ); if( i < 0 || i >= DEBUG_MAX ) { printf( "Invalid debug level '%s'.\n", s ); continue; } /* n turns on levels 1-n */ /* +n turns on level n */ if( *s == '+' ) globs.debug[i] = 1; else while( i ) globs.debug[i--] = 1; } /* Set JAMDATE first */ { char *date; time_t clock; time( &clock ); date = newstr( ctime( &clock ) ); /* Trim newline from date */ if( strlen( date ) == 25 ) date[ 24 ] = 0; var_set( "JAMDATE", list_new( L0, newstr( date ) ), VAR_SET ); #ifdef OPT_TIME_STAMP_OUTPUT_EXT printf( "...starting...%s", ctime ( &clock ) ); #endif } /* load up environment variables */ var_defines( environ ); var_defines( othersyms ); /* Load up variables set on command line. */ for( n = 0; s = getoptval( optv, 's', n ); n++ ) { char *symv[2]; symv[0] = s; symv[1] = 0; var_defines( symv ); } /* Initialize builtins */ compile_builtins(); /* Parse ruleset */ for( n = 0; s = getoptval( optv, 'f', n ); n++ ) parse_file( s ); if( !n ) parse_file( "+" ); status = yyanyerrors(); /* Manually touch -t targets */ for( n = 0; s = getoptval( optv, 't', n ); n++ ) touchtarget( s ); /* Now make target */ if( !argc ) status |= make( 1, &all, anyhow ); else status |= make( argc, argv, anyhow ); /* Widely scattered cleanup */ var_done(); donerules(); donestamps(); donestr(); #ifdef OPT_TIME_STAMP_OUTPUT_EXT { time_t clock; time( &clock ); printf( "...finished...%s", ctime ( &clock ) ); } #endif return status ? EXITBAD : EXITOK; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#11 | 4110 | Craig Mcpheeters | Some of my changes from work. | ||
#10 | 3183 | Craig Mcpheeters | Integration of my jam mainline branch into my work branch. | ||
#9 | 3182 | Craig Mcpheeters | Update of my work branch. | ||
#8 | 1606 | Craig Mcpheeters |
Integration from my modified jam mainline. This is all the mainline changes into my work branch. |
||
#7 | 1605 | Craig Mcpheeters |
Updated with respect to my copy at work. A few minor updates/enhancements |
||
#6 | 1477 | Craig Mcpheeters |
Integration from my main jam branch. This is 2.4-dev with my extensions. |
||
#5 | 1191 | Craig Mcpheeters | Integration from my public branch | ||
#4 | 1188 | Craig Mcpheeters |
The latest updates from my A|W work copy. Added a -d11 debug mode, which outputs information on fate changes Create jam variables to show job (-jn) information, such as the number of jobs requested, whether or not there is more than one job, and a list of the job slot numbers. These can be used in a variety of ways in supporting multi-job builds Added jobs slot expansion to the action blocks, the sequence !! is replaced by the job slot the action is running in. Modified the special shell handling to include unix. It used to be that on Unix, you could create an action block which exceeded the size that execvp() could handle (perhaps only when the DynamicCommandSize option is enabled.) On NT, all non-default shells are invoked through a intermediate file. This modification does the same for unix shells. Improved the -d+10 debug level, the dependency graph. It now shows the flags on the node as well (NOUPDATE, NOTFILE, etc.) Only issue the '...skipped' messages for nodes which would have been built |
||
#3 | 785 | Craig Mcpheeters |
Integration from //guest/craig_mcpheeters/jam/src/... This work area now contains both the Alias|Wavefront changes, and the latest integrations from the mainline. There are some changes in this area which shouldn't be merged back into the mainline. As I merge this branch back into my jam/src/... branch, I'll leave out a few of the changes. |
||
#2 | 782 | Craig Mcpheeters |
Initial return of the Alias|Wavefront mods to jam 2.2. I made a stab at a configuration system - see the file Jamfile.config. Most of the mods are now enclosed within #ifdef blocks, which kind of pollutes the code, but may make it easier to accept or reject some of these changes. Some of these #ifdefs could disappear completely if they are accepted into the mainline This return implements the following extensions: * header cache * dynamic command block size, allowing for *large* commands * slightly improved warnings and errors * serial output from jam - nice when working with multiple jobs * an extension to variable modifiers: $(>:/) and $(>:\\) * ability to ignore header dependencies for a build (jam -p) * new debug level, -d+10, which outputs the dependency graph * added no-care support to internal nodes. if they fail, dependents are built anyway * time stamps on output * a few minor output modifications * a fix for nt batch file names conflicing when more than one jam runs at a time Each of the above can be enabled/disabled on the command line. For example, to turn on the HeaderCache code: jam -sHeaderCache=1 that is, build jam first, then use that jam to build a new one with the options you want. Some of these changes may have been made in the mainline already, my next step will be to integrate the mainline changes into these ones This return isn't yet ready for prime-time |
||
#1 | 777 | Craig Mcpheeters |
Branch of my jam/src/... area. This new area establishes the integration base for the copy of Jam which has all the changes. |
||
//guest/craig_mcpheeters/jam/src/jam.c | |||||
#2 | 617 | Craig Mcpheeters | Integration from mainline as of @3 | ||
#1 | 616 | Craig Mcpheeters | Integration from Jam mainline, as of @2 |