From b5c4d12c4cdaa1ec546601ba22ba41cb6c7f26d2 Mon Sep 17 00:00:00 2001 From: tengel Date: Wed, 20 Mar 2024 11:55:04 -0500 Subject: [PATCH] more version examples --- Makefile-Template.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile-Template.md b/Makefile-Template.md index 921c854..c208f7c 100644 --- a/Makefile-Template.md +++ b/Makefile-Template.md @@ -80,14 +80,20 @@ clean: ### External Data -Get the version from a bash source file without spaces around "=" +Get the version from a comment header with `## Version: 0.0.1` format + +```makefile +version := $(shell grep '^\#\# Version:' src/myfile.sh | cut -d' ' -f3) +``` + +Get the version from a source file with `_VERSION="0.0.1"` format (shell) ```makefile leftparen := ( version := $(shell eval $$(grep ^_VERSION= src/myfile.sh); echo $$_VERSION| awk -F' \\$(leftparen)' '{print $$1}' | sed "s/ /-/g" ) ``` -Same thing but the file is a Python style source with spaces +Get the version from a source file with `_version_ = "0.0.1"` format (python) ```makefile version := $(shell grep ^__version__ src/version.py | awk '{print $$3}') @@ -144,6 +150,5 @@ pyvenv: install-python: install-main sed -i "1s/python/${PYSHORT}/" "$(DESTDIR)$(BINPREFIX)/${bin_name}" - ```