1 | /* Debugging macros and interface.
|
---|
2 | Copyright (C) 1999-2016 Free Software Foundation, Inc.
|
---|
3 | This file is part of GNU Make.
|
---|
4 |
|
---|
5 | GNU Make is free software; you can redistribute it and/or modify it under the
|
---|
6 | terms of the GNU General Public License as published by the Free Software
|
---|
7 | Foundation; either version 3 of the License, or (at your option) any later
|
---|
8 | version.
|
---|
9 |
|
---|
10 | GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
|
---|
11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
---|
12 | A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License along with
|
---|
15 | this program. If not, see <http://www.gnu.org/licenses/>. */
|
---|
16 |
|
---|
17 | #define DB_NONE (0x000)
|
---|
18 | #define DB_BASIC (0x001)
|
---|
19 | #define DB_VERBOSE (0x002)
|
---|
20 | #define DB_JOBS (0x004)
|
---|
21 | #define DB_IMPLICIT (0x008)
|
---|
22 | #define DB_MAKEFILES (0x100)
|
---|
23 | #ifdef KMK
|
---|
24 | # define DB_KMK (0x800)
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #define DB_ALL (0xfff)
|
---|
28 |
|
---|
29 | extern int db_level;
|
---|
30 |
|
---|
31 | #ifdef KMK
|
---|
32 |
|
---|
33 | /* Some extended info for -j and .NOTPARALLEL tracking. */
|
---|
34 | extern unsigned int makelevel;
|
---|
35 | extern unsigned int job_slots;
|
---|
36 | extern unsigned int job_slots_used;
|
---|
37 |
|
---|
38 | #define DB_HDR() do { printf ("[%u:%u/%u]", makelevel, job_slots_used, job_slots); } while (0)
|
---|
39 |
|
---|
40 | #define ISDB(_l) ((_l)&db_level)
|
---|
41 |
|
---|
42 | #define DBS(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); \
|
---|
43 | print_spaces (depth); \
|
---|
44 | printf _x; fflush (stdout);} }while(0)
|
---|
45 |
|
---|
46 | #define DBF(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); \
|
---|
47 | print_spaces (depth); \
|
---|
48 | printf (_x, file->name); \
|
---|
49 | fflush (stdout);} }while(0)
|
---|
50 |
|
---|
51 | #define DB(_l,_x) do{ if(ISDB(_l)) {DB_HDR(); printf _x; fflush (stdout);} }while(0)
|
---|
52 |
|
---|
53 | #else /* !KMK */
|
---|
54 |
|
---|
55 | #define ISDB(_l) ((_l)&db_level)
|
---|
56 |
|
---|
57 | #define DBS(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \
|
---|
58 | printf _x; fflush (stdout);} }while(0)
|
---|
59 |
|
---|
60 | #define DBF(_l,_x) do{ if(ISDB(_l)) {print_spaces (depth); \
|
---|
61 | printf (_x, file->name); \
|
---|
62 | fflush (stdout);} }while(0)
|
---|
63 |
|
---|
64 | #define DB(_l,_x) do{ if(ISDB(_l)) {printf _x; fflush (stdout);} }while(0)
|
---|
65 |
|
---|
66 | #endif /* !KMK */
|
---|