1# $NetBSD: Makefile.inc,v 1.60 2024/04/05 23:05:04 christos Exp $ 2# 3 4# Ross Harvey <ross@NetBSD.org> 5 6.include <bsd.own.mk> # So we get /etc/mk.conf vars. 7.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" 8 9.if ${MKREPRO_TIMESTAMP:Uno} != "no" 10GROFF_TIMESTAMP=--timestamp=${MKREPRO_TIMESTAMP} 11DATE_TIMESTAMP=-r ${MKREPRO_TIMESTAMP} 12.endif 13 14# Whether or not to regenerate tables of contents 15# 16MKTOCS?=yes 17 18M?= ${.CURDIR:T} 19COMMON= ${.CURDIR}/../common 20 21MAIN= ${COMMON}/main ${EXTRA} 22TARG= INSTALL 23TARGS= ${TARG}.ps ${TARG}.txt ${TARG}.html ${TARG}.more 24TOCS= ${TARG}.PostScript.toc ${TARG}.ASCII.toc ${TARG}.HTML.toc \ 25 ${TARG}.more.toc 26SRCS= ${MAIN} ${COMMON}/macros \ 27 whatis ${COMMON}/contents hardware xfer prep \ 28 ${.CURDIR}/install ${COMMON}/postinstall upgrade \ 29 ${COMMON}/legal.common ${COMMON}/netboot \ 30 ${COMMON}/sysinst \ 31 ${.CURDIR}/../Makefile.inc ${MERGED_SRCS} 32 33whatis: .OPTIONAL 34 35PRESET= ${GFLAGS} -U -dM=${M} -dV=${DISTRIBVER} -d.CURDIR=${.CURDIR} -r${M}=1 36PRESET+= -rmajor=${DISTRIBVER:C/\..*$//} 37.if ${USE_XZ_SETS:Uno} == "yes" 38PRESET+= -dsetsuffix=tar.xz 39PRESET+= -dcompressor=xz 40.else 41PRESET+= -dsetsuffix=tgz 42PRESET+= -dcompressor=gzip 43.endif 44.if ${NETBSD_OFFICIAL_RELEASE:Uno} == "yes" 45PRESET+= -rFOR_RELEASE=1 46.else 47PRESET+= -rFOR_RELEASE=0 48.endif 49.if (${DISTRIBVER:M*.99.*}) 50PRESET+= -rRELEASE_BRANCH=0 51# make .Nx \*V happy 52PRESET+= -doperating-system-NetBSD-${DISTRIBVER}=${DISTRIBVER} 53.elif (${DISTRIBVER:M*.[0-9]*}) 54PRESET+= -rRELEASE_BRANCH=1 55PRESET+= -rminor=${DISTRIBVER:C/^[0-9]+\.([0-9])+.*$/\1/} 56nextmin!= expr ${DISTRIBVER:C/^[0-9]+\.([0-9])+.*$/\1/} + 1 57.if exists(${.CURDIR}/../../../doc/CHANGES-${DISTRIBVER:C/\..*$//}.${nextmin}) 58PRESET+= -rnextminor=${nextmin} 59.endif 60.endif 61.if defined(BUILDID) && "${BUILDID:M20*Z}" != "" 62curdate!= env LANG="C" TZ="UTC" ${TOOL_DATE} -d "${BUILDID:C/[0-9][0-9][0-9][0-9]Z$//}" "+%b %d, %Y" 63.else 64.if ${NETBSD_OFFICIAL_RELEASE:Uno} == "yes" 65.error "No release date could be derived from BUILDID" 66.else 67curdate!= env LANG="C" TZ="UTC" ${TOOL_DATE} ${DATE_TIMESTAMP} "+%b %d, %Y" 68.endif 69.endif 70PRESET+= -dcur_date="${curdate}" 71 72POST_PLAIN= -P-b -P-u -P-o 73 74ARGS_PS= ${PRESET} -dformat=PostScript ${ROFF_PAGESIZE} 75ARGS_TXT= ${PRESET} -dformat=ASCII ${POST_PLAIN} -Tascii -mtty-char 76ARGS_HTML= ${PRESET} -dformat=HTML ${POST_PLAIN} -Tlatin1 -ww 77ARGS_MORE= ${PRESET} -dformat=more -P-h -Tascii -mtty-char 78 79# 80# For example... 81# 82# .if ri386 ...stuff... 83# .Ss "Install notes for NetBSD/\*[MACHINE]" 84# 85 86all: ${TARGS} 87 88.if ${MKTOCS} != "no" 89TOC.ps= ${TOCS:M*.PostScript.*} 90TOC.txt= ${TOCS:M*.ASCII.*} 91TOC.html= ${TOCS:M*.HTML.*} 92TOC.more= ${TOCS:M*.more.*} 93.endif 94 95REMOVE_CREATION_DATE= ${TOOL_SED} -e '/^%%CreationDate:/d' 96 97${TARG}.ps: ${SRCS} ${TOC.ps} ${DISTRIBVERDEP} 98 ${TOOL_GROFF} ${ARGS_PS} ${GROFF_TIMESTAMP} -mdoc ${MAIN} \ 99 ${${MKREPRO:Uno} == "yes":? | ${REMOVE_CREATION_DATE} :} \ 100 > $@ 101 102${TARG}.pdf: ${TARG}.ps 103 ps2pdf ${TARG}.ps $@ 104 105${TARG}.txt: ${SRCS} ${TOC.txt} ${DISTRIBVERDEP} 106 ${TOOL_GROFF} ${ARGS_TXT} ${GROFF_TIMESTAMP} -mdoc ${MAIN} > $@ 107 108${TARG}.html: ${SRCS} ${TOC.html} ${DISTRIBVERDEP} 109 ${TOOL_GROFF} ${ARGS_HTML} ${GROFF_TIMESTAMP} -mdoc2html ${MAIN} > $@ 110 111${TARG}.more: ${SRCS} ${TOC.more} ${DISTRIBVERDEP} 112 ${TOOL_GROFF} ${ARGS_MORE} ${GROFF_TIMESTAMP} -mdoc ${MAIN} > $@ 113 114 115# Rules to build the table of contents (.toc) files. For the 116# PostScript version it's generated twice to take into account the 117# space taken by the TOC itself. Other versions are not paginated. 118 119${TARG}.PostScript.toc: ${SRCS} 120 ${TOOL_GROFF} -dTOC=1 ${ARGS_PS} ${GROFF_TIMESTAMP} -mdoc ${MAIN} > /dev/null 121 mv -f $@.tmp $@ 122 ${TOOL_GROFF} -dTOC=1 ${ARGS_PS} ${GROFF_TIMESTAMP} -mdoc ${MAIN} > /dev/null 123 mv -f $@.tmp $@ 124 125${TARG}.ASCII.toc: ${SRCS} 126 ${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} ${GROFF_TIMESTAMP} -mdoc ${MAIN} > /dev/null 127 mv -f $@.tmp $@ 128 129${TARG}.HTML.toc: ${SRCS} 130 ${TOOL_GROFF} -dTOC=1 ${ARGS_HTML} ${GROFF_TIMESTAMP} -mdoc2html ${MAIN} > /dev/null 131 mv -f $@.tmp $@ 132 133${TARG}.more.toc: ${SRCS} 134 ${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} ${GROFF_TIMESTAMP} -mdoc ${MAIN} > /dev/null 135 mv -f $@.tmp $@ 136 137 138release: check_RELEASEDIR .WAIT ${TARGS} 139 ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} 140 ${RELEASE_INSTALL} ${TARGS} ${RELEASEDIR}/${RELEASEMACHINEDIR} 141 142cleannotes: 143 rm -f [Ee]rrs mklog core *.core ${TARGS} ${TOCS} \ 144 ${TOCS:S/.toc$/.toc.tmp/g} 145 146clean cleandir distclean: cleannotes 147