1# $MirOS: src/bin/pax/Makefile,v 1.16 2013/07/09 18:48:11 tg Exp $
2# $OpenBSD: Makefile,v 1.10 2001/05/26 00:32:20 millert Exp $
3#-
4# It may be necessary to define some options on pre-4.4BSD or
5# other operating systems:
6#
7# -DLONG_OFF_T	The base type of off_t is a long, not a long long.
8#		This is often defined in: /usr/include/sys/types.h
9
10PROG=   pax
11SRCS=	ar.c ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
12	gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c \
13	tar.c tty_subs.c
14MAN=	cpio.1 pax.1 tar.1
15LINKS+=	${BINDIR}/pax ${BINDIR}/cpio
16LINKS+=	${BINDIR}/pax ${BINDIR}/tar
17
18.if (${MACHINE_OS} == "Interix") || (${MACHINE_OS} == "Linux") || \
19    ((${MACHINE_OS} == "GNU") && (${OSNAME} != "GNU/kFreeBSD"))
20CPPFLAGS+= -DLONG_OFF_T
21.endif
22
23.if (${MACHINE_OS} == "BSD")
24CPPFLAGS+= -DHAVE_STRLCPY
25CPPFLAGS+= -DHAVE_STRMODE
26CPPFLAGS+= -DHAVE_VIS
27.endif
28
29.include <bsd.prog.mk>
30
31.ifmake cats
32V_GROFF!=	pkg_info -e 'groff-*'
33V_GHOSTSCRIPT!=	pkg_info -e 'ghostscript-*'
34.  if empty(V_GROFF) || empty(V_GHOSTSCRIPT)
35.    error empty V_GROFF=${V_GROFF} or V_GHOSTSCRIPT=${V_GHOSTSCRIPT}
36.  endif
37.endif
38
39CLEANFILES+=	${MANALL:S/.cat/.ps/} ${MAN:S/$/.pdf/} ${MANALL:S/$/.gz/}
40CLEANFILES+=	${MAN:S/$/.htm/} ${MAN:S/$/.htm.gz/}
41CLEANFILES+=	${MAN:S/$/.txt/} ${MAN:S/$/.txt.gz/}
42CATS_KW=	cpio, pax, tar
43CATS_TITLE_cpio_1=paxcpio - copy file archives in and out
44CATS_TITLE_pax_1=pax - read and write file archives and copy directory hierarchies
45CATS_TITLE_tar_1=paxtar - Unix tape archiver
46cats: ${MANALL} ${MANALL:S/.cat/.ps/}
47.if "${MANALL:Ncpio.cat1:Npax.cat1:Ntar.cat1}" != ""
48.  error Adjust here.
49.endif
50.for _m _n in cpio 1 pax 1 tar 1
51	x=$$(ident ${.CURDIR:Q}/${_m}.${_n} | \
52	    awk '/MirOS:/ { print $$4$$5; }' | \
53	    tr -dc 0-9); (( $${#x} == 14 )) || exit 1; exec \
54	    ${MKSH} ${BSDSRCDIR:Q}/contrib/hosted/tg/ps2pdfmir -c \
55	    -o ${_m}.${_n}.pdf '[' /Author '(The MirOS Project)' \
56	    /Title '('${CATS_TITLE_${_m}_${_n}:Q}')' \
57	    /Subject '(BSD Reference Manual)' /ModDate "(D:$$x)" \
58	    /Creator '(GNU groff version ${V_GROFF:S/groff-//} \(MirPorts\))' \
59	    /Producer '(Artifex Ghostscript ${V_GHOSTSCRIPT:S/ghostscript-//:S/-artifex//} \(MirPorts\))' \
60	    /Keywords '('${CATS_KW:Q}')' /DOCINFO pdfmark \
61	    -f ${_m}.ps${_n}
62.endfor
63	set -e; . ${BSDSRCDIR:Q}/scripts/roff2htm; set_target_absolute; \
64	    for m in ${MANALL}; do \
65		bn=$${m%.*}; ext=$${m##*.cat}; \
66		[[ $$bn != $$m ]]; [[ $$ext != $$m ]]; \
67		gzip -n9 <"$$m" >"$$m.gz"; \
68		col -bx <"$$m" >"$$bn.$$ext.txt"; \
69		rm -f "$$bn.$$ext.txt.gz"; gzip -n9 "$$bn.$$ext.txt"; \
70		do_conversion_verbose "$$bn" "$$ext" "$$m" "$$bn.$$ext.htm"; \
71		rm -f "$$bn.$$ext.htm.gz"; gzip -n9 "$$bn.$$ext.htm"; \
72	done
73
74# NetBSD®
75NOMANDOC=	Yes
76# OpenBSD
77.if defined(MANLINT) && !empty(MANLINT)
78all: use_nroff_instead
79use_nroff_instead:
80	@echo 'Install GNU groff or AT&T nroff to format *roff manpages!'
81	@exit 1
82.endif
83