From 905d312e90abece267632d3c8551785c012783e2 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 9 Jan 2020 08:53:42 +0000 Subject: project: added logic for m4/amversion.m4 generation. --- project/extras.mk | 2 ++ project/srcgen.mk | 26 ++++++++++++++++++++++++++ project/tree.mk | 8 ++++++++ 3 files changed, 36 insertions(+) create mode 100644 project/srcgen.mk (limited to 'project') 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 -- cgit v1.2.3