]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/build/src/engine/jam.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / tools / build / src / engine / jam.cpp
index eab9bae2da45394f9fa3bef4781af8b6f5a0b608..07ed5e52c0a5f6762fdd1902513c5b946053065c 100644 (file)
@@ -79,7 +79,6 @@
  *  hash.c - simple in-memory hashing routines
  *  hdrmacro.c - handle header file parsing for filename macro definitions
  *  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
 #include "rules.h"
 #include "scan.h"
 #include "search.h"
+#include "startup.h"
 #include "jam_strings.h"
 #include "timestamp.h"
 #include "variable.h"
 #include "execcmd.h"
 #include "sysinfo.h"
 
+#include <errno.h>
+#include <string.h>
+
 /* Macintosh is "special" */
 #ifdef OS_MAC
 # include <QuickDraw.h>
@@ -168,24 +171,6 @@ struct globs globs =
 static const char * othersyms[] = { OSMAJOR, OSMINOR, OSPLAT, JAMVERSYM, 0 };
 
 
-/* Known for sure:
- *  mac needs arg_enviro
- *  OS2 needs extern environ
- */
-
-#ifdef OS_MAC
-# define use_environ arg_environ
-# ifdef MPW
-    QDGlobals qd;
-# endif
-#endif
-
-
-#ifdef OS_VMS
-# define use_environ arg_environ
-#endif
-
-
 /* on Win32-LCC */
 #if defined( OS_NT ) && defined( __LCC__ )
 # define use_environ _environ
@@ -240,7 +225,7 @@ static void usage( const char * progname )
 
        err_printf("-a      Build all targets, even if they are current.\n");
        err_printf("-dx     Set the debug level to x (0-13,console,mi).\n");
-       err_printf("-fx     Read x instead of Jambase.\n");
+       err_printf("-fx     Read x instead of bootstrap.\n");
        /* err_printf( "-g      Build from newest sources first.\n" ); */
        err_printf("-jx     Run up to x shell commands concurrently.\n");
        err_printf("-lx     Limit actions to x number of seconds after which they are stopped.\n");
@@ -260,12 +245,12 @@ static void usage( const char * progname )
     exit( EXITBAD );
 }
 
-int main( int argc, char * * argv, char * * arg_environ )
+int main( int argc, char * * argv )
 {
     int                     n;
     char                  * s;
     struct bjam_option      optv[ N_OPTS ];
-    int                     status;
+    int                     status = 0;
     int                     arg_c = argc;
     char          *       * arg_v = argv;
     char            const * progname = argv[ 0 ];
@@ -462,7 +447,8 @@ int main( int argc, char * * argv, char * * arg_environ )
     {
         if ( !( globs.out = fopen( s, "w" ) ) )
         {
-            err_printf( "Failed to write to '%s'\n", s );
+            err_printf( "[errno %d] failed to write output file '%s': %s",
+                errno, s, strerror(errno) );
             exit( EXITBAD );
         }
         /* ++globs.noexec; */
@@ -589,6 +575,7 @@ int main( int argc, char * * argv, char * * arg_environ )
 
         /* Initialize built-in rules. */
         load_builtins();
+        b2::startup::load_builtins();
 
         /* Add the targets in the command line to the update list. */
         for ( n = 1; n < arg_c; ++n )
@@ -645,8 +632,8 @@ int main( int argc, char * * argv, char * * arg_environ )
                 object_free( filename );
             }
 
-            if ( !n )
-                parse_file( constant_plus, frame );
+            if ( !n  )
+                status = b2::startup::bootstrap(frame) ? 0 : 13;
         }
 
         /* FIXME: What shall we do if builtin_update_now,
@@ -654,8 +641,9 @@ int main( int argc, char * * argv, char * * arg_environ )
          * failed earlier?
          */
 
-        status = yyanyerrors();
-        if ( !status )
+        if ( status == 0 )
+            status = yyanyerrors();
+        if ( status == 0 )
         {
             /* Manually touch -t targets. */
             for ( n = 0; ( s = getoptval( optv, 't', n ) ); ++n )