summaryrefslogtreecommitdiffstats
path: root/share/mk/build/pre.mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk/build/pre.mk')
-rw-r--r--share/mk/build/pre.mk47
1 files changed, 47 insertions, 0 deletions
diff --git a/share/mk/build/pre.mk b/share/mk/build/pre.mk
new file mode 100644
index 0000000..4c458fa
--- /dev/null
+++ b/share/mk/build/pre.mk
@@ -0,0 +1,47 @@
+########################################################################
+# Copyright 2021-2023, Alejandro Colomar <alx@kernel.org>
+# SPDX-License-Identifier: GPL-3.0-or-later
+########################################################################
+
+
+ifndef MAKEFILE_BUILD_PRE_INCLUDED
+MAKEFILE_BUILD_PRE_INCLUDED := 1
+
+
+include $(MAKEFILEDIR)/build/_.mk
+include $(MAKEFILEDIR)/cmd.mk
+include $(MAKEFILEDIR)/src.mk
+
+
+DEFAULT_PRECONVFLAGS :=
+EXTRA_PRECONVFLAGS :=
+PRECONVFLAGS := $(DEFAULT_PRECONVFLAGS) $(EXTRA_PRECONVFLAGS)
+PRECONV := preconv
+
+TBL := tbl
+
+
+_MAN_tbl := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.tbl,$(NONSO_MAN) $(NONSO_MDOC))
+_MAN_eqn := $(patsubst $(MANDIR)/%,$(_MANDIR)/%.eqn,$(NONSO_MAN) $(NONSO_MDOC))
+
+
+$(_MAN_tbl): $(_MANDIR)/%.tbl: $(MANDIR)/% | $$(@D)/
+ $(info PRECONV $@)
+ $(PRECONV) $(PRECONVFLAGS) $< >$@
+
+$(_MAN_eqn): %.eqn: %.tbl | $$(@D)/
+ $(info TBL $@)
+ $(TBL) <$< >$@
+
+
+.PHONY: build-pre-preconv
+build-pre-preconv: $(_MAN_tbl);
+
+.PHONY: build-pre-tbl
+build-pre-tbl: $(_MAN_eqn);
+
+.PHONY: build-pre
+build-pre: build-pre-tbl;
+
+
+endif # include guard