0001-update-to-bmake-20131001.patch

kAworu, 11/22/2013 07:57 AM

Download (504 KB)

View differences:

contrib/bmake/ChangeLog
1
2013-10-01  Simon J. Gerraty  <sjg@bad.crufty.net>
2

  
3
	* Makefile (MAKE_VERSION): 20131001
4
	  Merge with NetBSD make, pick up
5
	  o main.c: for NATIVE build sysctl to get MACHINE_ARCH from
6
	    hw.machine_arch if necessary.
7
	  o meta.c: meta_oodate - need to look at src of Link and target
8
	    of Move as well.
9
	* main.c: check that CTL_HW and HW_MACHINE_ARCH exist.
10
	  provide __arraycount() if needed.
11

  
12
2013-09-04  Simon J. Gerraty  <sjg@bad.crufty.net>
13

  
14
	* Makefile (MAKE_VERSION): 20130904
15
	  Merge with NetBSD make, pick up
16
	  o Add VAR_INTERNAL context, so that internal setting of
17
	    MAKEFILE does not override value set by makefiles.
18

  
19
2013-09-02  Simon J. Gerraty  <sjg@bad.crufty.net>
20

  
21
	* Makefile (MAKE_VERSION): 20130902
22
	  Merge with NetBSD make, pick up
23
	  o CompatRunCommand: only apply shellErrFlag when errCheck is true
24

  
25
2013-08-28  Simon J. Gerraty  <sjg@bad.crufty.net>
26

  
27
	* Makefile (MAKE_VERSION): 20130828
28
	  Merge with NetBSD make, pick up
29
	  o Fix VAR :sh = syntax from Will Andrews at freebsd.org
30
	  o Call Job_SetPrefix() from Job_Init() so makefiles have
31
	    opportunity to set .MAKE.JOB.PREFIX
32

  
33
2013-07-30  Simon J. Gerraty  <sjg@bad.crufty.net>
34

  
35
	* Makefile (MAKE_VERSION): 20130730
36
	  Merge with NetBSD make, pick up
37
	  o Allow suppression of --- job -- tokens by setting
38
	    .MAKE.JOB.PREFIX empty.
39

  
40
2013-07-16  Simon J. Gerraty  <sjg@bad.crufty.net>
41

  
42
	* Makefile (MAKE_VERSION): 20130716
43
	  Merge with NetBSD make, pick up
44
	  o number of gmake compatability tweaks
45
	    -w for gmake style entering/leaving messages
46
	    if .MAKE.LEVEL > 0 indicate it in progname "make[1]" etc.
47
	    handle MAKEFLAGS containing only letters.
48
	  o when overriding a GLOBAL variable on the command line,
49
	    delete it from GLOBAL context so -V doesn't show the wrong
50
	    value.
51
	
52
2013-07-06  Simon J. Gerraty  <sjg@bad.crufty.net>
53

  
54
	* configure.in: We don't need MAKE_LEVEL_SAFE anymore.
55

  
56
	* Makefile (MAKE_VERSION): 20130706
57
	  Merge with NetBSD make, pick up
58
	  o Shell_Init(): export shellErrFlag if commandShell hasErrCtl is
59
	    true so that CompatRunCommand() can use it, to ensure
60
	    consistent behavior with jobs mode.
61
	  o use MAKE_LEVEL_ENV to define the variable to propagate
62
	    .MAKE.LEVEL - currently set to MAKELEVEL (same as gmake).
63
	  o meta.c: use .MAKE.META.IGNORE_PATHS to allow customization of
64
	    paths to ignore.
65

  
66
2013-06-04  Simon J. Gerraty  <sjg@bad.crufty.net>
67

  
68
	* Makefile (MAKE_VERSION): 20130604
69
	  Merge with NetBSD make, pick up
70
	  o job.c: JobCreatePipe: do fcntl() after any tweaking of fd's
71
	    to avoid leaking descriptors.
72

  
73
2013-05-28  Simon J. Gerraty  <sjg@bad.crufty.net>
74

  
75
	* Makefile (MAKE_VERSION): 20130528
76
	  Merge with NetBSD make, pick up
77
	  o var.c: cleanup some left-overs in VarHash()
78

  
79
2013-05-20  Simon J. Gerraty  <sjg@bad.crufty.net>
80

  
81
	* Makefile (MAKE_VERSION): 20130520
82
	  generate manifest from component FILES rather than have to
83
	  update FILES when mk/FILES changes.
84

  
85
2013-05-18  Simon J. Gerraty  <sjg@bad.crufty.net>
86

  
87
	* Makefile (MAKE_VERSION): 20130518
88
	  Merge with NetBSD make, pick up
89
	  o suff.c: don't skip all processsing for .PHONY targets
90
	    else wildcard srcs do not get expanded.
91
	  o var.c: expand name of variable to delete if necessary.
92

  
93
2013-03-30  Simon J. Gerraty  <sjg@bad.crufty.net>
94

  
95
	* Makefile (MAKE_VERSION): 20130330
96
	  Merge with NetBSD make, pick up
97
	  o meta.c: refine the handling of .OODATE in commands.
98
	    Rather than suppress command comparison for the entire script
99
	    as though .NOMETA_CMP had been used, only suppress it for the
100
	    one command line.
101
	    This allows something like ${.OODATE:M.NOMETA_CMP} to be used to 
102
	    suppress comparison of a command without otherwise affecting it.
103
	  o make.1: document that
104

  
105
2013-03-22  Simon J. Gerraty  <sjg@bad.crufty.net>
106

  
107
	* Makefile (MAKE_VERSION): 20130321
108
	  yes, not quite right but its a cooler number.
109
	  Merge with NetBSD make, pick up
110
	  o parse.c: fix ParseGmakeExport to be portable 
111
	    and add a unit-test.
112
	* meta.c: call meta_init() before makefiles are read and if built
113
	  with filemon support set .MAKE.PATH_FILEMON to _PATH_FILEMON
114
	  this let's makefiles test for support.
115
	  Call meta_mode_init() to process .MAKE.MODE.
116

  
117
2013-03-13  Simon J. Gerraty  <sjg@bad.crufty.net>
118

  
119
	* Makefile (MAKE_VERSION): 20130305
120
	  Merge with NetBSD make, pick up
121
	  o run .STALE: target when a dependency from .depend is missing.
122
	  o job.c: add Job_RunTarget() for the above and .BEGIN
