3 # The `all' target must appear before bsd.own.mk is pulled in.
5 @echo
"Please understand what you are doing, first."
9 .
include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
11 SETSENV
= DESTDIR
=${DESTDIR
:Q
} \
12 MACHINE
=${MACHINE
:Q
} \
13 MACHINE_ARCH
=${MACHINE_ARCH
:Q
} \
15 CKSUM
=${TOOL_CKSUM
:Q
} \
17 HOST_SH
=${HOST_SH
:Q
} \
19 MKTEMP
=${TOOL_MKTEMP
:Q
} \
20 MTREE
=${TOOL_MTREE
:Q
} \
22 PKG_CREATE
=${TOOL_PKG_CREATE
:Q
} \
25 SETSCMD
= cd
${.CURDIR
} && \
31 MAKESRCTARS_X11_FLAGS
= -x
${X11SRCDIR}
33 .if
${MKEXTSRC} != "no"
34 MAKESRCTARS_EXTSRC_FLAGS
= -y
${EXTSRCSRCDIR}
37 MAKEFLIST_X11_FLAGS
= ,x
39 .if
${MKEXTSRC} != "no"
40 MAKEFLIST_EXTSRC_FLAGS
= ,ext
42 MAKEFLIST_FLAGS
= -L base
${MAKEFLIST_X11_FLAGS}${MAKEFLIST_EXTSRC_FLAGS}
43 MAKESRCTARS_FLAGS
= -N
${NETBSDSRCDIR}/etc
45 .if
${MAKEVERBOSE} < 2
47 MAKESRCTARS_FLAGS
+= -q
50 .if
!defined
(MAKETARSETS
)
51 MAKETARSETS
!= ${SETSCMD} .
/makeflist
-l
${MAKEFLIST_FLAGS}
54 print_have_gcc
: .PHONY
60 print_machine_arch
: .PHONY
63 print_machine_cpu
: .PHONY
66 print_object_fmt
: .PHONY
69 print_toolchain_missing
: .PHONY
70 @echo
"${TOOLCHAIN_MISSING}"
73 print_set_lists_base print_set_lists_x print_set_lists_ext \
74 list_set_lists_base list_set_lists_x list_set_lists_ext \
75 list_set_files_base list_set_files_x list_set_files_ext \
77 @
${SETSENV}; rundir
="${.CURDIR}"; . .
/sets.subr
; ${.TARGET
}
80 # METALOG MANIPULATION TARGETS
82 # METALOG is the name of a metadata log file, and is set in <bsd.own.mk>
83 # if MKUNPRIVED is not "no".
85 # METALOG.unpriv is a command line option passed to various scripts;
86 # it is either blank or "-M ${METALOG}.sanitised", depending on the
89 # The sanitise_METALOG target creates METALOG.sanitised from METALOG,
90 # without modifying METALOG itself. METALOG.sanitised is sorted, and
91 # has duplicates merged. This is used near the end of a build, after
92 # build products have been installed in DESTDIR and corresponding lines
93 # have been added to METALOG, but before METALOG.sanitised is used in
94 # the creation of sets in RELEASEDIR.
96 # The clean_METALOG either deletes METALOG or replaces METALOG with
97 # a sanitised version of itself, depending on the MKUPDATE flag, and
98 # deletes old METALOG.* files. This is intended to be used at the start
99 # of a build, to ensure that repeated MKUPDATE builds do not cause
100 # unbounded growth of METALOG.
103 .if
${MKUNPRIVED} == "no"
105 sanitise_METALOG
: .PHONY
107 clean_METALOG
: .PHONY
110 METALOG.unpriv
= -M
${METALOG}.sanitised
111 sanitise_METALOG
: .PHONY
${METALOG}.sanitised
112 ${METALOG}.sanitised
: ${METALOG}
113 ${TOOL_MTREE} -CSM
-k
all -N
${NETBSDSRCDIR}/etc
<${METALOG} \
115 mv
${METALOG}.new
${METALOG}.sanitised
116 .if
${MKUPDATE} == "no" ||
!exists
(${METALOG})
117 clean_METALOG
: .PHONY
118 rm -f
${METALOG} ${METALOG}.
*
120 clean_METALOG
: .PHONY
${METALOG}.sanitised
121 mv
${METALOG}.sanitised
${METALOG}
130 # This target has debugging value only, really.
131 makeflist
: .PHONY .PRECIOUS check_DESTDIR
132 ${SETSCMD} .
/makeflist
${MAKEFLIST_FLAGS}
134 checkflist
: .PRECIOUS .PHONY check_DESTDIR sanitise_METALOG
135 ${SETSCMD} ${.CURDIR
}/checkflist \
136 ${MAKEFLIST_FLAGS} ${CHECKFLIST_FLAGS} ${METALOG.unpriv
}
138 checkflist-x11
: .PHONY check_DESTDIR
139 ${SETSCMD} .
/checkflist
-x
${CHECKFLIST_FLAGS}
141 checkflist-extsrc
: .PHONY check_DESTDIR
142 ${SETSCMD} .
/checkflist
-y
${CHECKFLIST_FLAGS}
144 .if defined
(DESTDIR
) && ${DESTDIR} != ""
145 checkflist_if_DESTDIR
: checkflist
147 checkflist_if_DESTDIR
:
151 # SET BUILDING TARGETS
154 TARDIR
= ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/sets
155 SOURCETARDIR
= ${RELEASEDIR}/source
/sets
157 # If MAKETARS_SERIAL is set to "YES" or "yes", then the tar sets will be
158 # made in series, even if make's "-j" flag requests multiple parallel
159 # jobs. This is useful on systems that exhibit poor performance when
160 # running multiple parallel disk-intensive operations. The default is
161 # MAKETARS_SERIAL=NO, which will obey the "-j" flag passed to the make
165 .if empty
(MAKETARS_SERIAL
:M
[Yy
][Ee
][Ss
])
166 _MAKETARS_WAIT
= # empty
168 _MAKETARS_WAIT
= .WAIT
171 maketars
: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
172 sanitise_METALOG checkflist_if_DESTDIR .WAIT \
174 ${MAKETARSETS
:@.TARS.@
${_MAKETARS_WAIT} do-
${.TARS.
}@
}
178 .if defined
(DESTDIR
) && ${DESTDIR} != ""
179 ${_MKMSG} "execute checkflist"
183 for i in MD5 SHA512
; do \
184 rm -f
${TARDIR}/$$i ${TARDIR}/$$i.tmp
; \
187 makesetfiles
: .PHONY sanitise_METALOG
188 ${_MKMSG_CREATE} "set lists"
189 ${SETSCMD} .
/maketars
-S
-d
${DESTDIR
:S
,^
$,/,} ${MAKETARS_FLAGS} \
191 -N
${NETBSDSRCDIR}/etc
${MAKEFLIST_FLAGS} -t
${TARDIR}
193 .for
tar in
${MAKETARSETS}
194 do-
${tar}: .PHONY sanitise_METALOG
195 ${_MKMSG_CREATE} "${tar}.tgz"
196 ${SETSCMD} .
/maketars
-d
${DESTDIR
:S
,^
$,/,} ${MAKETARS_FLAGS} \
198 -N
${NETBSDSRCDIR}/etc
-t
${TARDIR} ${tar} \
199 ||
{ rm -f
${TARDIR}/${tar}.tgz
; false
; }
203 makesrctars
: .PRECIOUS .PHONY check_RELEASEDIR
204 ${_MKMSG_CREATE} "source tar files"
205 mkdir
-p
${SOURCETARDIR}
206 ${SETSCMD} .
/makesrctars
${MAKESRCTARS_FLAGS} \
207 ${MAKESRCTARS_X11_FLAGS} ${MAKESRCTARS_EXTSRC_FLAGS} \
208 ${NETBSDSRCDIR} ${SOURCETARDIR}
211 makesums
: .PRECIOUS .PHONY check_RELEASEDIR .WAIT \
212 ${MAKETARSETS
:@.TARS.@do-sum-
${.TARS.
}@
}
213 for i in MD5 SHA512
; do \
214 mv
${TARDIR}/$$i.tmp
${TARDIR}/$$i; \
217 .for
tar in
${MAKETARSETS}
218 do-sum-
${tar}: .PHONY do-
${tar}
219 ${_MKMSG_CREATE} "${tar} checksums"
220 ${MAKESUMS} -t
${TARDIR} ${tar}.tgz
221 for i in MD5 SHA512
; do \
222 ${TOOL_CAT} ${TARDIR}/$$i >> ${TARDIR}/$$i.tmp
; \
225 .ORDER
: ${MAKETARSETS
:@.TARS.@do-sum-
${.TARS.
}@
}
228 installsets
: .PHONY check_DESTDIR sanitise_METALOG
229 .if
!defined
(INSTALLDIR
)
230 @echo
"setenv INSTALLDIR before doing that!"
233 ${SETSCMD} .
/maketars
-d
${DESTDIR
:S
,^
$,/,} ${MAKETARS_FLAGS} \
234 ${METALOG.unpriv
} -N
${NETBSDSRCDIR}/etc \
235 ${MAKEFLIST_FLAGS} -i
${INSTALLDIR} ${INSTALLSETS}
237 # Should we ignore errors like extra or missing files in the flists?
239 .if
!empty
(SLOPPY_FLIST
:M
[Yy
][Ee
][Ss
])
240 CHECKFLIST_FLAGS
+= -e
-m
244 .if
${MAKEVERBOSE} == 0
246 .elif
${MAKEVERBOSE} == 1
248 .
else # MAKEVERBOSE >= 2
251 REGPKG.
force?
= # -f, or empty
252 REGPKG.cache?
= -c
# -c, or empty
253 REGPKG.update
:= ${MKUPDATE
:tl
:Nno
:C
/..
*/-u
/}
255 makesyspkgs
: .PHONY check_DESTDIR check_RELEASEDIR \
256 sanitise_METALOG checkflist_if_DESTDIR
257 mkdir
-p
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/syspkgs
258 ${SETSCMD} ${.CURDIR
}/regpkgset \
259 ${REGPKG.verbose
} ${REGPKG.
force} ${REGPKG.sloppy
} \
260 ${REGPKG.cache
} ${REGPKG.update
} \
261 -d
${DESTDIR
:S
,^
$,/,} ${METALOG.unpriv
} \
262 -N
${NETBSDSRCDIR}/etc \
263 -t
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/syspkgs
${SYSPKGSETS}
265 makesyspkgsums
: .PHONY check_RELEASEDIR
266 ${MAKESUMS} -t
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/syspkgs
268 # Update the "deps" file.
269 # XXX: Why is "deps" checked in to the source tree, instead of
270 # just being created as necessary?
272 ${SETSCMD} .
/syspkgdeps
all >${.CURDIR
}/deps
278 syspkgs
: .PHONY makesyspkgs .WAIT makesyspkgsums
281 sets
: .PHONY maketars .WAIT makesums
284 sourcesets
: .PHONY makesrctars
287 .
include <bsd.sys.mk
>