xref: /openbsd/usr.bin/make/defines.h (revision db3296cf)
1 #ifndef DEFINES_H
2 #define DEFINES_H
3 
4 /*	$OpenPackages$ */
5 /*	$OpenBSD: defines.h,v 1.2 2002/02/19 19:39:38 millert 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 ohash;
51 typedef struct ohash GSymT;
52 
53 struct Buffer_;
54 typedef struct Buffer_ *Buffer;
55 
56 struct Name;
57 
58 struct ListNode_;
59 typedef struct ListNode_ *LstNode;
60 
61 /* some useful defines for gcc */
62 
63 #ifdef __GNUC__
64 # define UNUSED	__attribute__((__unused__))
65 # define HAS_INLINES
66 # define INLINE  __inline__
67 #else
68 # define UNUSED
69 #endif
70 
71 #ifdef HAS_INLINES
72 # ifndef INLINE
73 #  define INLINE	inline
74 # endif
75 #endif
76 
77 /*
78  * debug control:
79  *	There is one bit per module.  It is up to the module what debug
80  *	information to print.
81  */
82 extern int debug;
83 #define DEBUG_ARCH	0x0001
84 #define DEBUG_COND	0x0002
85 #define DEBUG_DIR	0x0004
86 #define DEBUG_GRAPH1	0x0008
87 #define DEBUG_GRAPH2	0x0010
88 #define DEBUG_JOB	0x0020
89 #define DEBUG_MAKE	0x0040
90 #define DEBUG_SUFF	0x0080
91 #define DEBUG_TARG	0x0100
92 #define DEBUG_VAR	0x0200
93 #define DEBUG_FOR	0x0400
94 #define DEBUG_LOUD	0x0800
95 
96 #define CONCAT(a,b)	a##b
97 
98 #define DEBUG(module)	(debug & CONCAT(DEBUG_,module))
99 
100 #endif
101