xref: /openbsd-src/usr.bin/make/targ.h (revision 4c1e55dc91edd6e69ccc60ce855900fbc12cf34f)
1 #ifndef TARG_H
2 #define TARG_H
3 /*	$OpenBSD: targ.h,v 1.9 2010/07/19 19:46:44 espie Exp $ */
4 
5 /*
6  * Copyright (c) 2001 Marc Espie.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OPENBSD
21  * PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef TIMESTAMP_TYPE
31 #include "timestamp_t.h"
32 #endif
33 /*
34  * The TARG_ constants are used when calling the Targ_FindNode functions.
35  * They simply tell the function what to do if the desired node is not found.
36  * If the TARG_CREATE constant is given, a new, empty node will be created
37  * for the target, placed in the table of all targets and its address returned.
38  * If TARG_NOCREATE is given, a NULL pointer will be returned.
39  */
40 #define TARG_CREATE	0x01	  /* create node if not found */
41 #define TARG_NOCREATE	0x00	  /* don't create it */
42 
43 extern void Targ_Init(void);
44 #ifdef CLEANUP
45 extern void Targ_End(void);
46 #else
47 #define Targ_End()
48 #endif
49 extern GNode *Targ_NewGNi(const char *, const char *);
50 #define Targ_NewGN(n)	Targ_NewGNi(n, NULL);
51 extern GNode *Targ_FindNodei(const char *, const char *, int);
52 #define Targ_FindNode(n, i)	Targ_FindNodei(n, NULL, i)
53 
54 
55 
56 /* set of helpers for constant nodes */
57 extern GNode *Targ_FindNodeih(const char *, const char *, uint32_t, int);
58 
59 extern inline GNode *
60 Targ_FindNodeh(const char *, size_t, uint32_t, int);
61 extern inline GNode *
62 Targ_FindNodeh(const char *name, size_t n, uint32_t hv, int flags)
63 {
64 	return Targ_FindNodeih(name, name + n - 1, hv, flags);
65 }
66 extern void Targ_FindList(Lst, Lst);
67 extern bool Targ_Ignore(GNode *);
68 extern bool Targ_Silent(GNode *);
69 extern bool Targ_Precious(GNode *);
70 extern void Targ_PrintCmd(void *);
71 extern void Targ_PrintType(int);
72 extern void Targ_PrintGraph(int);
73 
74 extern GNode *begin_node, *end_node, *interrupt_node, *DEFAULT;
75 struct ohash_info;
76 
77 extern struct ohash_info gnode_info;
78 
79 extern void Targ_setdirs(const char *, const char *);
80 const char *status_to_string(GNode *);
81 struct ohash *targets_hash(void);
82 #endif
83