make.h revision 146060
1/*-
2 * Copyright (c) 1988, 1989, 1990, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 * Copyright (c) 1989 by Berkeley Softworks
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.
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 * 3. All advertising materials mentioning features or use of this software
19 *    must display the following acknowledgement:
20 *	This product includes software developed by the University of
21 *	California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 *    may be used to endorse or promote products derived from this software
24 *    without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 *	@(#)make.h	8.3 (Berkeley) 6/13/95
39 * $FreeBSD: head/usr.bin/make/make.h 146060 2005-05-10 14:10:44Z harti $
40 */
41
42#ifndef make_h_a91074b9
43#define	make_h_a91074b9
44
45/*-
46 * make.h --
47 *	The global definitions for pmake
48 */
49
50#include "sprite.h"
51
52struct GNode;
53struct Lst;
54struct Buffer;
55
56/*
57 * The OP_ constants are used when parsing a dependency line as a way of
58 * communicating to other parts of the program the way in which a target
59 * should be made. These constants are bitwise-OR'ed together and
60 * placed in the 'type' field of each node. Any node that has
61 * a 'type' field which satisfies the OP_NOP function was never never on
62 * the lefthand side of an operator, though it may have been on the
63 * righthand side...
64 */
65#define	OP_DEPENDS	0x00000001  /* Execution of commands depends on
66				     * kids (:) */
67#define	OP_FORCE	0x00000002  /* Always execute commands (!) */
68#define	OP_DOUBLEDEP	0x00000004  /* Execution of commands depends on kids
69				     * per line (::) */
70#define	OP_OPMASK	(OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP)
71
72#define	OP_OPTIONAL	0x00000008  /* Don't care if the target doesn't
73				     * exist and can't be created */
74#define	OP_USE		0x00000010  /* Use associated commands for parents */
75#define	OP_EXEC	  	0x00000020  /* Target is never out of date, but always
76				     * execute commands anyway. Its time
77				     * doesn't matter, so it has none...sort
78				     * of */
79#define	OP_IGNORE	0x00000040  /* Ignore errors when creating the node */
80#define	OP_PRECIOUS	0x00000080  /* Don't remove the target when
81				     * interrupted */
82#define	OP_SILENT	0x00000100  /* Don't echo commands when executed */
83#define	OP_MAKE		0x00000200  /* Target is a recurrsive make so its
84				     * commands should always be executed when
85				     * it is out of date, regardless of the
86				     * state of the -n or -t flags */
87#define	OP_JOIN 	0x00000400  /* Target is out-of-date only if any of its
88				     * children was out-of-date */
89#define	OP_INVISIBLE	0x00004000  /* The node is invisible to its parents.
90				     * I.e. it doesn't show up in the parents's
91				     * local variables. */
92#define	OP_NOTMAIN	0x00008000  /* The node is exempt from normal 'main
93				     * target' processing in parse.c */
94#define	OP_PHONY	0x00010000  /* Not a file target; run always */
95/* Attributes applied by PMake */
96#define	OP_TRANSFORM	0x80000000  /* The node is a transformation rule */
97#define	OP_MEMBER 	0x40000000  /* Target is a member of an archive */
98#define	OP_LIB	  	0x20000000  /* Target is a library */
99#define	OP_ARCHV  	0x10000000  /* Target is an archive construct */
100#define	OP_HAS_COMMANDS	0x08000000  /* Target has all the commands it should.
101				     * Used when parsing to catch multiple
102				     * commands for a target */
103#define	OP_SAVE_CMDS	0x04000000  /* Saving commands on .END (Compat) */
104#define	OP_DEPS_FOUND	0x02000000  /* Already processed by Suff_FindDeps */
105
106/*
107 * OP_NOP will return TRUE if the node with the given type was not the
108 * object of a dependency operator
109 */
110#define	OP_NOP(t)	(((t) & OP_OPMASK) == 0x00000000)
111
112/*
113 * Definitions for the "local" variables. Used only for clarity.
114 */
115#define	TARGET	  	  "@" 	/* Target of dependency */
116#define	OODATE	  	  "?" 	/* All out-of-date sources */
117#define	ALLSRC	  	  ">" 	/* All sources */
118#define	IMPSRC	  	  "<" 	/* Source implied by transformation */
119#define	PREFIX	  	  "*" 	/* Common prefix */
120#define	ARCHIVE	  	  "!" 	/* Archive in "archive(member)" syntax */
121#define	MEMBER	  	  "%" 	/* Member in "archive(member)" syntax */
122
123#define	FTARGET           "@F"  /* file part of TARGET */
124#define	DTARGET           "@D"  /* directory part of TARGET */
125#define	FIMPSRC           "<F"  /* file part of IMPSRC */
126#define	DIMPSRC           "<D"  /* directory part of IMPSRC */
127#define	FPREFIX           "*F"  /* file part of PREFIX */
128#define	DPREFIX           "*D"  /* directory part of PREFIX */
129
130/*
131 * Warning flags
132 */
133enum {
134	WARN_DIRSYNTAX	= 0x0001,	/* syntax errors in directives */
135};
136
137int Make_TimeStamp(struct GNode *, struct GNode *);
138Boolean Make_OODate(struct GNode *);
139int Make_HandleUse(struct GNode *, struct GNode *);
140void Make_Update(struct GNode *);
141void Make_DoAllVar(struct GNode *);
142Boolean Make_Run(struct Lst *);
143void Main_ParseArgLine(char *, int);
144int Main_ParseWarn(const char *, int);
145
146#endif /* make_h_a91074b9 */
147