more version examples

tengel 2024-03-20 11:55:04 -05:00
parent 7202cf3da3
commit b5c4d12c4c

@ -80,14 +80,20 @@ clean:
### External Data ### 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 ```makefile
leftparen := ( leftparen := (
version := $(shell eval $$(grep ^_VERSION= src/myfile.sh); echo $$_VERSION| awk -F' \\$(leftparen)' '{print $$1}' | sed "s/ /-/g" ) 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 ```makefile
version := $(shell grep ^__version__ src/version.py | awk '{print $$3}') version := $(shell grep ^__version__ src/version.py | awk '{print $$3}')
@ -144,6 +150,5 @@ pyvenv:
install-python: install-main install-python: install-main
sed -i "1s/python/${PYSHORT}/" "$(DESTDIR)$(BINPREFIX)/${bin_name}" sed -i "1s/python/${PYSHORT}/" "$(DESTDIR)$(BINPREFIX)/${bin_name}"
``` ```