2009-04-23 13:37:03 +04:00
|
|
|
# $NetBSD: Makefile,v 1.67 2009/04/23 09:37:03 apb Exp $
|
2000-03-28 04:38:06 +04:00
|
|
|
|
|
|
|
# The `all' target must appear before bsd.own.mk is pulled in.
|
|
|
|
all:
|
|
|
|
@echo "Please understand what you are doing, first."
|
|
|
|
@false
|
|
|
|
|
|
|
|
.include <bsd.own.mk>
|
2002-05-02 22:02:14 +04:00
|
|
|
.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
|
2006-01-06 21:08:59 +03:00
|
|
|
GREP?= grep
|
2000-03-28 04:38:06 +04:00
|
|
|
|
2004-01-30 11:43:15 +03:00
|
|
|
SETSCMD= cd ${.CURDIR} && \
|
|
|
|
DESTDIR=${DESTDIR:Q} \
|
2002-02-27 13:51:47 +03:00
|
|
|
MACHINE=${MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \
|
2008-10-20 02:05:19 +04:00
|
|
|
AWK=${TOOL_AWK:Q} \
|
2006-01-04 17:58:58 +03:00
|
|
|
CKSUM=${TOOL_CKSUM:Q} \
|
|
|
|
DB=${TOOL_DB:Q} \
|
|
|
|
HOST_SH=${HOST_SH:Q} \
|
|
|
|
MAKE=${MAKE:Q} \
|
|
|
|
MKTEMP=${TOOL_MKTEMP:Q} \
|
|
|
|
MTREE=${TOOL_MTREE:Q} \
|
|
|
|
PAX=${TOOL_PAX:Q} \
|
2008-10-26 02:23:55 +04:00
|
|
|
SED=${TOOL_SED:Q} \
|
2006-01-04 17:58:58 +03:00
|
|
|
TSORT=${TSORT:Q} \
|
2004-01-30 11:43:15 +03:00
|
|
|
${HOST_SH}
|
2002-02-27 13:51:47 +03:00
|
|
|
|
2008-03-16 10:02:22 +03:00
|
|
|
MAKETARS_FLAGS=
|
2008-11-10 02:02:28 +03:00
|
|
|
.if ${MKX11} != "no"
|
2004-01-08 04:48:45 +03:00
|
|
|
MAKEFLIST_FLAGS= -b
|
2005-10-08 00:00:54 +04:00
|
|
|
MAKESRCTARS_FLAGS= -x ${X11SRCDIR} -N ${NETBSDSRCDIR}/etc
|
2004-01-08 04:48:45 +03:00
|
|
|
.else
|
|
|
|
MAKEFLIST_FLAGS=
|
2005-10-08 00:00:54 +04:00
|
|
|
MAKESRCTARS_FLAGS= -N ${NETBSDSRCDIR}/etc
|
2004-01-08 04:48:45 +03:00
|
|
|
.endif
|
|
|
|
|
2008-11-13 23:40:11 +03:00
|
|
|
.if ${MAKEVERBOSE} < 2
|
2008-03-16 10:02:22 +03:00
|
|
|
MAKETARS_FLAGS+= -q
|
|
|
|
MAKESRCTARS_FLAGS+= -q
|
|
|
|
.endif
|
|
|
|
|
2003-12-20 01:25:53 +03:00
|
|
|
.if !defined(MAKETARSETS)
|
2004-01-30 11:43:15 +03:00
|
|
|
MAKETARSETS!= ${SETSCMD} ./makeflist -l ${MAKEFLIST_FLAGS}
|
2003-12-20 01:25:53 +03:00
|
|
|
.endif
|
|
|
|
|
2006-04-07 23:38:58 +04:00
|
|
|
print_have_gcc: .PHONY
|
|
|
|
@echo ${HAVE_GCC}
|
2003-09-21 23:26:02 +04:00
|
|
|
|
2001-11-24 05:54:50 +03:00
|
|
|
print_machine: .PHONY
|
|
|
|
@echo ${MACHINE}
|
|
|
|
|
|
|
|
print_machine_arch: .PHONY
|
|
|
|
@echo ${MACHINE_ARCH}
|
|
|
|
|
|
|
|
print_machine_cpu: .PHONY
|
|
|
|
@echo ${MACHINE_CPU}
|
|
|
|
|
|
|
|
print_object_fmt: .PHONY
|
|
|
|
@echo ${OBJECT_FMT}
|
|
|
|
|
2002-09-20 02:04:34 +04:00
|
|
|
print_toolchain_missing: .PHONY
|
|
|
|
@echo "${TOOLCHAIN_MISSING}"
|
2001-11-24 05:54:50 +03:00
|
|
|
|
2000-03-28 04:38:06 +04:00
|
|
|
#
|
2009-04-23 13:37:03 +04:00
|
|
|
# METALOG MANIPULATION TARGETS
|
|
|
|
#
|
|
|
|
# METALOG is the name of a metadata log file, and is set in <bsd.own.mk>
|
|
|
|
# if MKUNPRIVED is not "no".
|
|
|
|
#
|
|
|
|
# METALOG.unpriv is a command line option passed to various scripts;
|
|
|
|
# it is either blank or "-M ${METALOG}.sanitised", depending on the
|
|
|
|
# MKUNPRIVED flag.
|
|
|
|
#
|
|
|
|
# The sanitise_METALOG target creates METALOG.sanitised from METALOG,
|
|
|
|
# without modifying METALOG itself. METALOG.sanitised is sorted, and
|
|
|
|
# has duplicates merged. This is used near the end of a build, after
|
|
|
|
# build products have been installed in DESTDIR and corresponding lines
|
|
|
|
# have been added to METALOG, but before METALOG.sanitised is used in
|
|
|
|
# the creation of sets in RELEASEDIR.
|
|
|
|
#
|
|
|
|
# The clean_METALOG either deletes METALOG or replaces METALOG with
|
|
|
|
# a sanitised version of itself, depending on the MKUPDATE flag, and
|
|
|
|
# deletes old METALOG.* files. This is intended to be used at the start
|
|
|
|
# of a build, to ensure that repeated MKUPDATE builds do not cause
|
|
|
|
# unbounded growth of METALOG.
|
2000-03-28 04:38:06 +04:00
|
|
|
#
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUNPRIVED} == "no"
|
|
|
|
METALOG.unpriv=
|
2006-01-04 17:58:58 +03:00
|
|
|
sanitise_METALOG: .PHONY
|
|
|
|
@true
|
2009-04-23 13:37:03 +04:00
|
|
|
clean_METALOG: .PHONY
|
|
|
|
@true
|
|
|
|
.else # MKUNPRIVED
|
|
|
|
METALOG.unpriv= -M ${METALOG}.sanitised
|
|
|
|
sanitise_METALOG: .PHONY ${METALOG}.sanitised
|
|
|
|
${METALOG}.sanitised: ${METALOG}
|
|
|
|
${TOOL_MTREE} -CS -k all -N ${NETBSDSRCDIR}/etc <${METALOG} \
|
|
|
|
>${METALOG}.new
|
|
|
|
mv ${METALOG}.new ${METALOG}.sanitised
|
|
|
|
.if ${MKUPDATE} == "no" || !exists(${METALOG})
|
|
|
|
clean_METALOG: .PHONY
|
|
|
|
rm -f ${METALOG} ${METALOG}.*
|
|
|
|
.else # MKUPDATE
|
|
|
|
clean_METALOG: .PHONY ${METALOG}.sanitised
|
|
|
|
mv ${METALOG}.sanitised ${METALOG}
|
|
|
|
rm -f ${METALOG}.*
|
|
|
|
.endif # MKUPDATE
|
|
|
|
.endif # MKUNPRIVED
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2009-04-23 13:37:03 +04:00
|
|
|
#
|
|
|
|
# FILE LIST TARGETS
|
|
|
|
#
|
|
|
|
|
|
|
|
# This target has debugging value only, really.
|
|
|
|
makeflist: .PHONY .PRECIOUS check_DESTDIR
|
|
|
|
${SETSCMD} ./makeflist ${MAKEFLIST_FLAGS}
|
2006-01-04 17:58:58 +03:00
|
|
|
|
|
|
|
checkflist: .PRECIOUS .PHONY check_DESTDIR sanitise_METALOG
|
|
|
|
${SETSCMD} ${.CURDIR}/checkflist \
|
2009-04-23 13:37:03 +04:00
|
|
|
${MAKEFLIST_FLAGS} ${CHECKFLIST_FLAGS} ${METALOG.unpriv}
|
2000-03-28 04:38:06 +04:00
|
|
|
|
2004-01-29 11:34:21 +03:00
|
|
|
checkflist-x11: .PHONY check_DESTDIR
|
2004-01-30 11:43:15 +03:00
|
|
|
${SETSCMD} ./checkflist -x ${CHECKFLIST_FLAGS}
|
|
|
|
|
2009-04-23 13:37:03 +04:00
|
|
|
.if defined(DESTDIR) && ${DESTDIR} != ""
|
|
|
|
checkflist_if_DESTDIR: checkflist
|
|
|
|
.else
|
|
|
|
checkflist_if_DESTDIR:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
#
|
|
|
|
# SET BUILDING TARGETS
|
|
|
|
#
|
|
|
|
|
|
|
|
TARDIR= ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
|
|
|
|
SOURCETARDIR= ${RELEASEDIR}/source/sets
|
2002-01-01 10:59:32 +03:00
|
|
|
|
2008-05-02 23:25:42 +04:00
|
|
|
# If MAKETARS_SERIAL is set to "YES" or "yes", then the tar sets will be
|
|
|
|
# made in series, even if make's "-j" flag requests multiple parallel
|
|
|
|
# jobs. This is useful on systems that exhibit poor performance when
|
|
|
|
# running multiple parallel disk-intensive operations. The default is
|
|
|
|
# MAKETARS_SERIAL=NO, which will obey the "-j" flag passed to the make
|
|
|
|
# command.
|
|
|
|
#
|
|
|
|
MAKETARS_SERIAL?= NO
|
|
|
|
.if empty(MAKETARS_SERIAL:M[Yy][Ee][Ss])
|
|
|
|
_MAKETARS_WAIT= # empty
|
|
|
|
.else
|
|
|
|
_MAKETARS_WAIT= .WAIT
|
|
|
|
.endif
|
|
|
|
|
2006-01-04 17:58:58 +03:00
|
|
|
maketars: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
|
|
|
|
sanitise_METALOG checkflist_if_DESTDIR .WAIT \
|
2008-05-02 23:25:42 +04:00
|
|
|
maketarsetup .WAIT \
|
|
|
|
${MAKETARSETS:@.TARS.@${_MAKETARS_WAIT} do-${.TARS.}@}
|
2003-12-20 01:25:53 +03:00
|
|
|
@true
|
|
|
|
|
2004-01-30 11:43:15 +03:00
|
|
|
maketarsetup: .EXEC
|
2003-01-12 21:51:26 +03:00
|
|
|
.if defined(DESTDIR) && ${DESTDIR} != ""
|
2004-01-30 11:43:15 +03:00
|
|
|
${_MKMSG} "execute checkflist"
|
2003-09-30 10:26:37 +04:00
|
|
|
${MAKE} checkflist
|
2002-07-09 20:08:38 +04:00
|
|
|
.endif
|
2004-01-30 11:43:15 +03:00
|
|
|
mkdir -p ${TARDIR}
|
2005-10-06 06:22:11 +04:00
|
|
|
for i in BSDSUM CKSUM MD5 SHA512 SYSVSUM; do \
|
2004-01-30 11:43:15 +03:00
|
|
|
rm -f ${TARDIR}/$$i ${TARDIR}/$$i.tmp; \
|
|
|
|
done
|
|
|
|
|
2009-04-23 13:37:03 +04:00
|
|
|
makesetfiles: .PHONY sanitise_METALOG
|
2004-01-30 11:43:15 +03:00
|
|
|
${_MKMSG_CREATE} "set lists"
|
2009-04-23 13:37:03 +04:00
|
|
|
${SETSCMD} ./maketars -S -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
|
|
|
|
${METALOG.unpriv} \
|
2004-01-30 11:43:15 +03:00
|
|
|
-N ${NETBSDSRCDIR}/etc ${MAKEFLIST_FLAGS} -t ${TARDIR}
|
|
|
|
|
2003-12-20 01:25:53 +03:00
|
|
|
.for tar in ${MAKETARSETS}
|
2007-01-27 09:46:43 +03:00
|
|
|
do-${tar}: .PHONY sanitise_METALOG
|
2008-03-16 10:02:22 +03:00
|
|
|
${_MKMSG_CREATE} "${tar}.tgz"
|
|
|
|
${SETSCMD} ./maketars -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
|
2009-04-23 13:37:03 +04:00
|
|
|
${METALOG.unpriv} \
|
2004-01-30 11:43:15 +03:00
|
|
|
-N ${NETBSDSRCDIR}/etc -t ${TARDIR} ${tar} \
|
|
|
|
|| rm -f ${TARDIR}/${tar}.tgz
|
2003-12-20 01:25:53 +03:00
|
|
|
.endfor
|
2000-03-28 04:38:06 +04:00
|
|
|
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2004-01-29 11:34:21 +03:00
|
|
|
makesrctars: .PRECIOUS .PHONY check_RELEASEDIR
|
2008-03-16 10:02:22 +03:00
|
|
|
${_MKMSG_CREATE} "source tar files"
|
2004-01-30 11:43:15 +03:00
|
|
|
mkdir -p ${SOURCETARDIR}
|
2004-04-20 10:36:34 +04:00
|
|
|
${SETSCMD} ./makesrctars ${MAKESRCTARS_FLAGS} \
|
|
|
|
${NETBSDSRCDIR} ${SOURCETARDIR}
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2003-05-10 10:08:12 +04:00
|
|
|
|
2004-01-29 11:34:21 +03:00
|
|
|
makesums: .PRECIOUS .PHONY check_RELEASEDIR .WAIT \
|
|
|
|
${MAKETARSETS:@.TARS.@do-sum-${.TARS.}@}
|
2005-10-06 06:22:11 +04:00
|
|
|
for i in BSDSUM CKSUM MD5 SHA512 SYSVSUM; do \
|
2004-01-30 11:43:15 +03:00
|
|
|
mv ${TARDIR}/$$i.tmp ${TARDIR}/$$i; \
|
|
|
|
done
|
2003-12-20 01:25:53 +03:00
|
|
|
|
|
|
|
.for tar in ${MAKETARSETS}
|
2003-12-29 07:46:18 +03:00
|
|
|
do-sum-${tar}: .PHONY do-${tar}
|
2008-03-16 10:02:22 +03:00
|
|
|
${_MKMSG_CREATE} "${tar} checksums"
|
2004-01-30 11:43:15 +03:00
|
|
|
${MAKESUMS} -t ${TARDIR} ${tar}.tgz
|
2005-10-06 06:22:11 +04:00
|
|
|
for i in BSDSUM CKSUM MD5 SHA512 SYSVSUM; do \
|
2004-01-30 11:43:15 +03:00
|
|
|
${TOOL_CAT} ${TARDIR}/$$i >> ${TARDIR}/$$i.tmp; \
|
2003-12-22 07:56:53 +03:00
|
|
|
done
|
2003-12-20 01:25:53 +03:00
|
|
|
.endfor
|
2003-12-28 12:27:41 +03:00
|
|
|
.ORDER: ${MAKETARSETS:@.TARS.@do-sum-${.TARS.}@}
|
2000-03-28 04:38:06 +04:00
|
|
|
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2006-01-04 17:58:58 +03:00
|
|
|
installsets: .PHONY check_DESTDIR sanitise_METALOG
|
2002-12-12 11:54:25 +03:00
|
|
|
.if !defined(INSTALLDIR)
|
|
|
|
@echo "setenv INSTALLDIR before doing that!"
|
|
|
|
@false
|
|
|
|
.endif
|
2008-03-16 10:02:22 +03:00
|
|
|
${SETSCMD} ./maketars -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
|
2009-04-23 13:37:03 +04:00
|
|
|
${METALOG.unpriv} -N ${NETBSDSRCDIR}/etc \
|
2006-01-04 17:58:58 +03:00
|
|
|
${MAKEFLIST_FLAGS} -i ${INSTALLDIR} ${INSTALLSETS}
|
|
|
|
|
|
|
|
# Should we ignore errors like extra or missing files in the flists?
|
|
|
|
SLOPPY_FLIST?= NO
|
|
|
|
.if !empty(SLOPPY_FLIST:M[Yy][Ee][Ss])
|
|
|
|
CHECKFLIST_FLAGS+= -e -m
|
|
|
|
REGPKG.sloppy= -m
|
|
|
|
.endif
|
2002-12-12 11:54:25 +03:00
|
|
|
|
2006-01-04 17:58:58 +03:00
|
|
|
.if ${MAKEVERBOSE} == 0
|
|
|
|
REGPKG.verbose?= -q
|
|
|
|
.elif ${MAKEVERBOSE} == 1
|
|
|
|
REGPKG.verbose?=
|
2008-11-13 23:40:11 +03:00
|
|
|
.else # MAKEVERBOSE >= 2
|
2006-01-04 17:58:58 +03:00
|
|
|
REGPKG.verbose?= -v
|
|
|
|
.endif
|
|
|
|
REGPKG.force?= # -f, or empty
|
|
|
|
REGPKG.cache?= -c # -c, or empty
|
|
|
|
REGPKG.update:= ${MKUPDATE:tl:Nno:C/..*/-u/}
|
|
|
|
SYSPKGSETS?= all
|
|
|
|
makesyspkgs: .PHONY check_DESTDIR check_RELEASEDIR \
|
|
|
|
sanitise_METALOG checkflist_if_DESTDIR
|
2008-06-23 06:16:53 +04:00
|
|
|
mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
|
2006-01-04 17:58:58 +03:00
|
|
|
${SETSCMD} ${.CURDIR}/regpkgset \
|
|
|
|
${REGPKG.verbose} ${REGPKG.force} ${REGPKG.sloppy} \
|
|
|
|
${REGPKG.cache} ${REGPKG.update} \
|
2009-04-23 13:37:03 +04:00
|
|
|
-d ${DESTDIR:S,^$,/,} ${METALOG.unpriv} \
|
2006-01-04 17:58:58 +03:00
|
|
|
-N ${NETBSDSRCDIR}/etc \
|
2008-06-23 06:16:53 +04:00
|
|
|
-t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs ${SYSPKGSETS}
|
2006-01-04 17:58:58 +03:00
|
|
|
|
|
|
|
makesyspkgsums: .PHONY check_RELEASEDIR
|
2008-06-23 06:16:53 +04:00
|
|
|
${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2006-01-04 18:11:07 +03:00
|
|
|
# Update the "deps" file.
|
|
|
|
# XXX: Why is "deps" checked in to the source tree, instead of
|
|
|
|
# just being created as necessary?
|
|
|
|
makedeps: .PHONY
|
|
|
|
${SETSCMD} ./syspkgdeps all >${.CURDIR}/deps
|
|
|
|
|
2000-03-28 04:38:06 +04:00
|
|
|
#
|
|
|
|
# MAIN ENTRY POINTS
|
|
|
|
#
|
|
|
|
|
2006-01-04 17:58:58 +03:00
|
|
|
syspkgs: .PHONY makesyspkgs .WAIT makesyspkgsums
|
|
|
|
@true
|
|
|
|
|
2004-01-29 11:34:21 +03:00
|
|
|
sets: .PHONY maketars .WAIT makesums
|
2000-03-28 04:38:06 +04:00
|
|
|
@true
|
2002-03-23 02:15:32 +03:00
|
|
|
|
2004-01-29 11:34:21 +03:00
|
|
|
sourcesets: .PHONY makesrctars
|
2003-05-10 10:08:12 +04:00
|
|
|
@true
|
|
|
|
|
2002-03-23 02:15:32 +03:00
|
|
|
.include <bsd.sys.mk>
|