summaryrefslogtreecommitdiff
path: root/dmake/dmake.c
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2006-04-20 10:59:05 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2006-04-20 10:59:05 +0000
commitd1aa7369b60360dd2b49960c1c76524ec5939bce (patch)
tree69c9c4feca596b3eb9ace237ce2638982640c60e /dmake/dmake.c
parent6e87466b32f545a885a4ba31fecde90931c2e8ce (diff)
INTEGRATION: CWS dmake43p01 (1.5.2); FILE MERGED
2006/02/26 23:33:37 vq 1.5.2.11: #i62118# Fix invalid detection of circular dependencies arising from F_VISITED and F_USED both having the same value but being used in different contexts. 2006/02/02 04:50:08 vq 1.5.2.10: #i47919# Fix typo. 2006/02/02 04:39:55 vq 1.5.2.9: #i47919# Use the correct handler function for the signal() handling. 2006/02/01 23:28:54 vq 1.5.2.8: #i60948# Add -m option family to generate timing information for targets and/or recipes. (Autotools files were regenerated.) 2005/09/05 20:56:44 vq 1.5.2.7: #i53148# Move redirection of stdout from parent to child and avoid capturing spurious output from other process queues. 2005/09/05 17:23:44 vq 1.5.2.6: #i53148# Additional patch to make sure that the shell escapes is executed after all previous recipe lines from the same target have finished. 2005/09/04 19:38:14 vq 1.5.2.5: #i53148# Fix $(shell ...) handling for parallel builds with MAXPROCESS > 1. This certainly includes the -P# switch with # > 1. 2005/05/05 21:45:39 vq 1.5.2.4: Issue number: 38830 Submitted by: waratah@openoffice.org Change dmake's diagnosic output to use "Warning:" or "Error:". Adding the colon makes it easier grep for these diagnostics in long logfiles. 2005/04/22 01:04:35 vq 1.5.2.3: #i47851# Increase the version number to 4.4-cvs and slightly rearrange the output of "dmake -V". Remove the hardcoded (in autotools builds) OS macro. It had the wrong value to be usable with the startup/*.mk and is not mentioned in the man page. Clean up configure.in and friends. 2005/04/11 03:28:54 vq 1.5.2.2: #i43252# Introduce the macro ABSMAKECMD that's value for a native Windows dmake executable (compiled with MS Visual C++ or MinGW) is the absolute filename and NULL for other operating systems or dmake build with other compilers. If DMAKEROOT is not changed and only for native Windows dmake versions the value of DMAKEROOT now defaults to "$(ABSMAKECMD:d)startup". 2005/04/09 21:22:30 vq 1.5.2.1: #i43254# Make the usage of DMAKEROOT consistent with the man page for all OSs. This includes the removal of "SOLARVER UPD INPATH OS UPDMINOREXT" from the list of macros that are always imported from the environment. Patch inspired in part by shay@openoffice.org.
Diffstat (limited to 'dmake/dmake.c')
-rw-r--r--dmake/dmake.c83
1 files changed, 58 insertions, 25 deletions
diff --git a/dmake/dmake.c b/dmake/dmake.c
index f337be7541f8..4a957ff8c08c 100644
--- a/dmake/dmake.c
+++ b/dmake/dmake.c
@@ -1,6 +1,6 @@
/* $RCSfile: dmake.c,v $
--- $Revision: 1.5 $
--- last change: $Author: rt $ $Date: 2004-10-22 08:04:42 $
+-- $Revision: 1.6 $
+-- last change: $Author: hr $ $Date: 2006-04-20 11:59:05 $
--
-- SYNOPSIS
-- The main program.
@@ -17,7 +17,8 @@
-- -C file - duplicate console output to file (MSDOS only)
-- -K file - .KEEP_STATE file
-- -#dbug_string - dump out debugging info, see below
--- -v{cdfimrtw} - verbose, print what we are doing, as we do it.
+-- -v[cdfimrtw] - verbose, print what we are doing, as we do it
+-- -m[trae] - measure timing information
--
-- options: (can be catenated, ie -irn == -i -r -n)
--
@@ -84,12 +85,12 @@
#define USAGE \
"Usage:\n%s [-P#] [-{f|K} file] [-{w|W} target ...] [macro[!][[*][+][:]]=value ...]\n"
#define USAGE2 \
-"%s [-v{cdfimrtw}] [-ABcdeEghiknpqrsStTuVxX] [target ...]\n"
+"%s [-v[cdfimrtw]] [-m[trae]] [-ABcdeEghiknpqrsStTuVxX] [target ...]\n"
#else
#define USAGE \
"Usage:\n%s [-P#] [-{f|C|K} file] [-{w|W} target ...] [macro[!][[*][+][:]]=value ...]\n"
#define USAGE2 \
-"%s [-v{cdfimrtw}] [-ABcdeEghiknpqrsStTuVxX] [target ...]\n"
+"%s [-v[cdfimrtw]] [-m[trae]] [-ABcdeEghiknpqrsStTuVxX] [target ...]\n"
#endif
/* We don't use va_end at all, so define it out so that it doesn't produce
@@ -141,6 +142,10 @@ char **argv;
Create_macro_vars();
Catch_signals(Quit);
+ /* This macro is only defined for some OSs, see sysintf.c for details *
+ * and NULL if undefined. */
+ Def_macro("ABSMAKECMD", AbsPname, M_PRECIOUS|M_NOEXPORT );
+
Def_macro( "MAKECMD", Pname, M_PRECIOUS|M_NOEXPORT );
Pname = Basename(Pname);
@@ -165,8 +170,12 @@ char **argv;
m_export = FALSE;
cmdmacs = NIL(char);
targets = NIL(char);
+ Is_exec_shell = FALSE;
+ Shell_exec_target = NIL(CELL);
+ stdout_redir = NIL(FILE);
- Verbose = V_NONE;
+ Verbose = V_NOFLAG;
+ Measure = M_NOFLAG;
Transitive = TRUE;
Nest_level = 0;
Line_number = 0;
@@ -241,7 +250,7 @@ char **argv;
case 'e': Get_env = 'e'; break;
case 'E': Get_env = 'E'; break;
- case 'V': Version(); Quit(NIL(CELL)); break;
+ case 'V': Version(); Quit(0); break;
case 'A': Def_macro("AUGMAKE", "y", M_EXPANDED); break;
case 'B': Def_macro(".NOTABS", "y", M_EXPANDED); break;
case 'i': Def_macro(".IGNORE", "y", M_EXPANDED); break;
@@ -276,6 +285,19 @@ char **argv;
}
break;
+ case 'm':
+ if( p[-1] != '-' ) Usage(TRUE);
+ while( p[1] ) switch( *++p ) {
+ case 't': Measure |= M_TARGET; break;
+ case 'r': Measure |= M_RECIPE; break;
+ case 'a': Measure |= M_ABSPATH; break;
+ case 'e': Measure |= M_SHELLESC; break;
+
+ default: Usage(TRUE); break;
+ }
+ if( !Measure ) Measure = M_TARGET;
+ break;
+
case 'P':
if( p[1] ) {
Def_macro( "MAXPROCESS", p+1, M_MULTI|M_EXPANDED );
@@ -330,6 +352,7 @@ char **argv;
if( Rules ) {
char *fname;
+ /* Search_file() also checks the environment variable. */
if( (mkfil=Search_file("MAKESTARTUP", &fname)) != NIL(FILE) ) {
Parse(mkfil);
Def_macro( "MAKESTARTUP", fname, M_EXPANDED|M_MULTI|M_FORCE );
@@ -627,7 +650,11 @@ Nestlevel()/*
PUBLIC FILE *
-TryFiles(lp)
+TryFiles(lp)/*
+==============
+ Try to open a makefile, try to make it if needed and return a
+ filepointer to the first successful found or generated file.
+ The function returns NIL(FILE) if nothing was found. */
LINKPTR lp;
{
FILE *mkfil = NIL(FILE);
@@ -648,9 +675,16 @@ LINKPTR lp;
mkfil = Openfile( lp->cl_prq->CE_NAME, FALSE, FALSE );
- if( mkfil == NIL(FILE) &&
- Make(lp->cl_prq, NIL(CELL)) != -1 )
+ /* Note that no error handling for failed Make() calls is possible
+ * as expected errors (no rule to make the makefile) or unexpected
+ * errors both return -1. */
+ if( mkfil == NIL(FILE) && Make(lp->cl_prq, NIL(CELL)) != -1 ) {
mkfil = Openfile( lp->cl_prq->CE_NAME, FALSE, FALSE );
+ /* Clean the F_VISITED flag after making the target as this
+ * can conflict with the circular dependency check in rulparse(),
+ * see issue 62118 for details. */
+ lp->cl_prq->ce_flag &= ~(F_VISITED);
+ }
}
Trace = s_n;
@@ -684,13 +718,13 @@ va_list args;
if( f != NIL(char) ) fprintf(stderr, "%s: line %d: ", f, Line_number);
if( errflg )
- fprintf(stderr, "Error -- ");
+ fprintf(stderr, "Error: -- ");
else if( warn )
- fprintf(stderr, "Warning -- ");
+ fprintf(stderr, "Warning: -- ");
vfprintf( stderr, fmt, args );
putc( '\n', stderr );
- if( errflg && !Continue ) Quit( NIL(CELL) );
+ if( errflg && !Continue ) Quit(0);
}
}
@@ -791,7 +825,7 @@ int eflag;
puts(" -K file - use file as the .KEEP_STATE file");
puts(" -w target - show what you would do if 'target' were out of date");
puts(" -W target - rebuild pretending that 'target' is out of date");
- puts(" -v{cdfimrtw} - verbose, indicate what we are doing, (-v => -vcdfimrtw)");
+ puts(" -v[cdfimrtw] - verbose, indicate what we are doing, (-v => -vcdfimrtw)");
puts(" c => dump directory cache info only" );
puts(" d => dump change of directory info only" );
puts(" f => dump file open/close info only" );
@@ -802,6 +836,12 @@ int eflag;
puts(" t => keep temporary files when done" );
puts(" w => issue non-essential warnings\n" );
+ puts(" -m[trae] - Measure timing information, (-m => -mt)");
+ puts(" t => display the start and end time of each target" );
+ puts(" r => display the start and end time of each recipe" );
+ puts(" a => display the target as an absolute path" );
+ puts(" e => display the timing of shell escape macros\n" );
+
puts("Options: (can be catenated, ie -irn == -i -r -n)");
puts(" -A - enable AUGMAKE special target mapping");
puts(" -B - enable the use of spaces instead of tabs to start recipes");
@@ -828,7 +868,7 @@ int eflag;
puts(" -X - ignore #! lines at start of makefile");
}
- Quit(NIL(CELL));
+ Quit(0);
}
@@ -838,20 +878,13 @@ Version()
extern char **Rule_tab;
char **p;
- printf("%s - %s, ", Pname, sccid);
- printf("Version %s\n\n", VERSION);
+ printf("%s - Version %s (%s)\n", Pname, VERSION, BUILDINFO);
+ printf("%s\n\n", sccid);
puts("Default Configuration:");
for (p=Rule_tab; *p != NIL(char); p++)
printf("\t%s\n", *p);
printf("\n");
-printf("Please read the file readme/release for the latest release notes.\n");
-#if 0
-printf("\n");
-printf("Please support the DMAKE Reference Manual project. See the file\n");
-printf("readme/release for additional information on where to send contributions.\n");
-printf("Or, send mail to dvadura@plg.uwaterloo.ca for additional information if the\n");
-printf("above file is not readily available.\n");
-#endif
+printf("Please read the file readme/read1st.txt for the latest release notes.\n");
}