t40c term[] count fix
[minix.git] / distrib / sets / Makefile
blob62cad67c1c2ee26a030b36b2e5364811d2a82196
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)
6 # TODO:
7 # - In 'build.sh distribution', print diff to previous
8 #RCSMETALOG=1
10 # The `all' target must appear before bsd.own.mk is pulled in.
11 all:
12 @echo "Please understand what you are doing, first."
13 @false
15 .include <bsd.own.mk>
16 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
18 .if ${USE_PIGZGZIP} != "no"
19 COMPRESS_PROGRAM=${TOOL_PIGZ:Q}
20 .else
21 COMPRESS_PROGRAM=gzip
22 .endif
24 SETSENV= DESTDIR=${DESTDIR:Q} \
25 MACHINE=${MACHINE:Q} \
26 MACHINE_ARCH=${MACHINE_ARCH:Q} \
27 AWK=${TOOL_AWK:Q} \
28 CKSUM=${TOOL_CKSUM:Q} \
29 DB=${TOOL_DB:Q} \
30 HOST_SH=${HOST_SH:Q} \
31 MAKE=${MAKE:Q} \
32 MKTEMP=${TOOL_MKTEMP:Q} \
33 MTREE=${TOOL_MTREE:Q} \
34 PAX=${TOOL_PAX:Q} \
35 COMPRESS_PROGRAM=${COMPRESS_PROGRAM:Q} \
36 PKG_CREATE=${TOOL_PKG_CREATE:Q} \
37 SED=${TOOL_SED:Q} \
38 TSORT=${TSORT:Q}
39 SETSCMD= cd ${.CURDIR} && \
40 ${SETSENV} \
41 ${HOST_SH}
43 MAKETARS_FLAGS=
44 .if ${MKX11} != "no"
45 MAKESRCTARS_X11_FLAGS= -x ${X11SRCDIR}
46 .endif
47 .if ${MKEXTSRC} != "no"
48 MAKESRCTARS_EXTSRC_FLAGS= -y ${EXTSRCSRCDIR}
49 .endif
50 .if ${MKX11} != "no"
51 MAKEFLIST_X11_FLAGS= ,x
52 .endif
53 .if ${MKEXTSRC} != "no"
54 MAKEFLIST_EXTSRC_FLAGS= ,ext
55 .endif
56 MAKEFLIST_FLAGS= -L base${MAKEFLIST_X11_FLAGS}${MAKEFLIST_EXTSRC_FLAGS}
57 MAKESRCTARS_FLAGS= -N ${NETBSDSRCDIR}/etc
59 .if ${MAKEVERBOSE} < 2
60 MAKETARS_FLAGS+= -q
61 MAKESRCTARS_FLAGS+= -q
62 .endif
64 .if !defined(MAKETARSETS)
65 MAKETARSETS!= ${SETSCMD} ./makeflist -l ${MAKEFLIST_FLAGS}
66 .endif
68 print_have_gcc: .PHONY
69 @echo ${HAVE_GCC}
71 print_machine: .PHONY
72 @echo ${MACHINE}
74 print_machine_arch: .PHONY
75 @echo ${MACHINE_ARCH}
77 print_machine_cpu: .PHONY
78 @echo ${MACHINE_CPU}
80 print_object_fmt: .PHONY
81 @echo ${OBJECT_FMT}
83 print_toolchain_missing: .PHONY
84 @echo "${TOOLCHAIN_MISSING}"
86 print_mkvars \
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 \
90 : .PHONY
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
101 # MKUNPRIVED flag.
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"
118 METALOG.unpriv=
119 sanitise_METALOG: .PHONY
120 @true
121 clean_METALOG: .PHONY
122 @true
123 .else # MKUNPRIVED
124 METALOG.unpriv= -M ${METALOG}.sanitised
125 sanitise_METALOG: .PHONY ${METALOG}.sanitised
126 ${METALOG}.sanitised: ${METALOG}
127 sort ${METALOG} | \
128 ${TOOL_MTREE} -CSM -k all -N ${NETBSDSRCDIR}/etc \
129 >${METALOG}.new
130 mv ${METALOG}.new ${METALOG}.sanitised
131 .if defined(RCSMETALOG)
132 . ./metalog.subr; \
133 xrcs_descr="build distribution METALOG"; \
134 xrcs_msg="$$(date)"; \
135 xrcs_cur=${METALOG}.sanitised; \
136 xrcs update
137 .endif
138 .if ${MKUPDATE} == "no" || !exists(${METALOG})
139 clean_METALOG: .PHONY
140 rm -f ${METALOG} ${METALOG}.*
141 .else # MKUPDATE
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
146 .endif
147 rm -f ${METALOG}.*
148 .if defined(RCSMETALOG)
149 [ -f ${METALOG},v ] && mv ${METALOG},v ${METALOG}.sanitised,v
150 .endif
151 .endif # MKUPDATE
152 .endif # MKUNPRIVED
155 # FILE LIST TARGETS
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
174 .else
175 checkflist_if_DESTDIR:
176 .endif
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
190 # command.
192 MAKETARS_SERIAL?= NO
193 .if empty(MAKETARS_SERIAL:M[Yy][Ee][Ss])
194 _MAKETARS_WAIT= # empty
195 .else
196 _MAKETARS_WAIT= .WAIT
197 .endif
199 maketars: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
200 sanitise_METALOG checkflist_if_DESTDIR .WAIT \
201 maketarsetup .WAIT \
202 ${MAKETARSETS:@.TARS.@${_MAKETARS_WAIT} do-${.TARS.}@}
203 @true
205 maketarsetup: .EXEC
206 .if defined(DESTDIR) && ${DESTDIR} != ""
207 ${_MKMSG} "execute checkflist"
208 ${MAKE} checkflist
209 .endif
210 mkdir -p ${TARDIR}
211 for i in MD5 SHA512; do \
212 rm -f ${TARDIR}/$$i ${TARDIR}/$$i.tmp; \
213 done
215 makesetfiles: .PHONY sanitise_METALOG
216 ${_MKMSG_CREATE} "set lists"
217 ${SETSCMD} ./maketars -S -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
218 ${METALOG.unpriv} \
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} \
225 ${METALOG.unpriv} \
226 -N ${NETBSDSRCDIR}/etc -t ${TARDIR} ${tar} \
227 || { rm -f ${TARDIR}/${tar}.tgz; false; }
228 .endfor
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; \
243 done
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; \
251 done
252 .endfor
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!"
259 @false
260 .endif
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?
266 SLOPPY_FLIST?= NO
267 .if !empty(SLOPPY_FLIST:M[Yy][Ee][Ss])
268 CHECKFLIST_FLAGS+= -e -m
269 REGPKG.sloppy= -m
270 .endif
272 .if ${MAKEVERBOSE} == 0
273 REGPKG.verbose?= -q
274 .elif ${MAKEVERBOSE} == 1
275 REGPKG.verbose?=
276 .else # MAKEVERBOSE >= 2
277 REGPKG.verbose?= -v
278 .endif
279 REGPKG.force?= # -f, or empty
280 REGPKG.cache?= -c # -c, or empty
281 REGPKG.update:= ${MKUPDATE:tl:Nno:C/..*/-u/}
282 SYSPKGSETS?= all
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?
299 makedeps: .PHONY
300 ${SETSCMD} ./syspkgdeps all >${.CURDIR}/deps
303 # MAIN ENTRY POINTS
306 syspkgs: .PHONY makesyspkgs .WAIT makesyspkgsums
307 @true
309 sets: .PHONY maketars .WAIT makesums
310 @true
312 sourcesets: .PHONY makesrctars
313 @true
315 .include <bsd.sys.mk>