xref: /openbsd/usr.bin/make/targ.h (revision ce7279d8)
1 #ifndef TARG_H
2 #define TARG_H
3 /*	$OpenBSD: targ.h,v 1.16 2024/05/21 05:00:48 jsg 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 #include <sys/time.h>
31 /*
32  * The TARG_ constants are used when calling the Targ_FindNode functions.
33  * They simply tell the function what to do if the desired node is not found.
34  * If the TARG_CREATE constant is given, a new, empty node will be created
35  * for the target, placed in the table of all targets and its address returned.
36  * If TARG_NOCREATE is given, a NULL pointer will be returned.
37  */
38 #define TARG_CREATE	0x01	  /* create node if not found */
39 #define TARG_NOCREATE	0x00	  /* don't create it */
40 
41 extern void Targ_Init(void);
42 extern GNode *Targ_NewGNi(const char *, const char *);
43 #define Targ_NewGN(n)	Targ_NewGNi(n, NULL);
44 extern GNode *Targ_FindNodei(const char *, const char *, int);
45 #define Targ_FindNode(n, i)	Targ_FindNodei(n, NULL, i)
46 
47 
48 
49 /* helper for constant nodes */
50 extern GNode *Targ_mk_special_node(const char *, size_t, uint32_t,
51     unsigned int, unsigned char, unsigned int);
52 
53 extern void Targ_FindList(Lst, Lst);
54 extern bool Targ_Ignore(GNode *);
55 extern bool Targ_Silent(GNode *);
56 extern bool Targ_Precious(GNode *);
57 extern void Targ_PrintCmd(void *);
58 extern void Targ_PrintType(int);
59 extern bool node_is_real(GNode *);
60 
61 extern GNode *begin_node, *end_node, *interrupt_node, *DEFAULT;
62 struct ohash_info;
63 
64 extern struct ohash_info gnode_info;
65 
66 extern void Targ_setdirs(const char *, const char *);
67 extern const char *status_to_string(GNode *);
68 extern struct ohash *targets_hash(void);
69 #endif
70