blob: 4fc34e4e31d5d35fb77cb395cc3e1487ee59f17e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# $OpenBSD: Makefile.inc,v 1.7 2011/11/17 16:28:45 schwarze Exp $
# --- programs ---
DIFF=diff -au
MANDOC?=mandoc
# --- lists of targets ---
ASCIIFILES=${REGRESS_TARGETS:C/$/.mandoc_ascii/}
ASCIIDIFFS=${REGRESS_TARGETS:C/$/.diff_ascii/}
MANFILES=${REGRESS_TARGETS:C/$/.mandoc_man/} ${REGRESS_TARGETS:C/$/.in_man/}
MANDIFFS=${REGRESS_TARGETS:C/$/.diff_man/}
SKIP_TMAN?=
# --- convenience targets ---
all: ascii-clean tman-clean
ascii: ascii-clean ${ASCIIDIFFS}
tman: tman-clean ${MANDIFFS}
# --- suffix rules ---
.SUFFIXES: .diff_ascii .diff_man .in .in_man \
.mandoc_ascii .mandoc_man .out_ascii
.in: ${.PREFIX}.diff_ascii ${.PREFIX}.diff_man
@:
.in.mandoc_ascii:
@echo "${MANDOC} ${.IMPSRC:T} > ${.TARGET}"
@${MANDOC} ${.IMPSRC} > ${.TARGET}
.mandoc_ascii.diff_ascii:
@echo "${DIFF} ${.IMPSRC:S/mandoc_ascii$/out_ascii/} ${.IMPSRC}"
@${DIFF} ${.CURDIR}/${.IMPSRC:S/mandoc_ascii$/out_ascii/} ${.IMPSRC}
.in.in_man:
@echo "${MANDOC} -Tman ${.IMPSRC:T} > ${.TARGET}"
@${MANDOC} -Tman ${.IMPSRC} > ${.TARGET}
.in_man.mandoc_man:
${MANDOC} -Omdoc ${.IMPSRC} > ${.TARGET}
# --- single-file targets ---
.for t in ${REGRESS_TARGETS}
. if empty(SKIP_TMAN:MALL) && empty(SKIP_TMAN:M${t})
${t}.diff_man: ${t}.mandoc_man
@echo "${DIFF} ${t}.out_ascii ${.ALLSRC}"
@${DIFF} ${.CURDIR}/${t}.out_ascii ${.ALLSRC}
. else
${t}.diff_man:
. if empty(SKIP_TMAN:MSILENT)
@echo "TODO: -Tman disabled for: ${.TARGET}"
. endif
. endif
.endfor
# --- phony targets ---
clean: ascii-clean tman-clean
ascii-clean:
rm -f ${ASCIIFILES}
tman-clean:
rm -f ${MANFILES}
.PHONY: ascii ascii-clean tman tman-clean ${ASCIIDIFFS} ${MANDIFFS}
# ----------------------------------------------------------------------
# development targets, may affect version-controlled files
# ----------------------------------------------------------------------
# --- the groff program ---
NROFF=/usr/local/bin/nroff -c -mandoc -Tascii
# --- the list of targets ---
SKIP_GROFF?=
OUTFILES=
.for t in ${REGRESS_TARGETS}
. if empty(SKIP_GROFF:M${t})
OUTFILES+=${t}.out_ascii
. endif
.endfor
# --- the convenience target ---
groff: ${REGRESS_TARGETS:C/$/.out_ascii/}
@test ! -e ${.CURDIR}/obj || \
(echo "*** obj exists, run make obj-clean"; exit 1)
# --- single-file targets ---
.for t in ${REGRESS_TARGETS}
. if empty(SKIP_GROFF:M${t})
${t}.out_ascii: ${t}.in
${NROFF} ${.ALLSRC} > ${.TARGET}
. else
.PHONY: ${t}.out_ascii
${t}.out_ascii:
@echo "TODO: groff disabled for: ${.TARGET}"
. endif
.endfor
# --- phony targets ---
groff-clean: obj-clean
rm -f ${OUTFILES}
obj-clean: clean
rm -rf ${.CURDIR}/obj/*
rm -f ${.CURDIR}/obj
.PHONY: groff groff-clean obj-clean
|