123

  
124
2013-03-03  Simon J. Gerraty  <sjg@bad.crufty.net>
125

  
126
	* Makefile (MAKE_VERSION): 20130303
127
	  Merge with NetBSD make, pick up
128
	  o main.c: set .MAKE.OS to utsname.sysname
129
	  o job.c: more checks for read and poll errors
130
	  o var.c: lose VarChangeCase() saves 4% time
131

  
132
2013-03-02  Simon J. Gerraty  <sjg@bad.crufty.net>
133

  
134
	* boot-strap: remove MAKEOBJDIRPREFIX from environment since we
135
	  want to use MAKEOBJDIR
136

  
137
2013-01-27  Simon J. Gerraty  <sjg@bad.crufty.net>
138

  
139
	* Merge with NetBSD make, pick up
140
	  o make.1: more info on how shell commands are handled.
141
	  o job.c,main.c: detect write errors to job pipes.
142

  
143
2013-01-25  Simon J. Gerraty  <sjg@bad.crufty.net>
144

  
145
	* Makefile (MAKE_VERSION): 20130123
146
	  Merge with NetBSD make, pick up
147
	  o meta.c: if script uses .OODATE and meta_oodate() decides
148
	    rebuild is needed, .OODATE will be empty - set it to .ALLSRC.
149
	  o var.c: in debug output indicate which variabale modifiers
150
	    apply to.
151
	  o remove Check_Cwd logic the makefiles have been fixed.
152
	
153
2012-12-12  Simon J. Gerraty  <sjg@bad.crufty.net>
154

  
155
	* makefile.in: add a simple makefile for folk who insist on
156
	  ./configure; make; make install
157
	  it just runs boot-strap
