10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER START
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * The contents of this file are subject to the terms of the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Common Development and Distribution License (the "License").
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You may not use this file except in compliance with the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * See the License for the specific language governing permissions
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * and limitations under the License.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * CDDL HEADER END
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Use is subject to license terms.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Included files
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * File table of contents
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowevoid print_dependencies(register Name target, register Property line);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowestatic void print_deps(register Name target, register Property line);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowestatic void print_more_deps(Name target, Name name);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowevoid print_value(register Name value, Daemon daemon);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweextern void depvar_print_results (void);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * print_dependencies(target, line)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Print all the dependencies of a target. First print all the Makefiles.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Then print all the dependencies. Finally, print all the .INIT
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * dependencies.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Parameters:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * target The target we print dependencies for
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * line We get the dependency list from here
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Global variables used:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * done The Name ".DONE"
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * init The Name ".INIT"
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * makefiles_used List of all makefiles read
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweprint_dependencies(register Name target, register Property line)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Search the makefile list for the primary makefile,
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * then print it and its inclusions. After that go back
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * and print the default.mk file and its inclusions.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe for (dp = makefiles_used; dp != NULL; dp = dp->next) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe for (dp = makefiles_used; dp != NULL; dp = dp->next) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe print_more_deps(target, init);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe print_more_deps(target, done);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * print_more_deps(target, name)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Print some special dependencies.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * These are the dependencies for the .INIT and .DONE targets.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Parameters:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * target Target built during make run
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * name Special target to print dependencies for
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Global variables used:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (line != NULL && line->body.line.dependencies != NULL) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe for (dependencies= line->body.line.dependencies;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe get_prop(dependencies->name->prop, line_prop));
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * print_deps(target, line, go_recursive)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Print a regular dependency list. Append to this information which
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * indicates whether or not the target is recursive.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Parameters:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * target target to print dependencies for
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * line We get the dependency list from here
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * go_recursive Should we show all dependencies recursively?
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Global variables used:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * recursive_name The Name ".RECURSIVE", printed
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Loweprint_deps(register Name target, register Property line)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe /* only print entries that are actually derived and are not leaf
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * files and are not the result of sccs get.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return false;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return true;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return true;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return false;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Given a dependency print it and all its siblings.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Print the name of a file for the -P option.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * If the file is a directory put on a trailing slash.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (name->stat.is_dir) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe putwchar('/');
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * should_print_dep(line)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Test if we should print the dependencies of this target.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * The line must exist and either have children dependencies
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * or have a command that is not an SCCS command.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Return value:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * true if the dependencies should be printed
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Parameters:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * line We get the dependency list from here
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Global variables used:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return false;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return true;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return false;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe return true;
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Print out the root nodes of all the dependency trees
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * in this makefile.
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe for (np = hashtab.begin(), e = hashtab.end(); np != e; np++) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (np->is_target && !np->has_parent && np != target) {
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * This is a set of routines for dumping the internal make state
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * Used for the -p option
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe for (cp= (Chain) value; cp != NULL; cp= cp->next)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe if (((line= get_prop(target->prop, line_prop)) == NULL) ||
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe for (rule= line->body.line.command_template; rule != NULL; rule= rule->next)
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe (void)printf("\t%s\n", rule->command_line->string_mb);
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * If target is recursive, print the following to standard out:
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * .RECURSIVE subdir targ Makefile
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe * if found, print starting with the space after the ':'
10d63b7db37a83b39c7f511cf9426c9d03ea0760Richard Lowe colon = (wchar_t *) wcschr(rp->oldline, (int) colon_char);