2008-03-16 10:02:22 +03:00
|
|
|
# $NetBSD: Makefile,v 1.57 2008/03/16 07:02:22 lukem 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} \
|
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} \
|
|
|
|
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=
|
2004-01-08 04:48:45 +03:00
|
|
|
.if ${MKX11} != "no"
|
|
|
|
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-03-16 10:02:22 +03:00
|
|
|
.if ${MAKEVERBOSE} != 2
|
|
|
|
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
|
|
|
|
2002-02-11 19:23:17 +03:00
|
|
|
print_x11_version: .PHONY
|
2004-01-08 04:48:45 +03:00
|
|
|
${HOST_SH} -c '. ${.CURDIR}/sets.subr; echo $$x11_version'
|
2002-02-11 19:23:17 +03:00
|
|
|
|
2001-11-24 05:54:50 +03:00
|
|
|
# This target has debugging value only, really.
|
2004-03-06 19:12:06 +03:00
|
|
|
makeflist: .PHONY .PRECIOUS check_DESTDIR
|
2004-01-30 11:43:15 +03:00
|
|
|
${SETSCMD} ./makeflist ${MAKEFLIST_FLAGS}
|
2001-11-24 05:54:50 +03:00
|
|
|
|
2000-03-28 04:38:06 +04:00
|
|
|
#
|
|
|
|
# SET BUILDING TARGETS
|
|
|
|
#
|
|
|
|
|
2004-05-12 20:56:41 +04:00
|
|
|
TARDIR= ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
|
2004-01-30 11:43:15 +03:00
|
|
|
SOURCETARDIR= ${RELEASEDIR}/source/sets
|
|
|
|
|
2003-07-18 12:26:01 +04:00
|
|
|
.if ${MKUNPRIVED} == "no"
|
|
|
|
METALOG.unpriv=
|
2006-01-04 17:58:58 +03:00
|
|
|
METALOG.sanitised.unpriv=
|
2003-07-18 12:26:01 +04:00
|
|
|
.else
|
|
|
|
METALOG.unpriv= -M ${METALOG}
|
2006-01-04 17:58:58 +03:00
|
|
|
METALOG.sanitised= ${METALOG}.sanitised
|
|
|
|
METALOG.sanitised.unpriv= -M ${METALOG.sanitised}
|
2003-07-18 12:26:01 +04:00
|
|
|
.endif
|
|
|
|
|
2006-01-04 17:58:58 +03:00
|
|
|
.if ${MKUNPRIVED} == "no"
|
|
|
|
sanitise_METALOG: .PHONY
|
|
|
|
@true
|
|
|
|
.else
|
|
|
|
sanitise_METALOG: .PHONY ${METALOG.sanitised}
|
|
|
|
${METALOG.sanitised}: ${METALOG}
|
2006-01-06 21:08:59 +03:00
|
|
|
( cat ${NETBSDSRCDIR}/etc/mtree/NetBSD.dist ; \
|
|
|
|
echo '/unset all' ; \
|
|
|
|
cat ${METALOG} ) \
|
2006-11-05 21:04:44 +03:00
|
|
|
| ${TOOL_MTREE} -C -k all -N ${NETBSDSRCDIR}/etc > ${METALOG}.new && \
|
|
|
|
( rm -f ${METALOG} ; \
|
|
|
|
mv ${METALOG}.new ${METALOG} )
|
|
|
|
cat ${METALOG} | ${GREP} -v " optional" > ${.TARGET}
|
2006-01-04 17:58:58 +03:00
|
|
|
.endif
|
2004-01-30 11:43:15 +03:00
|
|
|
|
2006-01-04 17:58:58 +03:00
|
|
|
.if defined(DESTDIR) && ${DESTDIR} != ""
|
|
|
|
checkflist_if_DESTDIR: checkflist
|
|
|
|
.else
|
|
|
|
checkflist_if_DESTDIR:
|
|
|
|
.endif
|
|
|
|
|
|
|
|
checkflist: .PRECIOUS .PHONY check_DESTDIR sanitise_METALOG
|
|
|
|
${SETSCMD} ${.CURDIR}/checkflist \
|
|
|
|
${MAKEFLIST_FLAGS} ${CHECKFLIST_FLAGS} ${METALOG.sanitised.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}
|
|
|
|
|
2002-01-01 10:59:32 +03:00
|
|
|
|
2007-03-10 23:34:57 +03:00
|
|
|
# Note that the .WAIT inside the ${MAKETARSETS:@...} loop is not
|
|
|
|
# logically necessary, but many systems exhibit poor performance when
|
|
|
|
# running multiple parallel disk-intensive processes.
|
2006-01-04 17:58:58 +03:00
|
|
|
maketars: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
|
|
|
|
sanitise_METALOG checkflist_if_DESTDIR .WAIT \
|
2007-03-10 23:34:57 +03:00
|
|
|
maketarsetup .WAIT ${MAKETARSETS:@.TARS.@.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
|
|
|
|
|
|
|
|
makesetfiles: .PHONY
|
|
|
|
${_MKMSG_CREATE} "set lists"
|
|
|
|
${SETSCMD} ./maketars -S -d ${DESTDIR:S,^$,/,} ${METALOG.unpriv} \
|
2008-03-16 10:02:22 +03:00
|
|
|
${MAKETARS_FLAGS} \
|
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} \
|
2007-01-27 09:46:43 +03:00
|
|
|
${METALOG.sanitised.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} \
|
2006-01-04 17:58:58 +03:00
|
|
|
${METALOG.sanitised.unpriv} -N ${NETBSDSRCDIR}/etc \
|
|
|
|
${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?=
|
|
|
|
.else # MAKEVERBOSE == 2
|
|
|
|
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
|
|
|
|
mkdir -p ${RELEASEDIR}/${MACHINE}/binary/syspkgs
|
|
|
|
${SETSCMD} ${.CURDIR}/regpkgset \
|
|
|
|
${REGPKG.verbose} ${REGPKG.force} ${REGPKG.sloppy} \
|
|
|
|
${REGPKG.cache} ${REGPKG.update} \
|
|
|
|
-d ${DESTDIR:S,^$,/,} ${METALOG.sanitised.unpriv} \
|
|
|
|
-N ${NETBSDSRCDIR}/etc \
|
|
|
|
-t ${RELEASEDIR}/${MACHINE}/binary/syspkgs ${SYSPKGSETS}
|
|
|
|
|
|
|
|
makesyspkgsums: .PHONY check_RELEASEDIR
|
|
|
|
${MAKESUMS} -t ${RELEASEDIR}/${MACHINE}/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>
|