Print this page
make: unifdef for SUNOS4_AND_AFTER (defined)


  52  *
  53  *      Print all the dependencies of a target. First print all the Makefiles.
  54  *      Then print all the dependencies. Finally, print all the .INIT
  55  *      dependencies.
  56  *
  57  *      Parameters:
  58  *              target          The target we print dependencies for
  59  *              line            We get the dependency list from here
  60  *
  61  *      Global variables used:
  62  *              done            The Name ".DONE"
  63  *              init            The Name ".INIT"
  64  *              makefiles_used  List of all makefiles read
  65  */
  66 void
  67 print_dependencies(register Name target, register Property line)
  68 {
  69         Dependency      dp;
  70         static Boolean  makefiles_printed = false;
  71 
  72 #ifdef SUNOS4_AND_AFTER
  73         if (target_variants) {
  74 #else
  75         if (is_true(flag.target_variants)) {
  76 #endif
  77                 depvar_print_results();
  78         }
  79         
  80         if (!makefiles_printed) {
  81                 /*
  82                  * Search the makefile list for the primary makefile,
  83                  * then print it and its inclusions.  After that go back
  84                  * and print the default.mk file and its inclusions.
  85                  */
  86                 for (dp = makefiles_used; dp != NULL; dp = dp->next) {
  87                         if (dp->name == primary_makefile) {
  88                                 break;
  89                         }
  90                 }
  91                 if (dp) {
  92                         print_deplist(dp);
  93                         for (dp = makefiles_used; dp != NULL; dp = dp->next) {
  94                                 if (dp->name == primary_makefile) {
  95                                         break;
  96                                 }
  97                                 (void)printf(" %s", dp->name->string_mb);
  98                         }
  99                 }
 100                 (void) printf("\n");
 101                 makefiles_printed = true;
 102         }
 103         print_deps(target, line);
 104 #ifdef SUNOS4_AND_AFTER
 105 /*
 106         print_more_deps(target, init);
 107         print_more_deps(target, done);
 108  */
 109         if (target_variants) {
 110 #else
 111         print_more_deps(target, cached_names.init);
 112         print_more_deps(target, cached_names.done);
 113         if (is_true(flag.target_variants)) {
 114 #endif
 115                 print_forest(target);
 116         }
 117 }
 118 
 119 /*
 120  *      print_more_deps(target, name)
 121  *
 122  *      Print some special dependencies.
 123  *      These are the dependencies for the .INIT and .DONE targets.
 124  *
 125  *      Parameters:
 126  *              target          Target built during make run
 127  *              name            Special target to print dependencies for
 128  *
 129  *      Global variables used:
 130  */
 131 static void
 132 print_more_deps(Name target, Name name)
 133 {
 134         Property        line;


 150 
 151 /*
 152  *      print_deps(target, line, go_recursive)
 153  *
 154  *      Print a regular dependency list.  Append to this information which
 155  *      indicates whether or not the target is recursive.
 156  *
 157  *      Parameters:
 158  *              target          target to print dependencies for
 159  *              line            We get the dependency list from here
 160  *              go_recursive    Should we show all dependencies recursively?
 161  *
 162  *      Global variables used:
 163  *              recursive_name  The Name ".RECURSIVE", printed
 164  */
 165 static void
 166 print_deps(register Name target, register Property line)
 167 {
 168         register Dependency     dep;
 169 
 170 #ifdef SUNOS4_AND_AFTER
 171         if ((target->dependency_printed) ||
 172             (target == force)) {
 173 #else
 174         if (is_true(target->dependency_printed)) {
 175 #endif
 176                 return;
 177         }
 178         target->dependency_printed = true;
 179 
 180         /* only print entries that are actually derived and are not leaf
 181          * files and are not the result of sccs get.
 182          */
 183         if (should_print_dep(line)) {
 184 #ifdef NSE
 185                 nse_check_no_deps_no_rule(target, line, line);
 186 #endif
 187                 if ((report_dependencies_level == 2) ||
 188                     (report_dependencies_level == 4)) {
 189                         if (is_out_of_date(line)) {
 190                                 (void) printf("1 ");
 191                         } else {
 192                                 (void) printf("0 ");
 193                         }
 194                 }
 195                 print_filename(target);


 272  *      The line must exist and either have children dependencies
 273  *      or have a command that is not an SCCS command.
 274  *
 275  *      Return value:
 276  *                              true if the dependencies should be printed
 277  *
 278  *      Parameters:
 279  *              line            We get the dependency list from here
 280  *
 281  *      Global variables used:
 282  */
 283 static Boolean
 284 should_print_dep(Property line)
 285 {
 286         if (line == NULL) {
 287                 return false;
 288         }
 289         if (line->body.line.dependencies != NULL) {
 290                 return true;
 291         }
 292 #ifdef SUNOS4_AND_AFTER
 293         if (line->body.line.sccs_command) {
 294 #else
 295         if (is_true(line->body.line.sccs_command)) {
 296 #endif
 297                 return false;
 298         }
 299         return true;
 300 }
 301 
 302 /*
 303  * Print out the root nodes of all the dependency trees
 304  * in this makefile.
 305  */
 306 static void
 307 print_forest(Name target)
 308 {
 309         Name_set::iterator np, e;
 310         Property        line;
 311 
 312         for (np = hashtab.begin(), e = hashtab.end(); np != e; np++) {
 313 #ifdef SUNOS4_AND_AFTER
 314                         if (np->is_target && !np->has_parent && np != target) {
 315 #else
 316                         if (is_true(np->is_target) && 
 317                             is_false(np->has_parent) &&
 318                             np != target) {
 319 #endif
 320                                 (void) doname_check(np, true, false, false);
 321                                 line = get_prop(np->prop, line_prop);
 322                                 printf("-\n");
 323                                 print_deps(np, line);
 324                         }
 325         }
 326 }
 327 
 328 #ifndef SUNOS4_AND_AFTER
 329 printdesc()
 330 {
 331         Name_set::iterator      p, e;
 332         register Property       prop;
 333         register Dependency     dep;
 334         register Cmd_line       rule;
 335         Percent                 percent, percent_depe;
 336 
 337         /* Default target */
 338         if (default_target_to_build != NULL) {
 339                 print_rule(default_target_to_build);
 340                 default_target_to_build->dependency_printed= true;
 341         };
 342         (void)printf("\n");
 343 
 344         /* .AR_REPLACE */
 345         if (ar_replace_rule != NULL) {
 346                 (void)printf("%s:\n", cached_names.ar_replace->string_mb);
 347                 for (rule= ar_replace_rule; rule != NULL; rule= rule->next)
 348                         (void)printf("\t%s\n", rule->command_line->string_mb);
 349         };
 350 
 351         /* .DEFAULT */
 352         if (default_rule != NULL) {
 353                 (void)printf("%s:\n", cached_names.default_rule->string_mb);
 354                 for (rule= default_rule; rule != NULL; rule= rule->next)
 355                         (void)printf("\t%s\n", rule->command_line->string_mb);
 356         };
 357 
 358         /* .IGNORE */
 359         if (is_true(flag.ignore_errors))
 360                 (void)printf("%s:\n", cached_names.ignore->string_mb);
 361 
 362         /* .KEEP_STATE: */
 363         if (is_true(flag.keep_state))
 364                 (void)printf("%s:\n\n", cached_names.dot_keep_state->string_mb);
 365 
 366         /* .PRECIOUS */
 367         (void)printf("%s: ", cached_names.precious->string_mb);
 368         for (p = hashtab.begin(), e = hashtab.end(); p != e; p++)
 369                         if (is_true(p->stat.is_precious | all_precious))
 370                                 (void)printf("%s ", p->string_mb);
 371         (void)printf("\n");
 372 
 373         /* .SCCS_GET */
 374         if (sccs_get_rule != NULL) {
 375                 (void)printf("%s:\n", cached_names.sccs_get->string_mb);
 376                 for (rule= sccs_get_rule; rule != NULL; rule= rule->next)
 377                         (void)printf("\t%s\n", rule->command_line->string_mb);
 378         };
 379 
 380         /* .SILENT */
 381         if (is_true(flag.silent))
 382                 (void)printf("%s:\n", cached_names.silent->string_mb);
 383 
 384         /* .SUFFIXES: */
 385         (void)printf("%s: ", cached_names.suffixes->string_mb);
 386         for (dep= suffixes; dep != NULL; dep= dep->next) {
 387                 (void)printf("%s ", dep->name->string_mb);
 388                 build_suffix_list(dep->name);
 389         };
 390         (void)printf("\n\n");
 391 
 392         /* % rules */
 393         for (percent= percent_list; percent != NULL; percent= percent->next) {
 394                 (void) printf("%s:", percent->name->string_mb);
 395 
 396                 for (percent_depe= percent->dependencies; percent_depe != NULL; percent_depe = percent_depe->next)
 397                         (void) printf(" %s", percent_depe->name->string_mb);
 398 
 399                 (void) printf("\n");
 400 
 401                 for (rule= percent->command_template; rule != NULL; rule= rule->next)
 402                         (void)printf("\t%s\n", rule->command_line->string_mb);
 403         };
 404 
 405         /* Suffix rules */
 406         for (p = hashtab.begin(), e = hashtab.end(); p != e; p++)
 407                         if (is_false(p->dependency_printed) && (p->string[0] == PERIOD)) {
 408                                 print_rule(p);
 409                                 p->dependency_printed= true;
 410                         };
 411 
 412         /* Macro assignments */
 413         for (p = hashtab.begin(), e = hashtab.end(); p != e; p++)
 414                         if (((prop= get_prop(p->prop, macro_prop)) != NULL) &&
 415                             (prop->body.macro.value != NULL)) {
 416                                 (void)printf("%s", p->string_mb);
 417                                 print_value(prop->body.macro.value,
 418                                             prop->body.macro.daemon);
 419                         };
 420         (void)printf("\n");
 421 
 422         /* Delays */
 423         for (p = hashtab.begin(), e = hashtab.end(); p != e; p++)
 424                         for (prop= get_prop(p->prop, conditional_prop);
 425                              prop != NULL;
 426                              prop= get_prop(prop->next, conditional_prop)) {
 427                                 (void)printf("%s := %s",
 428                                              p->string_mb,
 429                                              prop->body.conditional.name->string_mb);
 430                                 print_value(prop->body.conditional.value, no_daemon);
 431                         };
 432         (void)printf("\n");
 433 
 434         /* All other dependencies */
 435         for (p = hashtab.begin(), e = hashtab.end(); p != e; p++)
 436                         if (is_false(p->dependency_printed) && (p->colons != no_colon))
 437                                 print_rule(p);
 438         (void)printf("\n");
 439         exit(0);
 440 }
 441 #endif
 442 
 443 /*
 444  *      This is a set  of routines for dumping the internal make state
 445  *      Used for the -p option
 446  */
 447 void
 448 print_value(register Name value, Daemon daemon)
 449                                       
 450 #ifdef SUNOS4_AND_AFTER
 451                                        
 452 #else
 453                                        
 454 #endif
 455 {
 456         Chain                   cp;
 457 
 458         if (value == NULL)
 459                 (void)printf("=\n");
 460         else
 461                 switch (daemon) {
 462                     case no_daemon:
 463                         (void)printf("= %s\n", value->string_mb);
 464                         break;
 465                     case chain_daemon:
 466                         for (cp= (Chain) value; cp != NULL; cp= cp->next)
 467                                 (void)printf(cp->next == NULL ? "%s" : "%s ",
 468                                         cp->name->string_mb);
 469                         (void)printf("\n");
 470                         break;
 471                 };
 472 }
 473 
 474 static void




  52  *
  53  *      Print all the dependencies of a target. First print all the Makefiles.
  54  *      Then print all the dependencies. Finally, print all the .INIT
  55  *      dependencies.
  56  *
  57  *      Parameters:
  58  *              target          The target we print dependencies for
  59  *              line            We get the dependency list from here
  60  *
  61  *      Global variables used:
  62  *              done            The Name ".DONE"
  63  *              init            The Name ".INIT"
  64  *              makefiles_used  List of all makefiles read
  65  */
  66 void
  67 print_dependencies(register Name target, register Property line)
  68 {
  69         Dependency      dp;
  70         static Boolean  makefiles_printed = false;
  71 

  72         if (target_variants) {



  73                 depvar_print_results();
  74         }
  75         
  76         if (!makefiles_printed) {
  77                 /*
  78                  * Search the makefile list for the primary makefile,
  79                  * then print it and its inclusions.  After that go back
  80                  * and print the default.mk file and its inclusions.
  81                  */
  82                 for (dp = makefiles_used; dp != NULL; dp = dp->next) {
  83                         if (dp->name == primary_makefile) {
  84                                 break;
  85                         }
  86                 }
  87                 if (dp) {
  88                         print_deplist(dp);
  89                         for (dp = makefiles_used; dp != NULL; dp = dp->next) {
  90                                 if (dp->name == primary_makefile) {
  91                                         break;
  92                                 }
  93                                 (void)printf(" %s", dp->name->string_mb);
  94                         }
  95                 }
  96                 (void) printf("\n");
  97                 makefiles_printed = true;
  98         }
  99         print_deps(target, line);

 100 /*
 101         print_more_deps(target, init);
 102         print_more_deps(target, done);
 103  */
 104         if (target_variants) {





 105                 print_forest(target);
 106         }
 107 }
 108 
 109 /*
 110  *      print_more_deps(target, name)
 111  *
 112  *      Print some special dependencies.
 113  *      These are the dependencies for the .INIT and .DONE targets.
 114  *
 115  *      Parameters:
 116  *              target          Target built during make run
 117  *              name            Special target to print dependencies for
 118  *
 119  *      Global variables used:
 120  */
 121 static void
 122 print_more_deps(Name target, Name name)
 123 {
 124         Property        line;


 140 
 141 /*
 142  *      print_deps(target, line, go_recursive)
 143  *
 144  *      Print a regular dependency list.  Append to this information which
 145  *      indicates whether or not the target is recursive.
 146  *
 147  *      Parameters:
 148  *              target          target to print dependencies for
 149  *              line            We get the dependency list from here
 150  *              go_recursive    Should we show all dependencies recursively?
 151  *
 152  *      Global variables used:
 153  *              recursive_name  The Name ".RECURSIVE", printed
 154  */
 155 static void
 156 print_deps(register Name target, register Property line)
 157 {
 158         register Dependency     dep;
 159 

 160         if ((target->dependency_printed) ||
 161             (target == force)) {



 162                 return;
 163         }
 164         target->dependency_printed = true;
 165 
 166         /* only print entries that are actually derived and are not leaf
 167          * files and are not the result of sccs get.
 168          */
 169         if (should_print_dep(line)) {
 170 #ifdef NSE
 171                 nse_check_no_deps_no_rule(target, line, line);
 172 #endif
 173                 if ((report_dependencies_level == 2) ||
 174                     (report_dependencies_level == 4)) {
 175                         if (is_out_of_date(line)) {
 176                                 (void) printf("1 ");
 177                         } else {
 178                                 (void) printf("0 ");
 179                         }
 180                 }
 181                 print_filename(target);


 258  *      The line must exist and either have children dependencies
 259  *      or have a command that is not an SCCS command.
 260  *
 261  *      Return value:
 262  *                              true if the dependencies should be printed
 263  *
 264  *      Parameters:
 265  *              line            We get the dependency list from here
 266  *
 267  *      Global variables used:
 268  */
 269 static Boolean
 270 should_print_dep(Property line)
 271 {
 272         if (line == NULL) {
 273                 return false;
 274         }
 275         if (line->body.line.dependencies != NULL) {
 276                 return true;
 277         }

 278         if (line->body.line.sccs_command) {



 279                 return false;
 280         }
 281         return true;
 282 }
 283 
 284 /*
 285  * Print out the root nodes of all the dependency trees
 286  * in this makefile.
 287  */
 288 static void
 289 print_forest(Name target)
 290 {
 291         Name_set::iterator np, e;
 292         Property        line;
 293 
 294         for (np = hashtab.begin(), e = hashtab.end(); np != e; np++) {

 295                         if (np->is_target && !np->has_parent && np != target) {





 296                                 (void) doname_check(np, true, false, false);
 297                                 line = get_prop(np->prop, line_prop);
 298                                 printf("-\n");
 299                                 print_deps(np, line);
 300                         }
 301         }
 302 }
 303 


















































































































 304 
 305 /*
 306  *      This is a set  of routines for dumping the internal make state
 307  *      Used for the -p option
 308  */
 309 void
 310 print_value(register Name value, Daemon daemon)
 311                                       

 312                                        



 313 {
 314         Chain                   cp;
 315 
 316         if (value == NULL)
 317                 (void)printf("=\n");
 318         else
 319                 switch (daemon) {
 320                     case no_daemon:
 321                         (void)printf("= %s\n", value->string_mb);
 322                         break;
 323                     case chain_daemon:
 324                         for (cp= (Chain) value; cp != NULL; cp= cp->next)
 325                                 (void)printf(cp->next == NULL ? "%s" : "%s ",
 326                                         cp->name->string_mb);
 327                         (void)printf("\n");
 328                         break;
 329                 };
 330 }
 331 
 332 static void