Print this page
fixup! make: be serial if 'make', parallel if 'dmake', and parallel if '-j' is specified either way
fixup! make: translate using gettext, rather than the unmaintainable catgets
fixup! make: unifdef for two bugfixes conditioned for unknown reasons (defined)


  42 #include <mksh/misc.h>            /* getmem(), setup_char_semantics() */
  43 
  44 #include <pwd.h>          /* getpwnam() */
  45 #include <setjmp.h>
  46 #include <signal.h>
  47 #include <stdlib.h>
  48 #include <sys/errno.h>            /* ENOENT */
  49 #include <sys/stat.h>             /* fstat() */
  50 #include <fcntl.h>                /* open() */
  51 
  52 #       include <sys/systeminfo.h>        /* sysinfo() */
  53 
  54 #include <sys/types.h>            /* stat() */
  55 #include <sys/wait.h>             /* wait() */
  56 #include <unistd.h>               /* execv(), unlink(), access() */
  57 #include <vroot/report.h> /* report_dependency(), get_report_file() */
  58 
  59 // From read2.cc
  60 extern  Name            normalize_name(register wchar_t *name_string, register int length);
  61 
  62 // From parallel.cc
  63 #define MAXJOBS_ADJUST_RFE4694000
  64 
  65 extern void job_adjust_fini();
  66 
  67 
  68 /*
  69  * Defined macros
  70  */
  71 #define LD_SUPPORT_ENV_VAR      "SGS_SUPPORT_32"
  72 #define LD_SUPPORT_ENV_VAR_32   "SGS_SUPPORT_32"
  73 #define LD_SUPPORT_ENV_VAR_64   "SGS_SUPPORT_64"
  74 #define LD_SUPPORT_MAKE_LIB     "libmakestate.so.1"
  75 #ifdef __i386
  76 #define LD_SUPPORT_MAKE_ARCH    "i386"
  77 #elif __sparc
  78 #define LD_SUPPORT_MAKE_ARCH    "sparc"
  79 #else
  80 #error "Unsupported architecture"
  81 #endif
  82 
  83 /*
  84  * typedefs & structs


 381                 output_mode = txt1_mode;
 382         } else {
 383                 dmake_value2 = prop2->body.macro.value;
 384                 if ((dmake_value2 == NULL) ||
 385                     (IS_EQUAL(dmake_value2->string_mb, "TXT1"))) {
 386                         output_mode = txt1_mode;
 387                 } else if (IS_EQUAL(dmake_value2->string_mb, "TXT2")) {
 388                         output_mode = txt2_mode;
 389                 } else if (IS_EQUAL(dmake_value2->string_mb, "HTML1")) {
 390                         output_mode = html1_mode;
 391                 } else {
 392                         warning(gettext("Unsupported value `%s' for DMAKE_OUTPUT_MODE after -x flag (ignored)"),
 393                               dmake_value2->string_mb);
 394                 }
 395         }
 396         /*
 397          * Find the dmake_mode: parallel, or serial.
 398          */
 399     if ((!pmake_cap_r_specified) &&
 400         (!pmake_machinesfile_specified)) {
 401         char *s = strdup(argv[0]);    





 402             
 403         MBSTOWCS(wcs_buffer, "DMAKE_MODE");
 404         dmake_name2 = GETNAME(wcs_buffer, FIND_LENGTH);
 405         prop2 = get_prop(dmake_name2->prop, macro_prop);
 406         // If we're invoked as 'make' run serially, regardless of DMAKE_MODE
 407         // If we're invoked as 'make' but passed -j, run parallel
 408         // If we're invoked as 'dmake', without DMAKE_MODE, default parallel
 409         // If we're invoked as 'dmake' and DMAKE_MODE is set, honour it.
 410         if ((strcmp(basename(s), "make") == 0) &&
 411             !dmake_max_jobs_specified) {
 412                 dmake_mode_type = serial_mode;
 413                 no_parallel = true;
 414         } else if (prop2 == NULL) {
 415                 /* DMAKE_MODE not defined, default based on our name */
 416                 char *s = strdup(argv[0]);
 417 
 418                 if (strcmp(basename(s), "dmake") == 0) {
 419                         dmake_mode_type = parallel_mode;
 420                         no_parallel = false;
 421                 }
 422         } else {
 423                 dmake_value2 = prop2->body.macro.value;
 424                 if (IS_EQUAL(dmake_value2->string_mb, "parallel")) {
 425                         dmake_mode_type = parallel_mode;
 426                         no_parallel = false;
 427                 } else if (IS_EQUAL(dmake_value2->string_mb, "serial")) {
 428                         dmake_mode_type = serial_mode;
 429                         no_parallel = true;
 430                 } else {
 431                         fatal(gettext("Unknown dmake mode argument `%s' after -m flag"), dmake_value2->string_mb);
 432                 }
 433         }
 434         free(s);
 435     }
 436 
 437         parallel_flag = true;
 438         putenv(strdup("DMAKE_CHILD=TRUE"));




  42 #include <mksh/misc.h>            /* getmem(), setup_char_semantics() */
  43 
  44 #include <pwd.h>          /* getpwnam() */
  45 #include <setjmp.h>
  46 #include <signal.h>
  47 #include <stdlib.h>
  48 #include <sys/errno.h>            /* ENOENT */
  49 #include <sys/stat.h>             /* fstat() */
  50 #include <fcntl.h>                /* open() */
  51 
  52 #       include <sys/systeminfo.h>        /* sysinfo() */
  53 
  54 #include <sys/types.h>            /* stat() */
  55 #include <sys/wait.h>             /* wait() */
  56 #include <unistd.h>               /* execv(), unlink(), access() */
  57 #include <vroot/report.h> /* report_dependency(), get_report_file() */
  58 
  59 // From read2.cc
  60 extern  Name            normalize_name(register wchar_t *name_string, register int length);
  61 



  62 extern void job_adjust_fini();
  63 
  64 
  65 /*
  66  * Defined macros
  67  */
  68 #define LD_SUPPORT_ENV_VAR      "SGS_SUPPORT_32"
  69 #define LD_SUPPORT_ENV_VAR_32   "SGS_SUPPORT_32"
  70 #define LD_SUPPORT_ENV_VAR_64   "SGS_SUPPORT_64"
  71 #define LD_SUPPORT_MAKE_LIB     "libmakestate.so.1"
  72 #ifdef __i386
  73 #define LD_SUPPORT_MAKE_ARCH    "i386"
  74 #elif __sparc
  75 #define LD_SUPPORT_MAKE_ARCH    "sparc"
  76 #else
  77 #error "Unsupported architecture"
  78 #endif
  79 
  80 /*
  81  * typedefs & structs


 378                 output_mode = txt1_mode;
 379         } else {
 380                 dmake_value2 = prop2->body.macro.value;
 381                 if ((dmake_value2 == NULL) ||
 382                     (IS_EQUAL(dmake_value2->string_mb, "TXT1"))) {
 383                         output_mode = txt1_mode;
 384                 } else if (IS_EQUAL(dmake_value2->string_mb, "TXT2")) {
 385                         output_mode = txt2_mode;
 386                 } else if (IS_EQUAL(dmake_value2->string_mb, "HTML1")) {
 387                         output_mode = html1_mode;
 388                 } else {
 389                         warning(gettext("Unsupported value `%s' for DMAKE_OUTPUT_MODE after -x flag (ignored)"),
 390                               dmake_value2->string_mb);
 391                 }
 392         }
 393         /*
 394          * Find the dmake_mode: parallel, or serial.
 395          */
 396     if ((!pmake_cap_r_specified) &&
 397         (!pmake_machinesfile_specified)) {
 398         char *s, *b;
 399 
 400         if ((s = strdup(argv[0])) == NULL)
 401                 fatal(gettext("Out of memory"));
 402 
 403         b = basename(s);
 404 
 405         MBSTOWCS(wcs_buffer, "DMAKE_MODE");
 406         dmake_name2 = GETNAME(wcs_buffer, FIND_LENGTH);
 407         prop2 = get_prop(dmake_name2->prop, macro_prop);
 408         // If we're invoked as 'make' run serially, regardless of DMAKE_MODE
 409         // If we're invoked as 'make' but passed -j, run parallel
 410         // If we're invoked as 'dmake', without DMAKE_MODE, default parallel
 411         // If we're invoked as 'dmake' and DMAKE_MODE is set, honour it.
 412         if ((strcmp(b, "make") == 0) &&
 413             !dmake_max_jobs_specified) {
 414                 dmake_mode_type = serial_mode;
 415                 no_parallel = true;
 416         } else if (prop2 == NULL) {
 417                 /* DMAKE_MODE not defined, default based on our name */
 418                 if (strcmp(b, "dmake") == 0) {


 419                         dmake_mode_type = parallel_mode;
 420                         no_parallel = false;
 421                 }
 422         } else {
 423                 dmake_value2 = prop2->body.macro.value;
 424                 if (IS_EQUAL(dmake_value2->string_mb, "parallel")) {
 425                         dmake_mode_type = parallel_mode;
 426                         no_parallel = false;
 427                 } else if (IS_EQUAL(dmake_value2->string_mb, "serial")) {
 428                         dmake_mode_type = serial_mode;
 429                         no_parallel = true;
 430                 } else {
 431                         fatal(gettext("Unknown dmake mode argument `%s' after -m flag"), dmake_value2->string_mb);
 432                 }
 433         }
 434         free(s);
 435     }
 436 
 437         parallel_flag = true;
 438         putenv(strdup("DMAKE_CHILD=TRUE"));