xref: /netbsd-src/tools/groff/Makefile (revision d20841bb642898112fe68f0ad3f7b26dddf56f07)
1#	$NetBSD: Makefile,v 1.27 2004/02/06 00:06:53 ross Exp $
2
3MODULE=		groff
4
5ALL_TARGET=	src/include all
6MAKE_ARGS=	bindir=${TOOLDIR}/lib/groff MAKEINFO=${TOOL_MAKEINFO:Q} \
7		INSTALL_INFO=${TOOL_INSTALL_INFO:Q}
8
9TMACDIR=	${TOOLDIR}/share/groff/tmac
10SITETMACDIR=	${TOOLDIR}/share/groff/site-tmac
11
12# Add gnuwrap hack directly to the Makefile.
13_NOWRAPPER=1
14
15# Fixup build/Makefile.
16# XXX - the groff distribution Makefiles don't get their dependencies right.
17#	We use internal knowledge to specify additional target ordering.
18#	This can be removed once our own make(1) can be invoked in true
19#	sequential (i.e. compatible) mode again for subdir makes.
20#
21.configure_done: _post_conf
22_post_conf: .USE
23	@(echo '.include "${.CURDIR}/../Makefile.gnuwrap"'; \
24	  echo '.ORDER: $$(ALLDIRS) dot';\
25	  echo '.ORDER: all install' ) >> build/Makefile
26
27
28
29.include "${.CURDIR}/../Makefile.gnuhost"
30COMPATOBJ!=	cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
31.-include	"${COMPATOBJ}/defs.mk"
32
33.PATH:		${.CURDIR}/../../share/tmac ${.CURDIR}/../../gnu/usr.bin/groff/tmac
34
35_installtmac: .USE
36.if ${MKUPDATE} != "no"
37	@if ! cmp ${.ALLSRC} ${.TARGET} >/dev/null 2>&1; then \
38		echo ${HOST_INSTALL_FILE:Q} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}; \
39		${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}; \
40	fi
41.else
42	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}
43.endif
44
45#
46# Since ${TMACDIR} is created by the `realinstall' target, the `afterinstall'
47# sources below that depend on it must wait until `realinstall' is done.
48#
49#.for F in an andoc doc doc-ditroff doc-common doc-nroff doc-syms html html-end man man.local mdoc mdoc.local
50.for F in doc2html
51afterinstall:	${TMACDIR}/${F}.tmac
52.PHONY:		${TMACDIR}/${F}.tmac
53${TMACDIR}/${F}.tmac: ${F} _installtmac
54.ORDER: realinstall ${TMACDIR}/${F}.tmac
55.endfor
56.for F in man.local mdoc.local
57afterinstall:	${SITETMACDIR}/${F}
58.PHONY:		${SITETMACDIR}/${F}
59${SITETMACDIR}/${F}: ${F}-s _installtmac
60.ORDER: realinstall ${SITETMACDIR}/${F}
61CLEANFILES+=${F}-s
62${F}-s: ${F}
63	sed -f ${.CURDIR}/../../gnu/dist/groff/tmac/strip.sed ${.ALLSRC} > ${.TARGET}
64.endfor
65
66# The silly walk below is because sometimes the files begin with "g",
67# and sometimes not, depending on what the host tool has at build time.
68
69afterinstall: install.grofflinks
70.ORDER: realinstall install.grofflinks
71install.grofflinks:
72	@cd ${.CURDIR} && ${MAKE} install.grofflinks.recurse
73
74.for F in eqn groff indxbib pic refer soelim tbl
75install.grofflinks.recurse: ${TOOLDIR}/bin/${_TOOL_PREFIX}${F}${HOSTEXEEXT}
76.if exists(${TOOLDIR}/lib/groff/g${F}${HOSTEXEEXT})
77${TOOLDIR}/bin/${_TOOL_PREFIX}${F}${HOSTEXEEXT}: ${TOOLDIR}/lib/groff/g${F}${HOSTEXEEXT}
78.else
79${TOOLDIR}/bin/${_TOOL_PREFIX}${F}${HOSTEXEEXT}: ${TOOLDIR}/lib/groff/${F}${HOSTEXEEXT}
80.endif
81	ln -f ${.ALLSRC} ${.TARGET}
82.endfor
83
84.for F in nroff
85install.grofflinks.recurse: ${TOOLDIR}/bin/${_TOOL_PREFIX}${F}
86.if exists(${TOOLDIR}/lib/groff/g${F})
87${TOOLDIR}/bin/${_TOOL_PREFIX}${F}: ${TOOLDIR}/lib/groff/g${F}
88.else
89${TOOLDIR}/bin/${_TOOL_PREFIX}${F}: ${TOOLDIR}/lib/groff/${F}
90.endif
91	ln -f ${.ALLSRC} ${.TARGET}
92.endfor
93