11.32Schristos#	$NetBSD: Makefile,v 1.32 2016/01/14 01:13:26 christos Exp $
21.1Stv
31.1StvMODULE=		groff
41.1Stv
51.1StvALL_TARGET=	src/include all
61.24SlukemMAKE_ARGS=	bindir=${TOOLDIR}/lib/groff MAKEINFO=${TOOL_MAKEINFO:Q} \
71.24Slukem		INSTALL_INFO=${TOOL_INSTALL_INFO:Q}
81.28Stron# we don't need any of the X applications
91.28StronCONFIGURE_ARGS+=	--without-x
101.6Sjmc
111.6SjmcTMACDIR=	${TOOLDIR}/share/groff/tmac
121.19SwizSITETMACDIR=	${TOOLDIR}/share/groff/site-tmac
131.32SchristosGROFFDIR=	${.CURDIR}/../../external/gpl2/groff
141.2Stv
151.2Stv# Add gnuwrap hack directly to the Makefile.
161.2Stv_NOWRAPPER=1
171.14Spk
181.14Spk# Fixup build/Makefile.
191.14Spk# XXX - the groff distribution Makefiles don't get their dependencies right.
201.14Spk#	We use internal knowledge to specify additional target ordering.
211.14Spk#	This can be removed once our own make(1) can be invoked in true
221.14Spk#	sequential (i.e. compatible) mode again for subdir makes.
231.14Spk#
241.21Smartin.configure_done: _post_conf
251.21Smartin_post_conf: .USE
261.21Smartin	@(echo '.include "${.CURDIR}/../Makefile.gnuwrap"'; \
271.21Smartin	  echo '.ORDER: $$(ALLDIRS) dot';\
281.21Smartin	  echo '.ORDER: all install' ) >> build/Makefile
291.14Spk
301.1Stv
311.27Sross
321.1Stv.include "${.CURDIR}/../Makefile.gnuhost"
331.30Sapb.-include "${TOOLDIR}/share/compat/defs.mk"
341.1Stv
351.32Schristos.PATH:	${.CURDIR}/../../share/tmac ${GROFFDIR}/tmac
361.1Stv
371.9Stv_installtmac: .USE
381.23Slukem.if ${MKUPDATE} != "no"
391.9Stv	@if ! cmp ${.ALLSRC} ${.TARGET} >/dev/null 2>&1; then \
401.9Stv		echo ${HOST_INSTALL_FILE:Q} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}; \
411.9Stv		${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}; \
421.1Stv	fi
431.1Stv.else
441.9Stv	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}
451.1Stv.endif
461.9Stv
471.15Spk#
481.15Spk# Since ${TMACDIR} is created by the `realinstall' target, the `afterinstall'
491.15Spk# sources below that depend on it must wait until `realinstall' is done.
501.15Spk#
511.19Swiz#.for F in an andoc doc doc-ditroff doc-common doc-nroff doc-syms html html-end man man.local mdoc mdoc.local
521.19Swiz.for F in doc2html
531.19Swizafterinstall:	${TMACDIR}/${F}.tmac
541.19Swiz.PHONY:		${TMACDIR}/${F}.tmac
551.19Swiz${TMACDIR}/${F}.tmac: ${F} _installtmac
561.19Swiz.ORDER: realinstall ${TMACDIR}/${F}.tmac
571.19Swiz.endfor
581.19Swiz.for F in man.local mdoc.local
591.19Swizafterinstall:	${SITETMACDIR}/${F}
601.19Swiz.PHONY:		${SITETMACDIR}/${F}
611.25Swiz${SITETMACDIR}/${F}: ${F}-s _installtmac
621.19Swiz.ORDER: realinstall ${SITETMACDIR}/${F}
631.26SlukemCLEANFILES+=${F}-s
641.25Swiz${F}-s: ${F}
651.32Schristos	${TOOL_SED} -f ${GROFFDIR}/dist/tmac/strip.sed ${.ALLSRC} > ${.TARGET}
661.1Stv.endfor
671.4Stv
681.12Stv# The silly walk below is because sometimes the files begin with "g",
691.12Stv# and sometimes not, depending on what the host tool has at build time.
701.12Stv
711.12Stvafterinstall: install.grofflinks
721.15Spk.ORDER: realinstall install.grofflinks
731.12Stvinstall.grofflinks:
741.13Stv	@cd ${.CURDIR} && ${MAKE} install.grofflinks.recurse
751.13Stv
761.27Sross.for F in eqn groff indxbib pic refer soelim tbl
771.27Srossinstall.grofflinks.recurse: ${TOOLDIR}/bin/${_TOOL_PREFIX}${F}${HOSTEXEEXT}
781.27Sross.if exists(${TOOLDIR}/lib/groff/g${F}${HOSTEXEEXT})
791.27Sross${TOOLDIR}/bin/${_TOOL_PREFIX}${F}${HOSTEXEEXT}: ${TOOLDIR}/lib/groff/g${F}${HOSTEXEEXT}
801.27Sross.else
811.27Sross${TOOLDIR}/bin/${_TOOL_PREFIX}${F}${HOSTEXEEXT}: ${TOOLDIR}/lib/groff/${F}${HOSTEXEEXT}
821.27Sross.endif
831.27Sross	ln -f ${.ALLSRC} ${.TARGET}
841.27Sross.endfor
851.27Sross
861.27Sross.for F in nroff
871.16Sthorpejinstall.grofflinks.recurse: ${TOOLDIR}/bin/${_TOOL_PREFIX}${F}
881.12Stv.if exists(${TOOLDIR}/lib/groff/g${F})
891.16Sthorpej${TOOLDIR}/bin/${_TOOL_PREFIX}${F}: ${TOOLDIR}/lib/groff/g${F}
901.12Stv.else
911.16Sthorpej${TOOLDIR}/bin/${_TOOL_PREFIX}${F}: ${TOOLDIR}/lib/groff/${F}
921.12Stv.endif
931.4Stv	ln -f ${.ALLSRC} ${.TARGET}
941.4Stv.endfor
95