File: make.h

package info (click to toggle)
smake 1.2a23-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 2,820 kB
  • ctags: 2,459
  • sloc: ansic: 14,285; sh: 2,538; makefile: 113; pascal: 41
file content (256 lines) | stat: -rw-r--r-- 8,866 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/* @(#)make.h	1.56 04/02/25 Copyright 1985, 87, 91, 1995-2004 J. Schilling */
/*
 *	Definitions for make.
 *	Copyright (c) 1985, 87, 91, 1995-2004 by J. Schilling
 */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; see the file COPYING.  If not, write to the Free Software
 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef	_UTYPES_H
#include <utypes.h>
#endif

/*
 * XXX if sizeof(date_t) is < sizeof(time_t) there may be problems
 */
typedef unsigned long	date_t;

#define	NOTIME		((date_t)0)	/* Obj not (yet) found   */
#define	BADTIME		((date_t)-1)	/* Obj could not be made */
#define	RECURSETIME	((date_t)-2)	/* Obj depends on itself */
#define	PHONYTIME	((date_t)-3)	/* Obj is Phony		 */

					/* NOTE: MAXLEVEL must be odd */
#define	MAXLEVEL	255		/* Obj is not yet searched for */
#define	WDLEVEL		0		/* Obj is in working dir (".") */
#define	OBJLEVEL	1		/* Obj is in .OBJDIR */

#define	SSRC		1		/* Search in source directories	*/
#define	SOBJ		2		/* Search in obj directories */
#define	SALL		(SSRC | SOBJ)	/* Search in source/obj directories */

#ifdef	pdp11
#define	NAMEMAX		512		/* Max size of a name	*/
#else
#define	NAMEMAX		4096		/* Max size of a name POSIX linelen */
#endif

/*
 * one unique element is used for each target or member in a dependency list
 * also used for macros and macro definition lists
 */
typedef struct obj {
	struct	obj	*o_left;	/* Left next node in binary tree    */
	struct	obj	*o_right;	/* Right next node in binary tree   */
	struct	list	*o_list;	/* List of dependencies for target  */
	struct	cmd	*o_cmd;		/* List of commands for this target */
		char	*o_name;	/* Name of this target		    */
		date_t	o_date;		/* Current date for this target	    */
		short	o_type;		/* Type of node			    */
		short	o_flags;	/* Flags for this node		    */
		short	o_level;	/* Obj level this target was found  */
		short	o_fileindex;	/* Makefile idx for this definition */
} obj_t;

#define	F_READONLY	1
#define	F_EXPORT	2
#define	F_MULTITARGET	8

/*
 * list element, used to build dependency lists from unique obj elements
 */
typedef struct list {
	struct	list	*l_next;	/* Next entry in dependency list    */
	struct	obj	*l_obj;		/* Obj structure for this entry	    */
} list_t;

/*
 * element for commands that are used to update a target
 * one allocated for each command line
 */
typedef struct cmd {
	struct	cmd	*c_next;	/* Next command for this target	    */
		char	*c_line;	/* Command line for this element    */
} cmd_t;

/*
 * element used to describe pattern rules (rules that contain a '%' sign)
 * format is:
 *	target: source	(a%b: c%d)
 *		cmdlist
 */
typedef struct patrule {
	struct	patrule	*p_next;	/* Next pattern rule		    */
	struct	cmd	*p_cmd;		/* List of commands for this rule   */
	struct	obj	*p_name;	/* Node for complete target name    */
#ifdef	xxx
	struct	obj	*p_tgt_prefix;	/*				    */
	struct	obj	*p_tgt_suffix;	/*				    */
	struct	obj	*p_src_prefix;	/*				    */
	struct	obj	*p_src_suffix;	/*				    */
#else
	char		*p_tgt_prefix;	/*				    */
	char		*p_tgt_suffix;	/*				    */
	char		*p_src_prefix;	/*				    */
	char		*p_src_suffix;	/*				    */
#endif
} patr_t;

#define	EQUAL	'='
#define	COLON	':'
#define	SEMI	';'
#define	ADDMAC	('=' | ('+'<<8)) /* +=	 */
#define	SHVAR	0x1001		 /* :sh= */

#define	basetype(x)	((x) & 0xFF)

/*
 * make.c
 */
extern	void	usage		__PR((int exitcode));
extern	void	setup_dotvars	__PR((void));
extern	char	*searchtype	__PR((int mode));
extern	void	doexport	__PR((char *));
extern	int	docmd		__PR((char * cmd, obj_t * obj));
extern	BOOL	move_tgt	__PR((obj_t * from));
extern	BOOL	touch_file	__PR((char * name));
extern	date_t	gftime		__PR((char * file));
extern	Llong	gfileid		__PR((char * file));
extern	char	*prtime		__PR((date_t  date));
extern	char	*curwdir	__PR((void));

/*
 * archconf.c
 */
extern	void	setup_arch	__PR((void));

/*
 * readfile.c
 */
extern	char	*peekrdbuf	__PR((void));
extern	char	*getrdbuf	__PR((void));
extern	void	setincmd	__PR((BOOL isincmd));
extern	void	getch		__PR((void));
extern	int	peekch		__PR((void));
extern	void	skipline	__PR((void));
extern	void	readstring	__PR((char * str, char * strname));
extern	void	readfile	__PR((char * name, BOOL  must_exist));
extern	void	doinclude	__PR((char * name, BOOL  must_exist));
extern	void	makeincs	__PR((void));

