remake  4.3+dbg-1.5
target.h
Go to the documentation of this file.
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. */
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
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  */
Definition: file.h:68
Definition: file.h:61
Definition: file.h:60
debug_return_t dbg_cmd_target(char *psz_args)
Definition: target.h:21
bool is_abbrev_of(const char *psz_substr, const char *psz_word, unsigned int i_min)
debug_return_t
Definition: trace.h:32
Definition: file.h:63
#define _(msgid)
Definition: make.h:293
Definition: trace.h:40
file_t * get_target(char **ppsz_args, const char **ppsz_target)
void initialize_file_variables(struct file *file, int reading)
Definition: file.h:59
print_target_mask_t
Definition: file.h:56
Definition: file.h:66
char * get_word(char **ppsz_str)
Definition: file.h:65
Definition: file.h:64
Definition: file.h:58
Definition: file.h:67
void set_file_variables(struct file *file)
Definition: file.h:69
Definition: file.h:62
void print_target_props(file_t *p_target, print_target_mask_t i_mask)
const char * description
Definition: filedef.h:43
Definition: filedef.h:34