No empty .Rs/.Re
[netbsd-mini2440.git] / distrib / sets / Makefile
blob9f7bf00df2e6dd920fa4718c20775e5b57c9653e
1 # $NetBSD$
3 # The `all' target must appear before bsd.own.mk is pulled in.
4 all:
5 @echo "Please understand what you are doing, first."
6 @false
8 .include <bsd.own.mk>
9 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
11 SETSENV= DESTDIR=${DESTDIR:Q} \
12 MACHINE=${MACHINE:Q} \
13 MACHINE_ARCH=${MACHINE_ARCH:Q} \
14 AWK=${TOOL_AWK:Q} \
15 CKSUM=${TOOL_CKSUM:Q} \
16 DB=${TOOL_DB:Q} \
17 HOST_SH=${HOST_SH:Q} \
18 MAKE=${MAKE:Q} \
19 MKTEMP=${TOOL_MKTEMP:Q} \
20 MTREE=${TOOL_MTREE:Q} \
21 PAX=${TOOL_PAX:Q} \
22 PKG_CREATE=${TOOL_PKG_CREATE:Q} \
23 SED=${TOOL_SED:Q} \
24 TSORT=${TSORT:Q}
25 SETSCMD= cd ${.CURDIR} && \
26 ${SETSENV} \
27 ${HOST_SH}
29 MAKETARS_FLAGS=
30 .if ${MKX11} != "no"
31 MAKESRCTARS_X11_FLAGS= -x ${X11SRCDIR}
32 .endif
33 .if ${MKEXTSRC} != "no"
34 MAKESRCTARS_EXTSRC_FLAGS= -y ${EXTSRCSRCDIR}
35 .endif
36 .if ${MKX11} != "no"
37 MAKEFLIST_X11_FLAGS= ,x
38 .endif
39 .if ${MKEXTSRC} != "no"
40 MAKEFLIST_EXTSRC_FLAGS= ,ext
41 .endif
42 MAKEFLIST_FLAGS= -L base${MAKEFLIST_X11_FLAGS}${MAKEFLIST_EXTSRC_FLAGS}
43 MAKESRCTARS_FLAGS= -N ${NETBSDSRCDIR}/etc
45 .if ${MAKEVERBOSE} < 2
46 MAKETARS_FLAGS+= -q
47 MAKESRCTARS_FLAGS+= -q
48 .endif
50 .if !defined(MAKETARSETS)
51 MAKETARSETS!= ${SETSCMD} ./makeflist -l ${MAKEFLIST_FLAGS}
52 .endif
54 print_have_gcc: .PHONY
55 @echo ${HAVE_GCC}
57 print_machine: .PHONY
58 @echo ${MACHINE}
60 print_machine_arch: .PHONY
61 @echo ${MACHINE_ARCH}
63 print_machine_cpu: .PHONY
64 @echo ${MACHINE_CPU}
66 print_object_fmt: .PHONY
67 @echo ${OBJECT_FMT}
69 print_toolchain_missing: .PHONY
70 @echo "${TOOLCHAIN_MISSING}"
72 print_mkvars \
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 \
76 : .PHONY
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
87 # MKUNPRIVED flag.
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"
104 METALOG.unpriv=
105 sanitise_METALOG: .PHONY
106 @true
107 clean_METALOG: .PHONY
108 @true
109 .else # MKUNPRIVED
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} \
114 >${METALOG}.new
115 mv ${METALOG}.new ${METALOG}.sanitised
116 .if ${MKUPDATE} == "no" || !exists(${METALOG})
117 clean_METALOG: .PHONY
118 rm -f ${METALOG} ${METALOG}.*
119 .else # MKUPDATE
120 clean_METALOG: .PHONY ${METALOG}.sanitised
121 mv ${METALOG}.sanitised ${METALOG}
122 rm -f ${METALOG}.*
123 .endif # MKUPDATE
124 .endif # MKUNPRIVED
127 # FILE LIST TARGETS
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
146 .else
147 checkflist_if_DESTDIR:
148 .endif
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
162 # command.
164 MAKETARS_SERIAL?= NO
165 .if empty(MAKETARS_SERIAL:M[Yy][Ee][Ss])
166 _MAKETARS_WAIT= # empty
167 .else
168 _MAKETARS_WAIT= .WAIT
169 .endif
171 maketars: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
172 sanitise_METALOG checkflist_if_DESTDIR .WAIT \
173 maketarsetup .WAIT \
174 ${MAKETARSETS:@.TARS.@${_MAKETARS_WAIT} do-${.TARS.}@}
175 @true
177 maketarsetup: .EXEC
178 .if defined(DESTDIR) && ${DESTDIR} != ""
179 ${_MKMSG} "execute checkflist"
180 ${MAKE} checkflist
181 .endif
182 mkdir -p ${TARDIR}
183 for i in MD5 SHA512; do \
184 rm -f ${TARDIR}/$$i ${TARDIR}/$$i.tmp; \
185 done
187 makesetfiles: .PHONY sanitise_METALOG
188 ${_MKMSG_CREATE} "set lists"
189 ${SETSCMD} ./maketars -S -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
190 ${METALOG.unpriv} \
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} \
197 ${METALOG.unpriv} \
198 -N ${NETBSDSRCDIR}/etc -t ${TARDIR} ${tar} \
199 || { rm -f ${TARDIR}/${tar}.tgz; false; }
200 .endfor
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; \
215 done
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; \
223 done
224 .endfor
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!"
231 @false
232 .endif
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?
238 SLOPPY_FLIST?= NO
239 .if !empty(SLOPPY_FLIST:M[Yy][Ee][Ss])
240 CHECKFLIST_FLAGS+= -e -m
241 REGPKG.sloppy= -m
242 .endif
244 .if ${MAKEVERBOSE} == 0
245 REGPKG.verbose?= -q
246 .elif ${MAKEVERBOSE} == 1
247 REGPKG.verbose?=
248 .else # MAKEVERBOSE >= 2
249 REGPKG.verbose?= -v
250 .endif
251 REGPKG.force?= # -f, or empty
252 REGPKG.cache?= -c # -c, or empty
253 REGPKG.update:= ${MKUPDATE:tl:Nno:C/..*/-u/}
254 SYSPKGSETS?= all
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?
271 makedeps: .PHONY
272 ${SETSCMD} ./syspkgdeps all >${.CURDIR}/deps
275 # MAIN ENTRY POINTS
278 syspkgs: .PHONY makesyspkgs .WAIT makesyspkgsums
279 @true
281 sets: .PHONY maketars .WAIT makesums
282 @true
284 sourcesets: .PHONY makesrctars
285 @true
287 .include <bsd.sys.mk>