Debian Codegraph @

libdebugger/command/target.c

raw symbols SCIP
1 /* Show a variable or target definition. */
2 /*
3 Copyright (C) 2011, 2020 R. Bernstein <[email protected]>
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
21 #include "../../src/trace.h"
22 #include "../../src/commands.h"
23 #include "../../src/file.h"
24 #include "../../src/variable.h"
25 #include "../cmd.h"
26 #include "../fns.h"
27
28 extern debug_return_t
29 dbg_cmd_target(char *psz_args)
30 {
31 const char *psz_target;
32 file_t *p_target = get_target(&psz_args, &psz_target);
33
34 if (p_target) {
35 print_target_mask_t i_mask = 0;
36 char *psz_word;
37
38 while( (psz_word = get_word(&psz_args))) {
39 if (!*psz_word) {
40 break;
41 } else if (is_abbrev_of(psz_word, "depends", 1)) {
42 i_mask |= PRINT_TARGET_DEPEND;
43 } else if (is_abbrev_of(psz_word, "order", 1)) {
44 i_mask |= PRINT_TARGET_ORDER;
45 } else if (is_abbrev_of(psz_word, "nonorder", 1)) {
46 i_mask |= PRINT_TARGET_NONORDER;
47 } else if (is_abbrev_of(psz_word, "attributes", 1)) {
48 i_mask |= PRINT_TARGET_ATTRS;
49 } else if (is_abbrev_of(psz_word, "state", 1)) {
50 i_mask |= PRINT_TARGET_STATE;
51 } else if (is_abbrev_of(psz_word, "time", 1)) {
52 i_mask |= PRINT_TARGET_TIME;
53 } else if (is_abbrev_of(psz_word, "variables", 1)) {
54 i_mask |= PRINT_TARGET_VARS;
55 } else if (is_abbrev_of(psz_word, "commands", 1)) {
56 i_mask |= PRINT_TARGET_CMDS;
57 } else if (is_abbrev_of(psz_word, "expand", 1)) {
58 i_mask |= (PRINT_TARGET_CMDS_EXP);
59 } else if (is_abbrev_of(psz_word, "previous", 1)) {
60 i_mask |= PRINT_TARGET_PREV;
61 } else {
62 printf("Don't understand attribute '%s'\n", psz_word);
63 return debug_readloop;
64 }
65 }
66
67 if (0 == i_mask) i_mask = PRINT_TARGET_ALL & (~PRINT_TARGET_VARS_HASH);
68
69 if (i_mask & PRINT_TARGET_VARS) {
70 initialize_file_variables (p_target, 0);
71 set_file_variables (p_target);
72 }
73
74 if (p_target->description) {
75 printf("#: %s", p_target->description);
76 }
77 print_target_props(p_target, i_mask);
78 }
79 return debug_readloop;
80 }
81
82 /*
83 * Local variables:
84 * eval: (c-set-style "gnu")
85 * indent-tabs-mode: nil
86 * End:
87 */