xref: /openbsd/usr.bin/make/defines.h (revision 17df1aa7)
1 #ifndef DEFINES_H
2 #define DEFINES_H
3 
4 /*	$OpenPackages$ */
5 /*	$OpenBSD: defines.h,v 1.7 2008/11/04 07:22:35 espie Exp $ */
6 
7 /*
8  * Copyright (c) 2001 Marc Espie.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
23  * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifdef HAS_STDBOOL_H
33 # include <stdbool.h>
34 #else
35 typedef int bool;
36 # define false 0
37 # define true 1
38 #endif
39 
40 /* define common types in an opaque way */
41 struct GNode_;
42 typedef struct GNode_ GNode;
43 
44 struct List_;
45 typedef struct List_ *Lst;
46 
47 struct SymTable_;
48 typedef struct SymTable_ SymTable;
49 
50 struct Buffer_;
51 typedef struct Buffer_ *Buffer;
52 
53 struct Name;
54 
55 struct ListNode_;
56 typedef struct ListNode_ *LstNode;
57 
58 /* some useful defines for gcc */
59 
60 #ifdef __GNUC__
61 # define UNUSED	__attribute__((__unused__))
62 # define HAS_INLINES
63 # define INLINE  __inline__
64 #else
65 # define UNUSED
66 #endif
67 
68 #ifdef HAS_INLINES
69 # ifndef INLINE
70 #  define INLINE	inline
71 # endif
72 #endif
73 
74 /*
75  * debug control:
76  *	There is one bit per module.  It is up to the module what debug
77  *	information to print.
78  */
79 extern int debug;
80 #define DEBUG_ARCH	0x0001
81 #define DEBUG_COND	0x0002
82 #define DEBUG_DIR	0x0004
83 #define DEBUG_GRAPH1	0x0008
84 #define DEBUG_GRAPH2	0x0010
85 #define DEBUG_JOB	0x0020
86 #define DEBUG_MAKE	0x0040
87 #define DEBUG_SUFF	0x0080
88 #define DEBUG_TARG	0x0100
89 #define DEBUG_VAR	0x0200
90 #define DEBUG_FOR	0x0400
91 #define DEBUG_LOUD	0x0800
92 #define DEBUG_JOBBANNER	0x1000
93 #define DEBUG_PARALLEL	0x2000
94 #define DEBUG_NAME_MATCHING	0x4000
95 
96 #define CONCAT(a,b)	a##b
97 
98 #define DEBUG(module)	(debug & CONCAT(DEBUG_,module))
99 
100 #endif
101