1 # $NetBSD: Makefile,v 1.84 2011/08/09 15:02:30 jmcneill Exp $
3 # Experimental RCS METALOG versioning
4 # (Needs host's rcs(1) commands)
7 # - In 'build.sh distribution', print diff to previous
10 # The `all' target must appear before bsd.own.mk is pulled in.
12 @echo
"Please understand what you are doing, first."
16 .
include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
18 .if
${USE_PIGZGZIP} != "no"
19 COMPRESS_PROGRAM
=${TOOL_PIGZ
:Q
}
24 SETSENV
= DESTDIR
=${DESTDIR
:Q
} \
25 MACHINE
=${MACHINE
:Q
} \
26 MACHINE_ARCH
=${MACHINE_ARCH
:Q
} \
28 CKSUM
=${TOOL_CKSUM
:Q
} \
30 HOST_SH
=${HOST_SH
:Q
} \
32 MKTEMP
=${TOOL_MKTEMP
:Q
} \
33 MTREE
=${TOOL_MTREE
:Q
} \
35 COMPRESS_PROGRAM
=${COMPRESS_PROGRAM
:Q
} \
36 PKG_CREATE
=${TOOL_PKG_CREATE
:Q
} \
39 SETSCMD
= cd
${.CURDIR
} && \
45 MAKESRCTARS_X11_FLAGS
= -x
${X11SRCDIR}
47 .if
${MKEXTSRC} != "no"
48 MAKESRCTARS_EXTSRC_FLAGS
= -y
${EXTSRCSRCDIR}
51 MAKEFLIST_X11_FLAGS
= ,x
53 .if
${MKEXTSRC} != "no"
54 MAKEFLIST_EXTSRC_FLAGS
= ,ext
56 MAKEFLIST_FLAGS
= -L base
${MAKEFLIST_X11_FLAGS}${MAKEFLIST_EXTSRC_FLAGS}
57 MAKESRCTARS_FLAGS
= -N
${NETBSDSRCDIR}/etc
59 .if
${MAKEVERBOSE} < 2
61 MAKESRCTARS_FLAGS
+= -q
64 .if
!defined
(MAKETARSETS
)
65 MAKETARSETS
!= ${SETSCMD} .
/makeflist
-l
${MAKEFLIST_FLAGS}
68 print_have_gcc
: .PHONY
74 print_machine_arch
: .PHONY
77 print_machine_cpu
: .PHONY
80 print_object_fmt
: .PHONY
83 print_toolchain_missing
: .PHONY
84 @echo
"${TOOLCHAIN_MISSING}"
87 print_set_lists_base print_set_lists_x print_set_lists_ext \
88 list_set_lists_base list_set_lists_x list_set_lists_ext \
89 list_set_files_base list_set_files_x list_set_files_ext \
91 @
${SETSENV}; rundir
="${.CURDIR}"; . .
/sets.subr
; ${.TARGET
}
94 # METALOG MANIPULATION TARGETS
96 # METALOG is the name of a metadata log file, and is set in <bsd.own.mk>
97 # if MKUNPRIVED is not "no".
99 # METALOG.unpriv is a command line option passed to various scripts;
100 # it is either blank or "-M ${METALOG}.sanitised", depending on the
103 # The sanitise_METALOG target creates METALOG.sanitised from METALOG,
104 # without modifying METALOG itself. METALOG.sanitised is sorted, and
105 # has duplicates merged. This is used near the end of a build, after
106 # build products have been installed in DESTDIR and corresponding lines
107 # have been added to METALOG, but before METALOG.sanitised is used in
108 # the creation of sets in RELEASEDIR.
110 # The clean_METALOG either deletes METALOG or replaces METALOG with
111 # a sanitised version of itself, depending on the MKUPDATE flag, and
112 # deletes old METALOG.* files. This is intended to be used at the start
113 # of a build, to ensure that repeated MKUPDATE builds do not cause
114 # unbounded growth of METALOG.
117 .if
${MKUNPRIVED} == "no"
119 sanitise_METALOG
: .PHONY
121 clean_METALOG
: .PHONY
124 METALOG.unpriv
= -M
${METALOG}.sanitised
125 sanitise_METALOG
: .PHONY
${METALOG}.sanitised
126 ${METALOG}.sanitised
: ${METALOG}
128 ${TOOL_MTREE} -CSM
-k
all -N
${NETBSDSRCDIR}/etc \
130 mv
${METALOG}.new
${METALOG}.sanitised
131 .if defined
(RCSMETALOG
)
133 xrcs_descr
="build distribution METALOG"; \
134 xrcs_msg
="$$(date)"; \
135 xrcs_cur
=${METALOG}.sanitised
; \
138 .if
${MKUPDATE} == "no" ||
!exists
(${METALOG})
139 clean_METALOG
: .PHONY
140 rm -f
${METALOG} ${METALOG}.
*
142 clean_METALOG
: .PHONY
${METALOG}.sanitised
143 mv
${METALOG}.sanitised
${METALOG}
144 .if defined
(RCSMETALOG
)
145 [ -f
${METALOG}.sanitised
,v
] && mv
${METALOG}.sanitised
,v
${METALOG},v
148 .if defined
(RCSMETALOG
)
149 [ -f
${METALOG},v
] && mv
${METALOG},v
${METALOG}.sanitised
,v
158 # This target has debugging value only, really.
159 makeflist
: .PHONY .PRECIOUS check_DESTDIR
160 ${SETSCMD} .
/makeflist
${MAKEFLIST_FLAGS}
162 checkflist
: .PRECIOUS .PHONY check_DESTDIR sanitise_METALOG
163 ${SETSCMD} ${.CURDIR
}/checkflist \
164 ${MAKEFLIST_FLAGS} ${CHECKFLIST_FLAGS} ${METALOG.unpriv
}
166 checkflist-x11
: .PHONY check_DESTDIR
167 ${SETSCMD} .
/checkflist
-x
${CHECKFLIST_FLAGS}
169 checkflist-extsrc
: .PHONY check_DESTDIR
170 ${SETSCMD} .
/checkflist
-y
${CHECKFLIST_FLAGS}
172 .if defined
(DESTDIR
) && ${DESTDIR} != ""
173 checkflist_if_DESTDIR
: checkflist
175 checkflist_if_DESTDIR
:
179 # SET BUILDING TARGETS
182 TARDIR
= ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/sets
183 SOURCETARDIR
= ${RELEASEDIR}/source
/sets
185 # If MAKETARS_SERIAL is set to "YES" or "yes", then the tar sets will be
186 # made in series, even if make's "-j" flag requests multiple parallel
187 # jobs. This is useful on systems that exhibit poor performance when
188 # running multiple parallel disk-intensive operations. The default is
189 # MAKETARS_SERIAL=NO, which will obey the "-j" flag passed to the make
193 .if empty
(MAKETARS_SERIAL
:M
[Yy
][Ee
][Ss
])
194 _MAKETARS_WAIT
= # empty
196 _MAKETARS_WAIT
= .WAIT
199 maketars
: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
200 sanitise_METALOG checkflist_if_DESTDIR .WAIT \
202 ${MAKETARSETS
:@.TARS.@
${_MAKETARS_WAIT} do-
${.TARS.
}@
}
206 .if defined
(DESTDIR
) && ${DESTDIR} != ""
207 ${_MKMSG} "execute checkflist"
211 for i in MD5 SHA512
; do \
212 rm -f
${TARDIR}/$$i ${TARDIR}/$$i.tmp
; \
215 makesetfiles
: .PHONY sanitise_METALOG
216 ${_MKMSG_CREATE} "set lists"
217 ${SETSCMD} .
/maketars
-S
-d
${DESTDIR
:S
,^
$,/,} ${MAKETARS_FLAGS} \
219 -N
${NETBSDSRCDIR}/etc
${MAKEFLIST_FLAGS} -t
${TARDIR}
221 .for
tar in
${MAKETARSETS}
222 do-
${tar}: .PHONY sanitise_METALOG
223 ${_MKMSG_CREATE} "${tar}.tgz"
224 ${SETSCMD} .
/maketars
-d
${DESTDIR
:S
,^
$,/,} ${MAKETARS_FLAGS} \
226 -N
${NETBSDSRCDIR}/etc
-t
${TARDIR} ${tar} \
227 ||
{ rm -f
${TARDIR}/${tar}.tgz
; false
; }
231 makesrctars
: .PRECIOUS .PHONY check_RELEASEDIR
232 ${_MKMSG_CREATE} "source tar files"
233 mkdir
-p
${SOURCETARDIR}
234 ${SETSCMD} .
/makesrctars
${MAKESRCTARS_FLAGS} \
235 ${MAKESRCTARS_X11_FLAGS} ${MAKESRCTARS_EXTSRC_FLAGS} \
236 ${NETBSDSRCDIR} ${SOURCETARDIR}
239 makesums
: .PRECIOUS .PHONY check_RELEASEDIR .WAIT \
240 ${MAKETARSETS
:@.TARS.@do-sum-
${.TARS.
}@
}
241 for i in MD5 SHA512
; do \
242 mv
${TARDIR}/$$i.tmp
${TARDIR}/$$i; \
245 .for
tar in
${MAKETARSETS}
246 do-sum-
${tar}: .PHONY do-
${tar}
247 ${_MKMSG_CREATE} "${tar} checksums"
248 ${MAKESUMS} -t
${TARDIR} ${tar}.tgz
249 for i in MD5 SHA512
; do \
250 ${TOOL_CAT} ${TARDIR}/$$i >> ${TARDIR}/$$i.tmp
; \
253 .ORDER
: ${MAKETARSETS
:@.TARS.@do-sum-
${.TARS.
}@
}
256 installsets
: .PHONY check_DESTDIR sanitise_METALOG
257 .if
!defined
(INSTALLDIR
)
258 @echo
"setenv INSTALLDIR before doing that!"
261 ${SETSCMD} .
/maketars
-d
${DESTDIR
:S
,^
$,/,} ${MAKETARS_FLAGS} \
262 ${METALOG.unpriv
} -N
${NETBSDSRCDIR}/etc \
263 ${MAKEFLIST_FLAGS} -i
${INSTALLDIR} ${INSTALLSETS}
265 # Should we ignore errors like extra or missing files in the flists?
267 .if
!empty
(SLOPPY_FLIST
:M
[Yy
][Ee
][Ss
])
268 CHECKFLIST_FLAGS
+= -e
-m
272 .if
${MAKEVERBOSE} == 0
274 .elif
${MAKEVERBOSE} == 1
276 .
else # MAKEVERBOSE >= 2
279 REGPKG.
force?
= # -f, or empty
280 REGPKG.cache?
= -c
# -c, or empty
281 REGPKG.update
:= ${MKUPDATE
:tl
:Nno
:C
/..
*/-u
/}
283 makesyspkgs
: .PHONY check_DESTDIR check_RELEASEDIR \
284 sanitise_METALOG checkflist_if_DESTDIR
285 mkdir
-p
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/syspkgs
286 ${SETSCMD} ${.CURDIR
}/regpkgset \
287 ${REGPKG.verbose
} ${REGPKG.
force} ${REGPKG.sloppy
} \
288 ${REGPKG.cache
} ${REGPKG.update
} \
289 -d
${DESTDIR
:S
,^
$,/,} ${METALOG.unpriv
} \
290 -N
${NETBSDSRCDIR}/etc \
291 -t
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/syspkgs
${SYSPKGSETS}
293 makesyspkgsums
: .PHONY check_RELEASEDIR
294 ${MAKESUMS} -t
${RELEASEDIR}/${RELEASEMACHINEDIR}/binary
/syspkgs
296 # Update the "deps" file.
297 # XXX: Why is "deps" checked in to the source tree, instead of
298 # just being created as necessary?
300 ${SETSCMD} .
/syspkgdeps
all >${.CURDIR
}/deps
306 syspkgs
: .PHONY makesyspkgs .WAIT makesyspkgsums
309 sets
: .PHONY maketars .WAIT makesums
312 sourcesets
: .PHONY makesrctars
315 .
include <bsd.sys.mk
>