1 #ifndef TARG_H 2 #define TARG_H 3 /* $OpenBSD: targ.h,v 1.13 2013/04/23 14:32:53 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 #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 /* set of helpers for constant nodes */ 50 extern GNode *Targ_FindNodeih(const char *, const char *, uint32_t, int); 51 52 __only_inline GNode * 53 Targ_FindNodeh(const char *, size_t, uint32_t, int); 54 55 __only_inline GNode * 56 Targ_FindNodeh(const char *name, size_t n, uint32_t hv, int flags) 57 { 58 return Targ_FindNodeih(name, name + n - 1, hv, flags); 59 } 60 extern void Targ_FindList(Lst, Lst); 61 extern bool Targ_Ignore(GNode *); 62 extern bool Targ_Silent(GNode *); 63 extern bool Targ_Precious(GNode *); 64 extern void Targ_PrintCmd(void *); 65 extern void Targ_PrintType(int); 66 extern void Targ_PrintGraph(int); 67 68 extern GNode *begin_node, *end_node, *interrupt_node, *DEFAULT; 69 struct ohash_info; 70 71 extern struct ohash_info gnode_info; 72 73 extern void Targ_setdirs(const char *, const char *); 74 extern const char *status_to_string(GNode *); 75 extern struct ohash *targets_hash(void); 76 #endif 77