1 /* Show a variable or target definition. */
2 /*
3 Copyright (C) 2011 R. Bernstein <rocky@gnu.org>
4 This file is part of GNU Make (remake variant).
5
6 GNU Make is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Make is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Make; see the file COPYING. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
20 debug_return_t
dbg_cmd_target(char * psz_args)21 dbg_cmd_target(char *psz_args)
22 {
23 const char *psz_target;
24 file_t *p_target = get_target(&psz_args, &psz_target);
25
26 if (p_target) {
27 print_target_mask_t i_mask = 0;
28 char *psz_word;
29
30 while( (psz_word = get_word(&psz_args))) {
31 if (!*psz_word) {
32 break;
33 } else if (is_abbrev_of(psz_word, "depends", 1)) {
34 i_mask |= PRINT_TARGET_DEPEND;
35 } else if (is_abbrev_of(psz_word, "order", 1)) {
36 i_mask |= PRINT_TARGET_ORDER;
37 } else if (is_abbrev_of(psz_word, "nonorder", 1)) {
38 i_mask |= PRINT_TARGET_NONORDER;
39 } else if (is_abbrev_of(psz_word, "attributes", 1)) {
40 i_mask |= PRINT_TARGET_ATTRS;
41 } else if (is_abbrev_of(psz_word, "state", 1)) {
42 i_mask |= PRINT_TARGET_STATE;
43 } else if (is_abbrev_of(psz_word, "time", 1)) {
44 i_mask |= PRINT_TARGET_TIME;
45 } else if (is_abbrev_of(psz_word, "variables", 1)) {
46 i_mask |= PRINT_TARGET_VARS;
47 } else if (is_abbrev_of(psz_word, "commands", 1)) {
48 i_mask |= PRINT_TARGET_CMDS;
49 } else if (is_abbrev_of(psz_word, "expand", 1)) {
50 i_mask |= (PRINT_TARGET_CMDS_EXP);
51 } else if (is_abbrev_of(psz_word, "previous", 1)) {
52 i_mask |= PRINT_TARGET_PREV;
53 } else {
54 printf("Don't understand attribute '%s'\n", psz_word);
55 return debug_readloop;
56 }
57 }
58
59 if (0 == i_mask) i_mask = PRINT_TARGET_ALL & (~PRINT_TARGET_VARS_HASH);
60
61 if (i_mask & PRINT_TARGET_VARS) {
62 initialize_file_variables (p_target, 0);
63 set_file_variables (p_target);
64 }
65
66 if (p_target->description) {
67 printf("#: %s", p_target->description);
68 }
69 print_target_props(p_target, i_mask);
70 }
71 return debug_readloop;
72 }
73
74 static void
dbg_cmd_target_init(unsigned int c)75 dbg_cmd_target_init(unsigned int c)
76 {
77 short_command[c].func = &dbg_cmd_target;
78 short_command[c].use = _("target [TARGET-NAME] [info1 [info2...]]");
79 }
80
81
82 /*
83 * Local variables:
84 * eval: (c-set-style "gnu")
85 * indent-tabs-mode: nil
86 * End:
87 */
88