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