make.h revision 141104
1141104Sharti/*-
21590Srgrimes * Copyright (c) 1988, 1989, 1990, 1993
31590Srgrimes *	The Regents of the University of California.  All rights reserved.
41590Srgrimes * Copyright (c) 1989 by Berkeley Softworks
51590Srgrimes * All rights reserved.
61590Srgrimes *
71590Srgrimes * This code is derived from software contributed to Berkeley by
81590Srgrimes * Adam de Boor.
91590Srgrimes *
101590Srgrimes * Redistribution and use in source and binary forms, with or without
111590Srgrimes * modification, are permitted provided that the following conditions
121590Srgrimes * are met:
131590Srgrimes * 1. Redistributions of source code must retain the above copyright
141590Srgrimes *    notice, this list of conditions and the following disclaimer.
151590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
161590Srgrimes *    notice, this list of conditions and the following disclaimer in the
171590Srgrimes *    documentation and/or other materials provided with the distribution.
181590Srgrimes * 3. All advertising materials mentioning features or use of this software
191590Srgrimes *    must display the following acknowledgement:
201590Srgrimes *	This product includes software developed by the University of
211590Srgrimes *	California, Berkeley and its contributors.
221590Srgrimes * 4. Neither the name of the University nor the names of its contributors
231590Srgrimes *    may be used to endorse or promote products derived from this software
241590Srgrimes *    without specific prior written permission.
251590Srgrimes *
261590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
271590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
281590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
291590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
301590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
311590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
321590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
331590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
341590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
351590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
361590Srgrimes * SUCH DAMAGE.
371590Srgrimes *
3894589Sobrien *	@(#)make.h	8.3 (Berkeley) 6/13/95
3950477Speter * $FreeBSD: head/usr.bin/make/make.h 141104 2005-02-01 10:50:37Z harti $
401590Srgrimes */
411590Srgrimes
42141104Sharti#ifndef make_h_a91074b9
43141104Sharti#define	make_h_a91074b9
44141104Sharti
451590Srgrimes/*-
461590Srgrimes * make.h --
471590Srgrimes *	The global definitions for pmake
481590Srgrimes */
491590Srgrimes
501590Srgrimes#include "sprite.h"
511590Srgrimes
52141104Shartistruct GNode;
53141104Shartistruct Lst;
541590Srgrimes
551590Srgrimes/*
561590Srgrimes * The OP_ constants are used when parsing a dependency line as a way of
571590Srgrimes * communicating to other parts of the program the way in which a target
581590Srgrimes * should be made. These constants are bitwise-OR'ed together and
591590Srgrimes * placed in the 'type' field of each node. Any node that has
601590Srgrimes * a 'type' field which satisfies the OP_NOP function was never never on
611590Srgrimes * the lefthand side of an operator, though it may have been on the
628874Srgrimes * righthand side...
631590Srgrimes */
64103503Sjmallett#define	OP_DEPENDS	0x00000001  /* Execution of commands depends on
651590Srgrimes				     * kids (:) */
66103503Sjmallett#define	OP_FORCE	0x00000002  /* Always execute commands (!) */
67103503Sjmallett#define	OP_DOUBLEDEP	0x00000004  /* Execution of commands depends on kids
681590Srgrimes				     * per line (::) */
69103503Sjmallett#define	OP_OPMASK	(OP_DEPENDS|OP_FORCE|OP_DOUBLEDEP)
701590Srgrimes
71103503Sjmallett#define	OP_OPTIONAL	0x00000008  /* Don't care if the target doesn't
721590Srgrimes				     * exist and can't be created */
73103503Sjmallett#define	OP_USE		0x00000010  /* Use associated commands for parents */
74103503Sjmallett#define	OP_EXEC	  	0x00000020  /* Target is never out of date, but always
751590Srgrimes				     * execute commands anyway. Its time
761590Srgrimes				     * doesn't matter, so it has none...sort
771590Srgrimes				     * of */
78103503Sjmallett#define	OP_IGNORE	0x00000040  /* Ignore errors when creating the node */
79103503Sjmallett#define	OP_PRECIOUS	0x00000080  /* Don't remove the target when
801590Srgrimes				     * interrupted */
81103503Sjmallett#define	OP_SILENT	0x00000100  /* Don't echo commands when executed */
82103503Sjmallett#define	OP_MAKE		0x00000200  /* Target is a recurrsive make so its
831590Srgrimes				     * commands should always be executed when
841590Srgrimes				     * it is out of date, regardless of the
851590Srgrimes				     * state of the -n or -t flags */
86103503Sjmallett#define	OP_JOIN 	0x00000400  /* Target is out-of-date only if any of its
871590Srgrimes				     * children was out-of-date */
88103503Sjmallett#define	OP_INVISIBLE	0x00004000  /* The node is invisible to its parents.
891590Srgrimes				     * I.e. it doesn't show up in the parents's
901590Srgrimes				     * local variables. */
91103503Sjmallett#define	OP_NOTMAIN	0x00008000  /* The node is exempt from normal 'main
921590Srgrimes				     * target' processing in parse.c */
93103503Sjmallett#define	OP_PHONY	0x00010000  /* Not a file target; run always */
941590Srgrimes/* Attributes applied by PMake */
95103503Sjmallett#define	OP_TRANSFORM	0x80000000  /* The node is a transformation rule */
96103503Sjmallett#define	OP_MEMBER 	0x40000000  /* Target is a member of an archive */
97103503Sjmallett#define	OP_LIB	  	0x20000000  /* Target is a library */
98103503Sjmallett#define	OP_ARCHV  	0x10000000  /* Target is an archive construct */
99103503Sjmallett#define	OP_HAS_COMMANDS	0x08000000  /* Target has all the commands it should.
1001590Srgrimes				     * Used when parsing to catch multiple
1011590Srgrimes				     * commands for a target */
102103503Sjmallett#define	OP_SAVE_CMDS	0x04000000  /* Saving commands on .END (Compat) */
103103503Sjmallett#define	OP_DEPS_FOUND	0x02000000  /* Already processed by Suff_FindDeps */
1041590Srgrimes
1051590Srgrimes/*
1061590Srgrimes * OP_NOP will return TRUE if the node with the given type was not the
1071590Srgrimes * object of a dependency operator
1081590Srgrimes */
109103503Sjmallett#define	OP_NOP(t)	(((t) & OP_OPMASK) == 0x00000000)
1101590Srgrimes
1111590Srgrimes/*
1121590Srgrimes * Error levels for parsing. PARSE_FATAL means the process cannot continue
1131590Srgrimes * once the makefile has been parsed. PARSE_WARNING means it can. Passed
1141590Srgrimes * as the first argument to Parse_Error.
1151590Srgrimes */
116103503Sjmallett#define	PARSE_WARNING	2
117103503Sjmallett#define	PARSE_FATAL	1
1181590Srgrimes
1191590Srgrimes/*
1201590Srgrimes * Definitions for the "local" variables. Used only for clarity.
1211590Srgrimes */
122103503Sjmallett#define	TARGET	  	  "@" 	/* Target of dependency */
123103503Sjmallett#define	OODATE	  	  "?" 	/* All out-of-date sources */
124103503Sjmallett#define	ALLSRC	  	  ">" 	/* All sources */
125103503Sjmallett#define	IMPSRC	  	  "<" 	/* Source implied by transformation */
126103503Sjmallett#define	PREFIX	  	  "*" 	/* Common prefix */
127103503Sjmallett#define	ARCHIVE	  	  "!" 	/* Archive in "archive(member)" syntax */
128103503Sjmallett#define	MEMBER	  	  "%" 	/* Member in "archive(member)" syntax */
1291590Srgrimes
130103503Sjmallett#define	FTARGET           "@F"  /* file part of TARGET */
131103503Sjmallett#define	DTARGET           "@D"  /* directory part of TARGET */
132103503Sjmallett#define	FIMPSRC           "<F"  /* file part of IMPSRC */
133103503Sjmallett#define	DIMPSRC           "<D"  /* directory part of IMPSRC */
134103503Sjmallett#define	FPREFIX           "*F"  /* file part of PREFIX */
135103503Sjmallett#define	DPREFIX           "*D"  /* directory part of PREFIX */
1361590Srgrimes
137141104Shartiint Make_TimeStamp(struct GNode *, struct GNode *);
138141104ShartiBoolean Make_OODate(struct GNode *);
139141104Shartiint Make_HandleUse(struct GNode *, struct GNode *);
140141104Shartivoid Make_Update(struct GNode *);
141141104Shartivoid Make_DoAllVar(struct GNode *);
142141104ShartiBoolean Make_Run(struct Lst *);
143138916Sharti
144141104Sharti#endif /* make_h_a91074b9 */
145