summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-01-09 08:53:42 +0000
committermidipix <writeonce@midipix.org>2020-01-24 21:14:10 +0000
commit905d312e90abece267632d3c8551785c012783e2 (patch)
treed656f2d29e1ff21d9caac0aed7e8748898e71b14
parent69b25a1ef7afe6cb759129f9e69909b5c585b243 (diff)
downloadbautomake-905d312e90abece267632d3c8551785c012783e2.tar.bz2
bautomake-905d312e90abece267632d3c8551785c012783e2.tar.xz
project: added logic for m4/amversion.m4 generation.
-rw-r--r--project/extras.mk2
-rw-r--r--project/srcgen.mk26
-rw-r--r--project/tree.mk8
3 files changed, 36 insertions, 0 deletions
diff --git a/project/extras.mk b/project/extras.mk
index e69de29..f08cae8 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -0,0 +1,2 @@
+include $(PROJECT_DIR)/project/srcgen.mk
+
diff --git a/project/srcgen.mk b/project/srcgen.mk
new file mode 100644
index 0000000..ef689ce
--- /dev/null
+++ b/project/srcgen.mk
@@ -0,0 +1,26 @@
+# srcgen.mk: rules for source-file generation.
+# this file is covered by COPYING.BAUTOMAKE.
+
+M4_GEN_SRCS = m4/amversion.m4
+M4_CONFIGURE_INPUT = Generated via variable substitution from $(subst $(SOURCE_DIR)/m4/,,$<).
+
+M4_SUBST_RULES = \
+ -e 's!@configure_input@!$(M4_CONFIGURE_INPUT)!g' \
+ -e 's!@VERSION@!$(AUTOMAKE_VER)!g' \
+ -e 's!@APIVERSION@!$(AUTOMAKE_VER)!g'
+
+ALL_GEN_SRCS = $(M4_GEN_SRCS)
+
+m4/amversion.m4: $(SOURCE_DIR)/m4/amversion.in tree.tag
+ sed $(M4_SUBST_RULES) $< > $@
+
+srcgen: $(ALL_GEN_SRCS)
+
+srcgen-clean:
+ rm -f $(ALL_GEN_SRCS)
+
+all: srcgen
+
+clean: srcgen-clean
+
+.PHONY: srcgen srcgen-clean
diff --git a/project/tree.mk b/project/tree.mk
index 52f79f7..b7a5ff8 100644
--- a/project/tree.mk
+++ b/project/tree.mk
@@ -1,2 +1,10 @@
+TREE_DIRS = m4
+
tree.tag:
+ mkdir -p $(TREE_DIRS)
touch tree.tag
+
+tree-distclean:
+ rmdir $(TREE_DIRS) || true
+
+distclean: tree-distclean