| 1 | /* Debugging macros and interface. | 
|---|
| 2 | Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software | 
|---|
| 3 | Foundation, Inc. | 
|---|
| 4 | This file is part of GNU Make. | 
|---|
| 5 |  | 
|---|
| 6 | GNU Make is free software; you can redistribute it and/or modify it under the | 
|---|
| 7 | terms of the GNU General Public License as published by the Free Software | 
|---|
| 8 | Foundation; either version 2, or (at your option) any later 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 | GNU Make; see the file COPYING.  If not, write to the Free Software | 
|---|
| 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */ | 
|---|
| 17 |  | 
|---|
| 18 | #define DB_NONE         (0x000) | 
|---|
| 19 | #define DB_BASIC        (0x001) | 
|---|
| 20 | #define DB_VERBOSE      (0x002) | 
|---|
| 21 | #define DB_JOBS         (0x004) | 
|---|
| 22 | #define DB_IMPLICIT     (0x008) | 
|---|
| 23 | #define DB_MAKEFILES    (0x100) | 
|---|
| 24 | #ifdef KMK | 
|---|
| 25 | # define DB_KMK         (0x800) | 
|---|
| 26 | #endif | 
|---|
| 27 |  | 
|---|
| 28 | #define DB_ALL          (0xfff) | 
|---|
| 29 |  | 
|---|
| 30 | extern int db_level; | 
|---|
| 31 |  | 
|---|
| 32 | #ifdef KMK | 
|---|
| 33 |  | 
|---|
| 34 | /* Some extended info for -j and .NOTPARALLEL tracking. */ | 
|---|
| 35 | extern unsigned int makelevel; | 
|---|
| 36 | extern unsigned int job_slots; | 
|---|
| 37 | extern unsigned int job_slots_used; | 
|---|
| 38 |  | 
|---|
| 39 | #define DB_HDR()    do { printf ("[%u:%u/%u]", makelevel, job_slots_used, job_slots); } while (0) | 
|---|
| 40 |  | 
|---|
| 41 | #define ISDB(_l)    ((_l)&db_level) | 
|---|
| 42 |  | 
|---|
| 43 | #define DBS(_l,_x)  do{ if(ISDB(_l)) {DB_HDR(); \ | 
|---|
| 44 | print_spaces (depth); \ | 
|---|
| 45 | printf _x; fflush (stdout);} }while(0) | 
|---|
| 46 |  | 
|---|
| 47 | #define DBF(_l,_x)  do{ if(ISDB(_l)) {DB_HDR(); \ | 
|---|
| 48 | print_spaces (depth); \ | 
|---|
| 49 | printf (_x, file->name); \ | 
|---|
| 50 | fflush (stdout);} }while(0) | 
|---|
| 51 |  | 
|---|
| 52 | #define DB(_l,_x)   do{ if(ISDB(_l)) {DB_HDR(); printf _x; fflush (stdout);} }while(0) | 
|---|
| 53 |  | 
|---|
| 54 | #else  /* !KMK */ | 
|---|
| 55 |  | 
|---|
| 56 | #define ISDB(_l)    ((_l)&db_level) | 
|---|
| 57 |  | 
|---|
| 58 | #define DBS(_l,_x)  do{ if(ISDB(_l)) {print_spaces (depth); \ | 
|---|
| 59 | printf _x; fflush (stdout);} }while(0) | 
|---|
| 60 |  | 
|---|
| 61 | #define DBF(_l,_x)  do{ if(ISDB(_l)) {print_spaces (depth); \ | 
|---|
| 62 | printf (_x, file->name); \ | 
|---|
| 63 | fflush (stdout);} }while(0) | 
|---|
| 64 |  | 
|---|
| 65 | #define DB(_l,_x)   do{ if(ISDB(_l)) {printf _x; fflush (stdout);} }while(0) | 
|---|
| 66 |  | 
|---|
| 67 | #endif /* !KMK */ | 
|---|