158
	* include mk/* to accommodate the above
159
	* boot-strap:  re-work to accommodate the above
160
	  mksrc defaults to $Mydir/mk
161
	  allow op={configure,build,install,clean,all}
162
	  add options to facilitate install
163
	* Makefile.config.in: just the bits set by configure
164
	* Makefile: bump version to 20121212
165
	  abandon Makefile.in (NetBSD Makefile)
166
	  leverage mk/* instead
167
	* configure.in: ensure srcdir is absolute
168

  
169
2012-11-11  Simon J. Gerraty  <sjg@bad.crufty.net>
170

  
171
	* Makefile.in (MAKE_VERSION): 20121111
172
	  fix generation of bmake.cat1
173

  
174
2012-11-09  Simon J. Gerraty  <sjg@bad.crufty.net>
175

  
176
	* Makefile.in (MAKE_VERSION): 20121109
177
	  Merge with NetBSD make, pick up
178
	  o make.c: MakeBuildChild: return 0 so search continues if a
179
	    .ORDER dependency is detected.
180
	  o unit-tests/order: test the above
181
	
182
2012-11-02  Simon J. Gerraty  <sjg@bad.crufty.net>
183

  
184
	* Makefile.in (MAKE_VERSION): 20121102
185
	  Merge with NetBSD make, pick up
186
	  o cond.c: allow cond_state[] to grow.
187
	    In meta mode with a very large tree, we can hit the limit
188
	    while processing dirdeps.
189
	
190
2012-10-25  Simon J. Gerraty  <sjg@bad.crufty.net>
191

  
192
	* Makefile.in: we need to use ${srcdir} not ${.CURDIR}
193

  
1 194
2012-10-10  Simon J. Gerraty  <sjg@bad.crufty.net>
2 195

  
3 196
	* Makefile.in (MAKE_VERSION): 20121010
contrib/bmake/FILES
1
FILES
2 1
ChangeLog
3
bmake.cat1
4
boot-strap
5
bsd.after-import.mk
6
os.sh
7
Makefile.in
2
FILES
3
Makefile
4
Makefile.config.in
8 5
PSD.doc/Makefile
9 6
PSD.doc/tutorial.ms
10 7
README
8
aclocal.m4
11 9
arch.c
10
bmake.1
11
bmake.cat1
12
boot-strap
13
bsd.after-import.mk
12 14
buf.c
13 15
buf.h
14 16
compat.c
15 17
cond.c
16
make-conf.h
17
make_malloc.c
18
make_malloc.h
19 18
config.h.in
20 19
configure
21
aclocal.m4
22 20
configure.in
23 21
dir.c
24 22
dir.h
23
dirname.c
25 24
find_lib.sh
26 25
for.c
27 26
getopt.c
......
30 29
install-sh
31 30
job.c
32 31
job.h
33
meta.c
34
meta.h
35
dirname.c
36
realpath.c
37
strlcpy.c
38
strlist.c
39
strlist.h
40
stresep.c
41
trace.c
42
trace.h
43 32
lst.h
44 33
lst.lib/Makefile
45 34
lst.lib/lstAppend.c
......
72 61
lst.lib/lstSucc.c
73 62
machine.sh
74 63
main.c
64
make-bootstrap.sh.in
65
make-conf.h
75 66
make.1
76
bmake.1
77 67
make.c
78 68
make.h
79
make-bootstrap.sh.in
69
make_malloc.c
70
make_malloc.h
71
makefile.in
72
meta.c
73
meta.h
80 74
missing/sys/cdefs.h
81 75
mkdeps.sh
82 76
nonints.h
77
os.sh
83 78
parse.c
84 79
pathnames.h
85 80
ranlib.h
81
realpath.c
86 82
setenv.c
87 83
sigcompat.c
88 84
sprite.h
89 85
str.c
86
stresep.c
87
strlcpy.c
88
strlist.c
89
strlist.h
90 90
suff.c
91 91
targ.c
92
util.c
93
var.c
94
wait.h
92
trace.c
93
trace.h
95 94
unit-tests/Makefile.in
96 95
unit-tests/comment
97 96
unit-tests/cond1
......
100 99
unit-tests/error
101 100
unit-tests/export
102 101
unit-tests/export-all
102
unit-tests/export-env
103 103
unit-tests/forloop
104 104
unit-tests/forsubst
105 105
unit-tests/hash
......
110 110
unit-tests/modorder
111 111
unit-tests/modts
112 112
unit-tests/modword
113
unit-tests/order
113 114
unit-tests/phony-end
114 115
unit-tests/posix
115 116
unit-tests/qequals
117
unit-tests/sunshcmd
116 118
unit-tests/sysv
117 119
unit-tests/ternary
118 120
unit-tests/test.exp
119 121
unit-tests/unexport
120 122
unit-tests/unexport-env
121 123
unit-tests/varcmd
124
util.c
125
var.c
126
wait.h
contrib/bmake/Makefile
1
#	$Id: Makefile,v 1.21 2013/10/01 15:44:05 sjg Exp $
2

  
3
# Base version on src date
4
MAKE_VERSION= 20131001
5

  
6
PROG=	bmake
7

  
8
SRCS= \
9
	arch.c \
10
	buf.c \
11
	compat.c \
12
	cond.c \
13
	dir.c \
14
	for.c \
15
	hash.c \
16
	job.c \
17
	main.c \
18
	make.c \
19
	make_malloc.c \
20
	meta.c \
21
	parse.c \
22
	str.c \
23
	strlist.c \
24
	suff.c \
25
	targ.c \
26
	trace.c \
27
	util.c \
28
	var.c
29

  
30
# from lst.lib/
31
SRCS+= \
32
	lstAppend.c \
33
	lstAtEnd.c \
34
	lstAtFront.c \
35
	lstClose.c \
36
	lstConcat.c \
37
	lstDatum.c \
38
	lstDeQueue.c \
39
	lstDestroy.c \
40
	lstDupl.c \
41
	lstEnQueue.c \
42
	lstFind.c \
43
	lstFindFrom.c \
44
	lstFirst.c \
45
	lstForEach.c \
46
	lstForEachFrom.c \
47
	lstInit.c \
48
	lstInsert.c \
49
	lstIsAtEnd.c \
50
	lstIsEmpty.c \
51
	lstLast.c \
52
	lstMember.c \
53
	lstNext.c \
54
	lstOpen.c \
55
	lstPrev.c \
56
	lstRemove.c \
57
	lstReplace.c \
58
	lstSucc.c
59

  
60
# this file gets generated by configure
61
.-include "Makefile.config"
62

  
63
.if !empty(LIBOBJS)
64
SRCS+= ${LIBOBJS:T:.o=.c}
65
.endif
66

  
67
# just in case
68
prefix?= /usr
69
srcdir?= ${.CURDIR}
70

  
71
DEFAULT_SYS_PATH?= .../share/mk:${prefix}/share/mk
72

  
73
CPPFLAGS+= -DUSE_META
74
CFLAGS+= ${CPPFLAGS}
75
CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
76
CFLAGS+= -I. -I${srcdir} ${XDEFS} -DMAKE_NATIVE
77
CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
78
COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
79

  
80
# meta mode can be useful even without filemon 
81
FILEMON_H ?= /usr/include/dev/filemon/filemon.h
82
.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
83
COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
84
.endif
85

  
86
.PATH:	${srcdir}
87
.PATH:	${srcdir}/lst.lib
88

  
89
.if make(obj) || make(clean)
90
SUBDIR+= unit-tests
91
.endif
92

  
93
# start-delete1 for bsd.after-import.mk
94
# we skip a lot of this when building as part of FreeBSD etc.
95

  
96
# list of OS's which are derrived from BSD4.4
97
BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly
98
# we are...
99
OS!= uname -s
100
# are we 4.4BSD ?
101
isBSD44:=${BSD44_LIST:M${OS}}
102

  
103
.if ${isBSD44} == ""
104
MANTARGET= cat
105
INSTALL?=${srcdir}/install-sh
106
.if (${MACHINE} == "sun386")
107
# even I don't have one of these anymore :-)
108
CFLAGS+= -DPORTAR
109
.elif (${MACHINE} != "sunos")
110
SRCS+= sigcompat.c
111
CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
112
.endif
113
.else
114
MANTARGET?= man
115
.endif
116

  
117
# turn this on by default - ignored if we are root
118
WITH_INSTALL_AS_USER=
119

  
120
# supress with -DWITHOUT_*
121
OPTIONS_DEFAULT_YES+= \
122
	AUTOCONF_MK \
123
	INSTALL_MK \
124
	PROG_LINK
125

  
126
OPTIONS_DEFAULT_NO+= \
127
	PROG_VERSION
128

  
129
# process options now
130
.include <own.mk>
131

  
132
.if ${MK_PROG_VERSION} == "yes"
133
PROG_NAME= ${PROG}-${MAKE_VERSION}
134
.if ${MK_PROG_LINK} == "yes"
135
SYMLINKS+= ${PROG}-${MAKE_VERSION} ${BINDIR}/${PROG}
136
.endif
137
.endif
138

  
139
EXTRACT_MAN=no
140
# end-delete1
141

  
142
MAN= ${PROG}.1
143
MAN1= ${MAN}
144

  
145
.if (${PROG} != "make")
146
CLEANFILES+= my.history
147
.if make(${MAN}) || !exists(${srcdir}/${MAN})
148
my.history: ${MAKEFILE}
149
	@(echo ".Nm"; \
150
	echo "is derived from NetBSD"; \
151
	echo ".Xr make 1 ."; \
152
	echo "It uses autoconf to facilitate portability to other platforms."; \
153
	echo ".Pp") > $@
154

  
155
.NOPATH: ${MAN}
156
${MAN}:	make.1 my.history
157
	@echo making $@
158
	@sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
159
	-e '/^.Sh HISTORY/rmy.history' \
160
	-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
161

  
162
all beforeinstall: ${MAN}
163
_mfromdir=.
164
.endif
165
.endif
166

  
167
MANTARGET?= cat
168
MANDEST?= ${MANDIR}/${MANTARGET}1
169

  
170
.if ${MANTARGET} == "cat"
171
_mfromdir=${srcdir}
172
.endif
173

  
174
.include <prog.mk>
175

  
176
CPPFLAGS+= -DMAKE_NATIVE -DHAVE_CONFIG_H
177
COPTS.var.c += -Wno-cast-qual
178
COPTS.job.c += -Wno-format-nonliteral
179
COPTS.parse.c += -Wno-format-nonliteral
180
COPTS.var.c += -Wno-format-nonliteral
181

  
182
# Force these
183
SHAREDIR= ${prefix}/share
184
BINDIR= ${prefix}/bin
185
MANDIR= ${SHAREDIR}/man
186

  
187
.if !exists(.depend)
188
${OBJS}: config.h
189
.endif
190

  
191
# make sure that MAKE_VERSION gets updated.
192
main.o: ${SRCS} ${MAKEFILE}
193

  
194
# start-delete2 for bsd.after-import.mk
195
.if ${MK_AUTOCONF_MK} == "yes"
196
.include <autoconf.mk>
197
.endif
198
SHARE_MK?=${SHAREDIR}/mk
199
MKSRC=${srcdir}/mk
200
INSTALL?=${srcdir}/install-sh
201

  
202
.if ${MK_INSTALL_MK} == "yes"
203
install: install-mk
204
.endif
205

  
206
beforeinstall:
207
	test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
208
	test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
209

  
210
install-mk:
211
.if exists(${MKSRC}/install-mk)
212
	test -d ${DESTDIR}${SHARE_MK} || ${INSTALL} -m 775 -d ${DESTDIR}${SHARE_MK}
213
	sh ${MKSRC}/install-mk -v -m 644 ${DESTDIR}${SHARE_MK}
214
.else
215
	@echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
216
.endif
217
# end-delete2
218

  
219
# A simple unit-test driver to help catch regressions
220
accept test:
221
	cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
contrib/bmake/Makefile.config.in
1
# things set by configure
2

  
3
prefix= @prefix@
4
srcdir= @srcdir@
5
CC?= @CC@
6
MACHINE= @machine@
7
MACHINE_ARCH= @machine_arch@
8
DEFAULT_SYS_PATH= @default_sys_path@
9

  
10
CPPFLAGS+= @CPPFLAGS@
11
CFLAGS+= ${CPPFLAGS} @DEFS@
12
LDFLAGS= @LDFLAGS@
13
LIBOBJS= @LIBOBJS@
14
LDADD= @LIBS@
15
USE_META= @use_meta@
16
FILEMON_H= @filemon_h@
contrib/bmake/Makefile.in
1
#	$NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
2
#	@(#)Makefile	5.2 (Berkeley) 12/28/90
3

  
4
#	$Id: Makefile.in,v 1.174 2012/10/10 18:46:24 sjg Exp $
5

  
6
PROG=	bmake
7
SRCS=	arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
8
	make.c parse.c str.c suff.c targ.c trace.c var.c util.c 
9
SRCS+=  strlist.c
10
SRCS+=  make_malloc.c
11
SRCS+=	lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
12
	lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
13
	lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
14
	lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
15
	lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
16
SRCS += lstPrev.c
17

  
18
# you can use this Makefile if you have an earlier version of bmake.
19
prefix= @prefix@
20
srcdir= @srcdir@
21
CC?= @CC@
22

  
23
# Base version on src date
24
MAKE_VERSION= 20121010
25
MACHINE=@machine@
26
MACHINE_ARCH=@machine_arch@
27
DEFAULT_SYS_PATH = @default_sys_path@
28

  
29
CPPFLAGS+= @CPPFLAGS@
30
CFLAGS+= ${CPPFLAGS}
31
CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
32
CFLAGS+= -I. -I${srcdir} @DEFS@ ${XDEFS} -DMAKE_NATIVE
33
CFLAGS+= ${CFLAGS_${.TARGET:T}} 
34
CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
35
COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
36
LDFLAGS= @LDFLAGS@
37
LIBOBJS= @LIBOBJS@
38
LDADD= @LIBS@
39

  
40
.if !empty(LIBOBJS)
41
SRCS+= ${LIBOBJS:T:.o=.c}
42
.endif
43

  
44
USE_META = @use_meta@
45
.if ${USE_META} != "no"
46
SRCS+=	meta.c
47
CPPFLAGS+= -DUSE_META
48
FILEMON_H ?= @filemon_h@
49
.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
50
COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
51
.endif
52
.endif
53

  
54
.PATH:	${srcdir}
55
.PATH:	${srcdir}/lst.lib
56

  
57
OS!= uname -s
58
ARCH!= uname -p 2>/dev/null || uname -m
59

  
60
# list of OS's which are derrived from BSD4.4
61
isBSD44= NetBSD FreeBSD OpenBSD DragonFly
62

  
63
.if ${OS} == "NetBSD"
64
# Don't set these for anyone else since we don't know what the effect may be.
65
# On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
66
WFORMAT= 1
67
WARNS=4
68
.NOPATH: bmake.cat1
69
.if make(install) && exists(${DESTDIR}/usr/share/doc)
70
SUBDIR=	PSD.doc
71
.endif
72
.endif
73

  
74
.if defined(.PARSEDIR) 
75
# we cannot rely on anything but bmake to parse this correctly.
76
.if empty(isBSD44:M${OS})
77
MANTARGET=cat
78
INSTALL?=${srcdir}/install-sh
79
.if (${MACHINE} == "sun386")
80
# even I don't have one of these anymore :-)
81
CFLAGS+= -DPORTAR
82
.elif (${MACHINE} != "sunos")
83
SRCS+= sigcompat.c
84
CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
85
.endif
86
.endif
87

  
88
.if make(obj) || make(clean)
89
SUBDIR+= unit-tests
90
.endif
91
.endif
92

  
93
# many systems use gcc these days
94
CC_IS_GCC=@GCC@
95
.if ${CC_IS_GCC} == "yes"
96
# problem with gcc3
97
CFLAGS_var.o+= -Wno-cast-qual
98
.endif
99

  
100
CFLAGS_main.o+= "-D@force_machine@MACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
101

  
102
EXTRACT_MAN=no
103

  
104
MAN=${PROG}.1
105
.if (${PROG} != "make")
106
my.history: ${MAKEFILE}
107
	@(echo ".Nm"; \
108
	echo "is derived from NetBSD"; \
109
	echo ".Xr make 1 ."; \
110
	echo "It uses autoconf to facilitate portability to other platforms."; \
111
	echo ".Pp") > $@
112

  
113
${MAN}:	make.1 my.history
114
	@echo making ${PROG}.1
115
	@sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
116
	-e '/^.Sh HISTORY/rmy.history' \
117
	-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${.CURDIR}/make.1 > $@
118

  
119
.endif
120

  
121
.if !empty(isBSD44:M${OS})
122
.if "${OS}" != "NetBSD" 
123
MAN1=${MAN}
124
.endif
125
MANTARGET?=man
126
.endif
127

  
128
MANTARGET?= cat
129
MANDEST?= ${MANDIR}/${MANTARGET}1
130

  
131
.if ${MANTARGET} == "cat"
132
_mfromdir=${srcdir}
133
.endif
134

  
135
.if exists(${srcdir}/../Makefile.inc)
136
.include "${srcdir}/../Makefile.inc"
137
.endif
138
.-include <bsd.prog.mk>
139
# sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
140
# so the inclusion below, results in complaints about re-defined
141
# targets.  For NetBSD though we need to explicitly include it.
142
.if defined(.PARSEDIR)
143
.if defined(SUBDIR) && !target(${SUBDIR:[1]})
144
.-include <bsd.subdir.mk>
145
.endif
146
.endif
147

  
148
CPPFLAGS+= -DMAKE_NATIVE
149
COPTS.var.c += -Wno-cast-qual
150
COPTS.job.c += -Wno-format-nonliteral
151
COPTS.parse.c += -Wno-format-nonliteral
152
COPTS.var.c += -Wno-format-nonliteral
153

  
154
# Force these
155
BINDIR= ${prefix}/bin
156
MANDIR= ${prefix}/man
157

  
158
arch.o:	config.h
159
# make sure that MAKE_VERSION gets updated.
160
main.o: ${SRCS} ${MAKEFILE}
161

  
162
MK?=${prefix}/share/mk
163
MKSRC?=@mksrc@
164
INSTALL?=${srcdir}/install-sh
165

  
166
beforeinstall:
167
	test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
168
	test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
169

  
170
# latest version of *.mk includes an installer.
171
# you should not need to  set USE_OS
172
install-mk:
173
.if exists(${MKSRC}/install-mk)
174
	test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
175
	${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
176
.else
177
	@echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
178
.endif
179

  
180
.ifdef TOOLDIR
181
# this is a native netbsd build, 
182
# use libutil rather than the local emalloc etc.
183
CPPFLAGS+= -DUSE_EMALLOC
184
LDADD+=-lutil
185
DPADD+=${LIBUTIL}
186
.endif
187

  
188
# A simple unit-test driver to help catch regressions
189
accept test:
190
	cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
contrib/bmake/bmake.1
1
.\"	$NetBSD: make.1,v 1.209 2012/10/08 15:09:48 christos Exp $
1
.\"	$NetBSD: make.1,v 1.222 2013/08/11 09:53:49 apb Exp $
2 2
.\"
3 3
.\" Copyright (c) 1990, 1993
4 4
.\"	The Regents of the University of California.  All rights reserved.
......
29 29
.\"
30 30
.\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
31 31
.\"
32
.Dd October 8, 2012
32
.Dd August 11, 2013
33 33
.Dt MAKE 1
34 34
.Os
35 35
.Sh NAME
......
37 37
.Nd maintain program dependencies
38 38
.Sh SYNOPSIS
39 39
.Nm
40
.Op Fl BeikNnqrstWX
40
.Op Fl BeikNnqrstWwX
41 41
.Op Fl C Ar directory
42 42
.Op Fl D Ar variable
43 43
.Op Fl d Ar flags
......
209 209
option to print raw values of variables.
210 210
.It Ar v
211 211
Print debugging information about variable assignment.
212
.It Ar w
213
Print entering and leaving directory messages, pre and post processing.
212 214
.It Ar x
213 215
Run shell commands with
214 216
.Fl x
......
468 470
A
469 471
.Ql Ic \-
470 472
causes any non-zero exit status of the command line to be ignored.
473
.Pp
474
When
475
.Nm
476
is run in jobs mode with
477
.Fl j Ar max_jobs ,
478
the entire script for the target is fed to a
479
single instance of the shell.
480
.Pp
481
In compatibility (non-jobs) mode, each command is run in a separate process.
482
If the command contains any shell meta characters
483
.Pq Ql #=|^(){};&<>*?[]:$`\e\en
484
it will be passed to the shell, otherwise
485
.Nm
486
will attempt direct execution.
487
.Pp
488
Since
489
.Nm
490
will
491
.Xr chdir 2
492
to
493
.Ql Va .OBJDIR
494
before executing any targets, each child process
495
starts with that as its current working directory.
496
.Pp
497
Makefiles should be written so that the mode of
498
.Nm
499
operation does not change their behavior.
500
For example, any command which needs to use
501
.Dq cd
502
or
503
.Dq chdir ,
504
without side-effect should be put in parenthesis:
505
.Bd -literal -offset indent
506

  
507
avoid-chdir-side-effects:
508
	@echo Building $@ in `pwd`
509
	@(cd ${.CURDIR} && ${.MAKE} $@)
510
	@echo Back in `pwd`
511

  
512
ensure-one-shell-regardless-of-mode:
513
	@echo Building $@ in `pwd`; \\
514
	(cd ${.CURDIR} && ${.MAKE} $@); \\
515
	echo Back in `pwd`
516
.Ed
471 517
.Sh VARIABLE ASSIGNMENTS
472 518
Variables in make are much like variables in the shell, and, by tradition,
473 519
consist of all upper-case letters.
......
699 745
.Ql --- target ---
700 746
the first part of which can be controlled via
701 747
.Va .MAKE.JOB.PREFIX .
748
If 
749
.Va .MAKE.JOB.PREFIX
750
is empty, no token is printed.
702 751
.br
703 752
For example:
704 753
.Li .MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
......
812 861
used (updated or not).
813 862
This list can be used to process the meta files to extract dependency
814 863
information.
864
.It Va .MAKE.META.IGNORE_PATHS
865
Provides a list of path prefixes that should be ignored;
866
because the contents are expected to change over time.
867
The default list includes:
868
.Ql Pa /dev /etc /proc /tmp /var/run /var/tmp
815 869
.It Va .MAKE.META.PREFIX
816 870
Defines the message printed for each meta file updated in "meta verbose" mode.
817 871
The default value is:
......
830 884
is re-exported whenever
831 885
.Ql Va .MAKEOVERRIDES
832 886
is modified.
887
.It Va .MAKE.PATH_FILEMON
888
If
889
.Nm
890
was built with
891
.Xr filemon 4
892
support, this is set to the path of the device node.
893
This allows makefiles to test for this support.
833 894
.It Va .MAKE.PID
834 895
The process-id of
835 896
.Nm .
......
1247 1308
For example.
1248 1309
.Dl ${LINKS:@.LINK.@${LN} ${TARGET} ${.LINK.}@}
1249 1310
.Pp
1250
However a single character varaiable is often more readable:
1311
However a single character variable is often more readable:
1251 1312
.Dl ${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'${.newline}@}
1252 1313
.It Cm \&:U Ns Ar newval
1253 1314
If the variable is undefined
......
1270 1331
is the value.
1271 1332
If no such node exists or its path is null, then the
1272 1333
name of the variable is used.
1273
In order for this modifier to work, the name (node) must at least have 
1334
In order for this modifier to work, the name (node) must at least have
1274 1335
appeared on the rhs of a dependency.
1275 1336
.Sm off
1276 1337
.It Cm \&:\&! Ar cmd Cm \&!
......
1713 1774
Ignore differences in commands when deciding if target is out of date.
1714 1775
This is useful if the command contains a value which always changes.
1715 1776
If the number of commands change, though, the target will still be out of date.
1777
The same effect applies to any command line that uses the variable
1778
.Va .OODATE ,
1779
which can be used for that purpose even when not otherwise needed or desired:
1780
.Bd -literal -offset indent
1781

  
1782
skip-compare-for-some:
1783
	@echo this will be compared
1784
	@echo this will not ${.OODATE:M.NOMETA_CMP}
1785
	@echo this will also be compared
1786

  
1787
.Ed
1788
The
1789
.Cm \&:M
1790
pattern suppresses any expansion of the unwanted variable.
1716 1791
.It Ic .NOPATH
1717 1792
Do not search for the target in the directories specified by
1718 1793
.Ic .PATH .
......
1896 1971
.Ic .DOTLAST
1897 1972
target, then the current working
1898 1973
directory is searched last.
1974
.It Ic .PATH. Ns Va suffix
1975
Like
1976
.Ic .PATH
1977
but applies only to files with a particular suffix.
1978
The suffix must have been previously declared with
1979
.Ic .SUFFIXES .
1899 1980
.It Ic .PHONY
1900 1981
Apply the
1901 1982
.Ic .PHONY
......
1964 2045
.Ic .SILENT
1965 2046
attribute is applied to every
1966 2047
command in the file.
2048
.It Ic .STALE
2049
This target gets run when a dependency file contains stale entries, having
2050
.Va .ALLSRC
2051
set to the name of that dependency file.
1967 2052
.It Ic .SUFFIXES
1968 2053
Each source specifies a suffix to
1969 2054
.Nm .
......
2027 2112
so that they still appear to be variable expansions.
2028 2113
In particular this stops them being treated as syntax, and removes some
2029 2114
obscure problems using them in .if statements.
2030
.Pp
2031
Unlike other
2032
.Nm
2033
programs, this implementation by default executes all commands for a given
2034
target using a single shell invocation.
2035
This is done for both efficiency and to simplify error handling in remote
2036
command invocations.
2037
Typically this is transparent to the user, unless the target commands change
2038
the current working directory using
2039
.Dq cd
2040
or
2041
.Dq chdir .
2042
To be compatible with Makefiles that do this, one can use
2043
.Fl B
2044
to disable this behavior.
2045
.Pp
2046
In compatibility mode, each command is run in a separate process.
2047
If the command contains any shell meta characters
2048
.Pq Ql #=|^(){};&<>*?[]:$`\e\en
2049
it will be passed to the shell, otherwise
2050
.Nm
2051
will attempt direct execution.
2052 2115
.Sh SEE ALSO
2053 2116
.Xr mkdep 1
2054 2117
.Sh HISTORY
......
2068 2131
It was designed to be a parallel distributed make running jobs on different
2069 2132
machines using a daemon called
2070 2133
.Dq customs .
2134
.Pp
2135
Historically the target/dependency
2136
.Dq FRC
2137
has been used to FoRCe rebuilding (since the target/dependency
2138
does not exist... unless someone creates an
2139
.Dq FRC
2140
file).
2071 2141
.Sh BUGS
2072 2142
The
2073 2143
make
contrib/bmake/bmake.cat1
4 4
     bbmmaakkee -- maintain program dependencies
5 5

  
6 6
SSYYNNOOPPSSIISS
7
     bbmmaakkee [--BBeeiikkNNnnqqrrssttWWXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s]
7
     bbmmaakkee [--BBeeiikkNNnnqqrrssttWWwwXX] [--CC _d_i_r_e_c_t_o_r_y] [--DD _v_a_r_i_a_b_l_e] [--dd _f_l_a_g_s]
8 8
           [--ff _m_a_k_e_f_i_l_e] [--II _d_i_r_e_c_t_o_r_y] [--JJ _p_r_i_v_a_t_e] [--jj _m_a_x___j_o_b_s]
9 9
           [--mm _d_i_r_e_c_t_o_r_y] [--TT _f_i_l_e] [--VV _v_a_r_i_a_b_l_e] [_v_a_r_i_a_b_l_e_=_v_a_l_u_e]
10 10
           [_t_a_r_g_e_t _._._.]
......
122 122

  
123 123
             _v       Print debugging information about variable assignment.
124 124

  
125
             _x       Run shell commands with --xx so the actual commands are
126
                     printed as they are executed.
127

  
128
     --ee      Specify that environment variables override macro assignments
129
             within makefiles.
130

  
131
     --ff _m_a_k_e_f_i_l_e
132
             Specify a makefile to read instead of the default `_m_a_k_e_f_i_l_e'.  If
133
             _m_a_k_e_f_i_l_e is `--', standard input is read.  Multiple makefiles may
134
             be specified, and are read in the order specified.
135

  
136
     --II _d_i_r_e_c_t_o_r_y
137
             Specify a directory in which to search for makefiles and included
138
             makefiles.  The system makefile directory (or directories, see
139
             the --mm option) is automatically included as part of this list.
140

  
141
     --ii      Ignore non-zero exit of shell commands in the makefile.  Equiva-
142
             lent to specifying `--' before each command line in the makefile.
143

  
144
     --JJ _p_r_i_v_a_t_e
145
             This option should _n_o_t be specified by the user.
146

  
147
             When the _j option is in use in a recursive build, this option is
148
             passed by a make to child makes to allow all the make processes
149
             in the build to cooperate to avoid overloading the system.
150

  
151
     --jj _m_a_x___j_o_b_s
152
             Specify the maximum number of jobs that bbmmaakkee may have running at
153
             any one time.  The value is saved in _._M_A_K_E_._J_O_B_S.  Turns compati-
154
             bility mode off, unless the _B flag is also specified.  When com-
155
             patibility mode is off, all commands associated with a target are
156
             executed in a single shell invocation as opposed to the tradi-
157
             tional one shell invocation per line.  This can break traditional
158
             scripts which change directories on each command invocation and
159
             then expect to start with a fresh environment on the next line.
160
             It is more efficient to correct the scripts rather than turn
161
             backwards compatibility on.
162

  
163
     --kk      Continue processing after errors are encountered, but only on
164
             those targets that do not depend on the target whose creation
165
             caused the error.
166

  
167
     --mm _d_i_r_e_c_t_o_r_y
168
             Specify a directory in which to search for sys.mk and makefiles
169
             included via the <_f_i_l_e>-style include statement.  The --mm option
170
             can be used multiple times to form a search path.  This path will
171
             override the default system include path: /usr/share/mk.  Fur-
172
             thermore the system include path will be appended to the search
173
             path used for "_f_i_l_e"-style include statements (see the --II
174
             option).
175

  
176
             If a file or directory name in the --mm argument (or the
177
             MAKESYSPATH environment variable) starts with the string ".../"
178
             then bbmmaakkee will search for the specified file or directory named
179
             in the remaining part of the argument string.  The search starts
180
             with the current directory of the Makefile and then works upward
181
             towards the root of the filesystem.  If the search is successful,
182
             then the resulting directory replaces the ".../" specification in
183
             the --mm argument.  If used, this feature allows bbmmaakkee to easily
184
             search in the current source tree for customized sys.mk files
185
             (e.g., by using ".../mk/sys.mk" as an argument).
186

  
187
     --nn      Display the commands that would have been executed, but do not
188
             actually execute them unless the target depends on the .MAKE spe-
189
             cial source (see below).
190

  
191
     --NN      Display the commands which would have been executed, but do not
192
             actually execute any of them; useful for debugging top-level
193
             makefiles without descending into subdirectories.
194

  
195
     --qq      Do not execute any commands, but exit 0 if the specified targets
196
             are up-to-date and 1, otherwise.
197

  
198
     --rr      Do not use the built-in rules specified in the system makefile.
199

  
200
     --ss      Do not echo any commands as they are executed.  Equivalent to
201
             specifying `@@' before each command line in the makefile.
202

  
203
     --TT _t_r_a_c_e_f_i_l_e
204
             When used with the --jj flag, append a trace record to _t_r_a_c_e_f_i_l_e
205
             for each job started and completed.
206

  
207
     --tt      Rather than re-building a target as specified in the makefile,
208
             create it or update its modification time to make it appear up-
209
             to-date.
210

  
211
     --VV _v_a_r_i_a_b_l_e
212
             Print bbmmaakkee's idea of the value of _v_a_r_i_a_b_l_e, in the global con-
213
             text.  Do not build any targets.  Multiple instances of this
214
             option may be specified; the variables will be printed one per
215
             line, with a blank line for each null or undefined variable.  If
216
             _v_a_r_i_a_b_l_e contains a `$' then the value will be expanded before
217
             printing.
218

  
219
     --WW      Treat any warnings during makefile parsing as errors.
220

  
221
     --XX      Don't export variables passed on the command line to the environ-
222
             ment individually.  Variables passed on the command line are
223
             still exported via the _M_A_K_E_F_L_A_G_S environment variable.  This
224
             option may be useful on systems which have a small limit on the
225
             size of command arguments.
226

  
227
     _v_a_r_i_a_b_l_e_=_v_a_l_u_e
228
             Set the value of the variable _v_a_r_i_a_b_l_e to _v_a_l_u_e.  Normally, all
229
             values passed on the command line are also exported to sub-makes
230
             in the environment.  The --XX flag disables this behavior.  Vari-
231
             able assignments should follow options for POSIX compatibility
232
             but no ordering is enforced.
233

  
234
     There are seven different types of lines in a makefile: file dependency
235
     specifications, shell commands, variable assignments, include statements,
236
     conditional directives, for loops, and comments.
237

  
238
     In general, lines may be continued from one line to the next by ending
239
     them with a backslash (`\').  The trailing newline character and initial
240
     whitespace on the following line are compressed into a single space.
241

  
242
FFIILLEE DDEEPPEENNDDEENNCCYY SSPPEECCIIFFIICCAATTIIOONNSS
243
     Dependency lines consist of one or more targets, an operator, and zero or
244
     more sources.  This creates a relationship where the targets ``depend''
245
     on the sources and are usually created from them.  The exact relationship
246
     between the target and the source is determined by the operator that sep-
247
     arates them.  The three operators are as follows:
248

  
249
     ::     A target is considered out-of-date if its modification time is less
250
           than those of any of its sources.  Sources for a target accumulate
251
           over dependency lines when this operator is used.  The target is
252
           removed if bbmmaakkee is interrupted.
253

  
254
     !!     Targets are always re-created, but not until all sources have been
255
           examined and re-created as necessary.  Sources for a target accumu-
256
           late over dependency lines when this operator is used.  The target
257
           is removed if bbmmaakkee is interrupted.
258

  
259
     ::::    If no sources are specified, the target is always re-created.  Oth-
260
           erwise, a target is considered out-of-date if any of its sources
261
           has been modified more recently than the target.  Sources for a
262
           target do not accumulate over dependency lines when this operator
263
           is used.  The target will not be removed if bbmmaakkee is interrupted.
264

  
265
     Targets and sources may contain the shell wildcard values `?', `*', `[]',
266
     and `{}'.  The values `?', `*', and `[]' may only be used as part of the
267
     final component of the target or source, and must be used to describe
268
     existing files.  The value `{}' need not necessarily be used to describe
269
     existing files.  Expansion is in directory order, not alphabetically as
270
     done in the shell.
271

  
272
SSHHEELLLL CCOOMMMMAANNDDSS
273
     Each target may have associated with it a series of shell commands, nor-
274
     mally used to create the target.  Each of the commands in this script
275
     _m_u_s_t be preceded by a tab.  While any target may appear on a dependency
276
     line, only one of these dependencies may be followed by a creation
277
     script, unless the `::::' operator is used.
278

  
279
     If the first characters of the command line are any combination of `@@',
280
     `++', or `--', the command is treated specially.  A `@@' causes the command
281
     not to be echoed before it is executed.  A `++' causes the command to be
282
     executed even when --nn is given.  This is similar to the effect of the
283
     .MAKE special source, except that the effect can be limited to a single
284
     line of a script.  A `--' causes any non-zero exit status of the command
285
     line to be ignored.
286

  
287
VVAARRIIAABBLLEE AASSSSIIGGNNMMEENNTTSS
288
     Variables in make are much like variables in the shell, and, by tradi-
289
     tion, consist of all upper-case letters.
290

  
291
   VVaarriiaabbllee aassssiiggnnmmeenntt mmooddiiffiieerrss
292
     The five operators that can be used to assign values to variables are as
293
     follows:
294

  
295
     ==       Assign the value to the variable.  Any previous value is overrid-
296
             den.
297

  
298
     ++==      Append the value to the current value of the variable.
299

  
300
     ??==      Assign the value to the variable if it is not already defined.
301

  
302
     ::==      Assign with expansion, i.e. expand the value before assigning it
303
             to the variable.  Normally, expansion is not done until the vari-
304
             able is referenced.  _N_O_T_E: References to undefined variables are
305
             _n_o_t expanded.  This can cause problems when variable modifiers
306
             are used.
307

  
308
     !!==      Expand the value and pass it to the shell for execution and
309
             assign the result to the variable.  Any newlines in the result
310
             are replaced with spaces.
311

  
312
     Any white-space before the assigned _v_a_l_u_e is removed; if the value is
313
     being appended, a single space is inserted between the previous contents
314
     of the variable and the appended value.
315

  
316
     Variables are expanded by surrounding the variable name with either curly
317
     braces (`{}') or parentheses (`()') and preceding it with a dollar sign
318
     (`$').  If the variable name contains only a single letter, the surround-
319
     ing braces or parentheses are not required.  This shorter form is not
320
     recommended.
321

  
322
     If the variable name contains a dollar, then the name itself is expanded
323
     first.  This allows almost arbitrary variable names, however names con-
324
     taining dollar, braces, parenthesis, or whitespace are really best
325
     avoided!
326

  
327
     If the result of expanding a variable contains a dollar sign (`$') the
328
     string is expanded again.
329

  
330
     Variable substitution occurs at three distinct times, depending on where
331
     the variable is being used.
332

  
333
     1.   Variables in dependency lines are expanded as the line is read.
334

  
335
     2.   Variables in shell commands are expanded when the shell command is
336
          executed.
337

  
338
     3.   ``.for'' loop index variables are expanded on each loop iteration.
339
          Note that other variables are not expanded inside loops so the fol-
340
          lowing example code:
341

  
342

  
343
                .for i in 1 2 3
344
                a+=     ${i}
345
                j=      ${i}
346
                b+=     ${j}
347
                .endfor
348

  
349
                all:
350
                        @echo ${a}
351
                        @echo ${b}
352

  
353
          will print:
354

  
355
                1 2 3
356
                3 3 3
357

  
358
          Because while ${a} contains ``1 2 3'' after the loop is executed,
359
          ${b} contains ``${j} ${j} ${j}'' which expands to ``3 3 3'' since
360
          after the loop completes ${j} contains ``3''.
361

  
362
   VVaarriiaabbllee ccllaasssseess
363
     The four different classes of variables (in order of increasing prece-
364
     dence) are:
365

  
366
     Environment variables
367
             Variables defined as part of bbmmaakkee's environment.
368

  
369
     Global variables
370
             Variables defined in the makefile or in included makefiles.
371

  
372
     Command line variables
373
             Variables defined as part of the command line.
374

  
375
     Local variables
376
             Variables that are defined specific to a certain target.  The
377
             seven local variables are as follows:
378

  
379
             _._A_L_L_S_R_C   The list of all sources for this target; also known as
380
                       `_>'.
381

  
382
             _._A_R_C_H_I_V_E  The name of the archive file.
383

  
384
             _._I_M_P_S_R_C   In suffix-transformation rules, the name/path of the
385
                       source from which the target is to be transformed (the
386
                       ``implied'' source); also known as `_<'.  It is not
387
                       defined in explicit rules.
388

  
389
             _._M_E_M_B_E_R   The name of the archive member.
390

  
391
             _._O_O_D_A_T_E   The list of sources for this target that were deemed
392
                       out-of-date; also known as `_?'.
393

  
394
             _._P_R_E_F_I_X   The file prefix of the target, containing only the file
395
                       portion, no suffix or preceding directory components;
396
                       also known as `_*'.
397

  
398
             _._T_A_R_G_E_T   The name of the target; also known as `_@'.
399

  
400
             The shorter forms `_@', `_?', `_<', `_>', and `_*' are permitted for
401
             backward compatibility with historical makefiles and are not rec-
402
             ommended.  The six variables `_@_F', `_@_D', `_<_F', `_<_D', `_*_F', and
403
             `_*_D' are permitted for compatibility with AT&T System V UNIX
404
             makefiles and are not recommended.
405

  
406
             Four of the local variables may be used in sources on dependency
407
             lines because they expand to the proper value for each target on
408
             the line.  These variables are `_._T_A_R_G_E_T', `_._P_R_E_F_I_X', `_._A_R_C_H_I_V_E',
409
             and `_._M_E_M_B_E_R'.
410

  
411
   AAddddiittiioonnaall bbuuiilltt--iinn vvaarriiaabblleess
412
     In addition, bbmmaakkee sets or knows about the following variables:
413

  
414
     _$               A single dollar sign `$', i.e.  `$$' expands to a single
415
                     dollar sign.
416

  
417
     _._A_L_L_T_A_R_G_E_T_S     The list of all targets encountered in the Makefile.  If
418
                     evaluated during Makefile parsing, lists only those tar-
419
                     gets encountered thus far.
420

  
421
     _._C_U_R_D_I_R         A path to the directory where bbmmaakkee was executed.  Refer
422
                     to the description of `PWD' for more details.
423

  
424
     MAKE            The name that bbmmaakkee was executed with (_a_r_g_v_[_0_]).  For
425
                     compatibility bbmmaakkee also sets _._M_A_K_E with the same value.
426
                     The preferred variable to use is the environment variable
427
                     MAKE because it is more compatible with other versions of
428
                     bbmmaakkee and cannot be confused with the special target with
429
                     the same name.
430

  
431
     _._M_A_K_E_._D_E_P_E_N_D_F_I_L_E
432
                     Names the makefile (default `_._d_e_p_e_n_d') from which gener-
433
                     ated dependencies are read.
434

  
435
     _._M_A_K_E_._E_X_P_A_N_D___V_A_R_I_A_B_L_E_S
436
                     A boolean that controls the default behavior of the --VV
437
                     option.
438

  
439
     _._M_A_K_E_._E_X_P_O_R_T_E_D  The list of variables exported by bbmmaakkee.
440

  
441
     _._M_A_K_E_._J_O_B_S      The argument to the --jj option.
442

  
443
     _._M_A_K_E_._J_O_B_._P_R_E_F_I_X
444
                     If bbmmaakkee is run with _j then output for each target is
... This diff was truncated because it exceeds the maximum size that can be displayed.