/*
 * parse.c
 */
extern	void	parsefile	__PR((void));
extern	void	define_var	__PR((char *name, char *val));
extern	list_t	*cvtvpath	__PR((list_t *l));
extern	obj_t	*objlook		__PR((char * name, BOOL  create));
extern	obj_t	*ssufflook	__PR((char * name, BOOL  create));
extern	BOOL	check_ssufftab	__PR((void));
extern	void	printtree	__PR((void));
#ifdef	EOF
extern	void	probj		__PR((FILE *f, obj_t * o, int type));
#endif
extern	void	prtree		__PR((void));

/*
 * update.c
 */
extern	void	initchars	__PR((void));
extern	char	*filename	__PR((char * name));
extern	BOOL	isprecious	__PR((obj_t * obj));
extern	BOOL	isphony		__PR((obj_t * obj));
extern	list_t	*list_nth	__PR((list_t * list, int n));
extern	BOOL	build_path	__PR((int level, char * ename, char * path));
extern	char	*substitute	__PR((char * cmd, obj_t * obj, obj_t * source,
							char *suffix));
extern	char	*shout		__PR((char * cmd));
extern	BOOL	domake		__PR((char * name));
extern	BOOL	omake		__PR((obj_t * obj, BOOL  must_exist));
extern	BOOL	xmake		__PR((char * name, BOOL  must_exist));

/*
 * memory.c
 */
#ifdef	DEBUG
extern	void	prmem		__PR((void));
#endif
extern	char	*fastalloc	__PR((unsigned int size));
extern	void	fastfree	__PR((char *p, unsigned int size));
extern	void	freelist	__PR((list_t *l));
extern	char	*strsave		__PR((char *p));
extern	char	*initgbuf	__PR((int size));
extern	char	*growgbuf	__PR((char *p));


/*
 * Command line options.
 */
extern	BOOL	Sflag;		/* Do not print command lines on exec.	*/
extern	BOOL	Tflag;		/* Touch files instead of make.		*/
extern	BOOL	Qflag;		/* If up to date exit (0)		*/
extern	int	Debug;		/* Print reson for rebuild		*/
extern	int	XDebug;		/* Print extended debug info		*/
extern	int	Dmake;		/* Display makefile			*/
extern	BOOL	Prdep;		/* Print include dependendy		*/
extern	BOOL	NoWarn;		/* Don't print warning Messages.	*/
extern	BOOL	DoWarn;		/* Print extra warnings			*/
extern	char   *MakeFileNames[]; /* List of pathnames of the Makefiles.	*/
extern	int	Mfilecount;	/* # of valid entries in MakeFileNames.	*/

/*
 * Various common variables.
 */
extern	BOOL	posixmode;	/* We found a .POSIX target		    */
extern	int	Mflags;
extern	char	*ObjDir;	/* .OBJDIR: pathname Target destination dir */
extern	int	ObjSearch;	/* .OBJSEARCH: searchtype for explicit rules */
extern	list_t	*SearchList;	/* .SEARCHLIST: list of src/obj dir pairs   */
extern	list_t	*Suffixes;	/* .SUFFIXES: list of suffixes (POSIX)	    */
extern	BOOL	SSuffrules;	/* Found any simple suffix rules	    */
extern	obj_t	*Init;		/* .INIT: command to execute at startup	    */
extern	obj_t	*Done;		/* .DONE: command do execute on success	    */
extern	obj_t	*Failed;	/* .FAILED: command to execute on failure   */
extern	obj_t	*IncludeFailed;	/* .INCLUDEFAILED: cmd to execute if missing */
extern	obj_t	*Deflt;		/* .DEFAULT: command to execute if no rule  */
extern	obj_t	*Precious;	/* .PRECIOUS: list of targets not to remove */
extern	obj_t	*Phony;		/* .PHONY: list of false targets, no check  */
extern	obj_t	*default_tgt;	/* Current or Default target		    */
extern	date_t	curtime;	/* current fime				    */
extern	date_t	newtime;	/* Special time newer than all	XXX	    */
extern	char	*gbuf;		/* Global growable buffer		    */
extern	char	*gbufend;	/* Current end of growable buffer	    */
extern	int	gbufsize;	/* Current size of buffer (bufend - buf)    */
extern	BOOL	found_make;	/* Did we expand the $(MAKE) macro?	    */

extern	int	lastc;		/* last input character			    */
extern	int	firstc;		/* first character in line		    */
extern	char	*mfname;	/* name of current make file		    */
extern	int	lineno;		/* current line number			    */
extern	int	col;		/* current column			    */

extern	char	Nullstr[];	/* global empty string			    */
extern	obj_t	*NullObj;	/* global empty string obj		    */
extern	char	slash[];	/* string holding path delimiter	    */
#define	SLASH	PATH_DELIM

extern	patr_t	*Patrules;
extern	patr_t	**pattail;

extern	char	chartype[256];

#define	DYNCHAR	0x01
#define	NUMBER	0x02