summaryrefslogtreecommitdiffstats
path: root/share/mk/build/ps.mk
blob: 5b29dc1ad8241b4c73567cbb0f7377e800126055 (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
########################################################################
# Copyright 2023, Alejandro Colomar <alx@kernel.org>
# SPDX-License-Identifier: GPL-3.0-or-later
########################################################################


ifndef MAKEFILE_BUILD_PS_INCLUDED
MAKEFILE_BUILD_PS_INCLUDED := 1


include $(MAKEFILEDIR)/build/_.mk
include $(MAKEFILEDIR)/build/groff.mk
include $(MAKEFILEDIR)/cmd.mk
include $(MAKEFILEDIR)/src.mk


DEFAULT_GROPSFLAGS :=
EXTRA_GROPSFLAGS   :=
GROPSFLAGS         := $(DEFAULT_GROPSFLAGS) $(EXTRA_GROPSFLAGS)
GROPS              := grops


_PSMAN_troff   := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.ps.troff,$(NONSO_MAN) $(NONSO_MDOC))
_PSMAN_MAN_set := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.ps.set,$(NONSO_MAN))
_PSMAN_MDOC_set:= $(patsubst $(MANDIR)/%,$(_MANDIR)/%.ps.set,$(NONSO_MDOC))
_PSMAN         := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.ps,$(NONSO_MAN) $(NONSO_MDOC))


$(_PSMAN_troff): %.ps.troff: %.eqn | $$(@D)/
	$(info	EQN	$@)
	! ($(EQN) -Tps $(EQNFLAGS) <$< 2>&1 >$@) \
	| $(GREP) ^ >&2

$(_PSMAN_MAN_set): %.ps.set: %.ps.troff | $$(@D)/
	$(info	TROFF	$@)
	! ($(TROFF) -Tps $(TROFFFLAGS_MAN) <$< 2>&1 >$@) \
	| $(GREP) ^ >&2

$(_PSMAN_MDOC_set): %.ps.set: %.ps.troff | $$(@D)/
	$(info	TROFF	$@)
	! ($(TROFF) -Tps $(TROFFFLAGS_MDOC) <$< 2>&1 >$@) \
	| $(GREP) ^ >&2

$(_PSMAN): %.ps: %.ps.set | $$(@D)/
	$(info	GROPS	$@)
	$(GROPS) $(GROPSFLAGS) <$< >$@


.PHONY: build-ps-eqn
build-ps-eqn: $(_PSMAN_troff);

.PHONY: build-ps-troff-man
build-ps-troff-man: $(_PSMAN_MAN_set);

.PHONY: build-ps-troff-mdoc
build-ps-troff-mdoc: $(_PSMAN_MDOC_set);

.PHONY: build-ps-troff
build-ps-troff: build-ps-troff-man build-ps-troff-mdoc;

.PHONY: build-ps-grops
build-ps-grops: $(_PSMAN);

.PHONY: build-ps
build-ps: build-ps-grops;


endif  # include guard