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