diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-01-18 08:28:42 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-01-18 08:28:42 +0000 |
commit | 78d6cf4886636e848550c6a27822847066f5abc9 (patch) | |
tree | 4c3a170ee71716fff11c5bc826dc950ec80145ee /dmake/dag.c | |
parent | 542497b731bcd0efbe648e482c2b41c74faad178 (diff) |
INTEGRATION: CWS dmake47 (1.7.2); FILE MERGED
2006/11/19 05:27:24 vq 1.7.2.5: #i71704# Let the global .SEQUENTIAL attribute implicitely set MAXPROCESS=1
and disallow MAXPROCESS to be changed if the global .SEQUENTIAL is set.
2006/11/12 05:06:37 vq 1.7.2.4: #i71422# Add a new feature: Using @@ as a recipe prefix redirects the
output (stdout and stderr) of a recipe to /dev/null (or NUL on W32)
completely suppressing the output of that recipe to the terminal.
As for the @ prefix this can be disabled using the -v[r] switch.
2006/10/07 18:34:49 vq 1.7.2.3: #i69742# Never normalize cells that contain a $ in the pathname.
2006/10/06 04:02:35 vq 1.7.2.2: #i69742# Don't targets with $ in the filepath as dynamic macros. ($$ means
a single $ in the filepath.)
2006/10/04 03:17:01 vq 1.7.2.1: #i69742# Enable normalization of targets and non-dynamic prerequisites.
(Dynamic prerequisites are prerequisites with not expanded macros.)
Diffstat (limited to 'dmake/dag.c')
-rw-r--r-- | dmake/dag.c | 89 |
1 files changed, 82 insertions, 7 deletions
diff --git a/dmake/dag.c b/dmake/dag.c index 09758faa923d..7cac73da6125 100644 --- a/dmake/dag.c +++ b/dmake/dag.c @@ -1,6 +1,6 @@ /* $RCSfile: dag.c,v $ --- $Revision: 1.7 $ --- last change: $Author: vg $ $Date: 2006-09-25 09:38:52 $ +-- $Revision: 1.8 $ +-- last change: $Author: vg $ $Date: 2007-01-18 09:28:42 $ -- -- SYNOPSIS -- Routines to construct the internal dag. @@ -28,6 +28,9 @@ #include "extern.h" +static char *_normalize_path(char *path); + + static void set_macro_value(hp)/* ===================== @@ -72,6 +75,14 @@ HASHPTR hp; if( Max_proc > Max_proclmt ) Fatal( "Specified # of processes exceeds limit of [%d]", Max_proclmt ); + + /* Don't change MAXPROCESS value if .SEQUENTIAL is set. */ + if( (Glob_attr & A_SEQ) && (Max_proc != 1) ) { + Warning( "Macro MAXPROCESS set to 1 because .SEQUENTIAL is set." ); + Max_proc = 1; + if( hp->ht_value != NIL(char) ) FREE(hp->ht_value); + hp->ht_value = DmStrDup( "1" ); + } } } break; @@ -81,8 +92,12 @@ HASHPTR hp; if( hp->ht_value == NIL(char) ) *hp->MV_BVAR &= ~hp->MV_MASK; - else + else { *hp->MV_BVAR |= hp->MV_MASK; + /* If we're setting .SEQUENTIAL set MAXPROCESS=1. */ + if( (hp->MV_MASK & A_SEQ) && (Max_proc != 1) ) + Def_macro( "MAXPROCESS", "1", M_MULTI|M_EXPANDED); + } break; } } @@ -372,8 +387,10 @@ int flags; /* initial ht_flags */ PUBLIC CELLPTR Def_cell( name )/* ================== - Take a string passed in and define it as a cell - If the cell exists then return a pointer to it. */ + Check if a cell for "name" already exists, if not create a new cell. + The value of name is normalized before checking/creating the cell to + avoid creating multiple cells for the same target file. + The function returns a pointer to the cell. */ char *name; { register HASHPTR hp; @@ -415,6 +432,12 @@ char *name; if( !Def_targets ) cp = lib; } else { + /* Normalize the name. */ + DB_PRINT( "path", ("Normalizing [%s]", name) ); + + /* The normalizing function returns a pointer to a static buffer. */ + name =_normalize_path(name); + hp = Get_name( name, Defs, TRUE );/* get the name from hash table */ if( hp->CP_OWNR == NIL(CELL) ) /* was it previously defined */ @@ -596,12 +619,12 @@ char *rp; { t_attr flag = A_DEFAULT; int done = FALSE; + int atcount = 0; while( !done ) switch( *rp++ ) { - case '@' : if( !(Verbose & V_FORCEECHO) ) flag |= A_SILENT; - break; + case '@' : ++atcount; break; case '-' : flag |= A_IGNORE; break; case '+' : flag |= A_SHELL; break; case '%' : flag |= A_SWAP; break; @@ -612,5 +635,57 @@ char *rp; default: done = TRUE; break; } + if( !(Verbose & V_FORCEECHO) && atcount-- ) { + flag |= A_SILENT; + /* hide output if more than one @ are encountered. */ + if( atcount ) + flag |= A_MUTE; + } + return(flag); } + + +static char * +_normalize_path(path)/* +======================= + Normalize the given path unless it contains a $ indicating a dynamic + prerequisite. + Special case: For absolute DOSish paths under cygwin a cygwin API + function is used to normalize the path optherwise Clean_path() is used. + + Note, the returned path is built in a static buffer, if it is to be used + later a copy should be created. */ + +char *path; +{ + static char *cpath = NIL(char); + + if ( !cpath && ( (cpath = MALLOC( PATH_MAX, char)) == NIL(char) ) ) + No_ram(); + + /* If there is a $ in the path this can either mean a '$' character in + * a target definition or a dynamic macro expression in a prerequisite + * list. As dynamic macro expression must not be normalized and is + * indistinguishable from a literal $ characters at this point we skip + * the normalization if a $ is found. */ + if( strchr(path, '$') ) { + return path; + } + +#if __CYGWIN__ + /* Use cygwin function to convert a DOS path to a POSIX path. */ + if( *path && path[1] == ':' && isalpha(*path) ) { + cygwin_conv_to_posix_path(path, cpath); + } + else +#endif + { + strcpy( cpath, path ); + Clean_path( cpath ); + } + + DB_PRINT( "path", ("normalized: %s", cpath )); + + return cpath; +} |