From 24df1f7e7f1350fc9e5fad127ed6dcf847e6b0b8 Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Wed, 30 Sep 2015 20:47:27 +0000 Subject: [PATCH] Replace most of the beforeinstall: hack with FILES mechanism. This now generates the files into the OBJDIR as needed. Some of the files are installed directly from the src directory. Files which are generated from the src directory are renamed to .in to generate them and avoid colliding with the checked-in file when CURDIR=OBJDIR. The remaining beforeinstall: handling still needs to be reworked as it does not work well with staging for packaging. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division --- gnu/usr.bin/groff/tmac/Makefile | 68 +++++++++++-------- .../tmac/{fr.ISO8859-1 => fr.ISO8859-1.in} | 0 .../groff/tmac/{mdoc.local => mdoc.local.in} | 0 .../groff/tmac/{ru.KOI8-R => ru.KOI8-R.in} | 0 4 files changed, 41 insertions(+), 27 deletions(-) rename gnu/usr.bin/groff/tmac/{fr.ISO8859-1 => fr.ISO8859-1.in} (100%) rename gnu/usr.bin/groff/tmac/{mdoc.local => mdoc.local.in} (100%) rename gnu/usr.bin/groff/tmac/{ru.KOI8-R => ru.KOI8-R.in} (100%) diff --git a/gnu/usr.bin/groff/tmac/Makefile b/gnu/usr.bin/groff/tmac/Makefile index d74f76a28c5c..b756ec0c6ae4 100644 --- a/gnu/usr.bin/groff/tmac/Makefile +++ b/gnu/usr.bin/groff/tmac/Makefile @@ -14,7 +14,7 @@ MLINKS= groff_ms.7 ms.7 MLINKS+= groff_me.7 me.7 MLINKS+= groff_mdoc.7 mdoc.samples.7 -CLEANFILES= ${MAN} ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/} +CLEANFILES= ${MAN} NORMALFILES= mandoc.tmac andoc.tmac an-old.tmac \ me.tmac \ @@ -39,45 +39,59 @@ NORMALFILES= mandoc.tmac andoc.tmac an-old.tmac \ composite.tmac \ eqnrc \ troffrc troffrc-end \ + koi8-r.tmac hyphen.ru \ hyphen.us hyphenex.us +# These are all generated into the OBJDIR. SPECIALFILES= an.tmac man.tmac s.tmac ms.tmac www.tmac STRIPFILES= e.tmac doc.tmac mdoc.local MDOCFILES= doc-common doc-ditroff doc-nroff doc-syms \ fr.ISO8859-1 ru.KOI8-R +# These are in srcdir and must be built special to avoid colliding with +# CURDIR=OBJDIR. +SRCFILES= fr.ISO8859-1 mdoc.local ru.KOI8-R +CLEANFILES+= ${SRCFILES} -all: ${MDOCFILES:S/$/-s/} ${STRIPFILES:S/$/-s/} ${SPECIALFILES:S/$/-s/} +FILESGROUPS= FILES +FILES= ${NORMALFILES} +FILESOWN= ${TMACOWN} +FILESGRP= ${TMACGRP} +FILESMODE= ${TMACMODE} +FILESDIR= ${TMACDIR} +MDOCFILESDIR= ${MDOCDIR} -.for f in ${MDOCFILES} ${STRIPFILES} -$f-s: $f - sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET} -.endfor - -.for f in ${SPECIALFILES} -$f-s: $f - sed -e "s;@TMAC_AN_PREFIX@;${tmac_an_prefix};g" \ - -e "s;@TMAC_S_PREFIX@;${tmac_s_prefix};g" \ - -e "s;@PNMTOPS_NOSETPAGE@;pnmtops;g" \ - ${.ALLSRC} > ${.TARGET} +# Setup handling for the generated and special file groups +.for var in SPECIAL STRIP MDOC +FILESGROUPS+= ${var}FILES +CLEANFILES+= ${${var}FILES} +${var}FILESOWN?=${TMACOWN} +${var}FILESGRP?=${TMACGRP} +${var}FILESMODE?=${TMACMODE} +${var}FILESDIR?=${TMACDIR} .endfor beforeinstall: - (cd ${DIST_DIR} && \ - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - ${NORMALFILES} ${DESTDIR}${TMACDIR}) - (cd ${.CURDIR} && \ - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - koi8-r.tmac hyphen.ru ${DESTDIR}${TMACDIR}) -.for f in ${STRIPFILES} ${SPECIALFILES} - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - $f-s ${DESTDIR}${TMACDIR}/$f -.endfor -.for f in ${MDOCFILES} - ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ - $f-s ${DESTDIR}${MDOCDIR}/$f -.endfor .if !exists(${DESTDIR}${TMACDIR}/man.local) ${INSTALL} -o ${TMACOWN} -g ${TMACGRP} -m ${TMACMODE} \ ${DIST_DIR}/man.local ${DESTDIR}${TMACDIR} .endif .include + +# Do this after ../Makefile.inc gets included so DIST_DIR is defined. +.for f in ${MDOCFILES} ${STRIPFILES} +# Generate the file from the contrib dir or src dir as needed. +.if ${SRCFILES:M${f}} != "" +${f}: ${.CURDIR}/${f}.in +.else +${f}: ${DIST_DIR}/${f} +.endif + sed -f ${DIST_DIR}/strip.sed ${.ALLSRC} > ${.TARGET} +.endfor + +.for f in ${SPECIALFILES} +${f}: ${DIST_DIR}/${f} + sed -e "s;@TMAC_AN_PREFIX@;${tmac_an_prefix};g" \ + -e "s;@TMAC_S_PREFIX@;${tmac_s_prefix};g" \ + -e "s;@PNMTOPS_NOSETPAGE@;pnmtops;g" \ + ${.ALLSRC} > ${.TARGET} +.endfor diff --git a/gnu/usr.bin/groff/tmac/fr.ISO8859-1 b/gnu/usr.bin/groff/tmac/fr.ISO8859-1.in similarity index 100% rename from gnu/usr.bin/groff/tmac/fr.ISO8859-1 rename to gnu/usr.bin/groff/tmac/fr.ISO8859-1.in diff --git a/gnu/usr.bin/groff/tmac/mdoc.local b/gnu/usr.bin/groff/tmac/mdoc.local.in similarity index 100% rename from gnu/usr.bin/groff/tmac/mdoc.local rename to gnu/usr.bin/groff/tmac/mdoc.local.in diff --git a/gnu/usr.bin/groff/tmac/ru.KOI8-R b/gnu/usr.bin/groff/tmac/ru.KOI8-R.in similarity index 100% rename from gnu/usr.bin/groff/tmac/ru.KOI8-R rename to gnu/usr.bin/groff/tmac/ru.KOI8-R.in