VERSION_SED_SCRIPT -- what it does, how to use

Can anyone more versed in Makefile-do explain/elaborate on what does the VERSION_SED_SCRIPT do: https://github.com/openwrt/openwrt/blob/ec6293febc244d187e71a6e54f44920be679cde4/include/version.mk#L89-L107 ?

I've seen examples of the use, I still don't understand what it does. Can I use it to "stamp" some files with the version number from the Makefile?

It replaces identifiers with full strings.
For example %V gets replaced with the version string e.g. 21.02.0

Base Files is a good practical example.
See the /etc/openwrt_release file here: git.openwrt.org Git - openwrt/openwrt.git/blob - package/base-files/files/etc/openwrt_release
And the Makefile at line 151 calls VERSION_SED_SCRIPT on the /etc/openwrt_release (and others) file and does the substitution of several variables.
git.openwrt.org Git - openwrt/openwrt.git/blob - package/base-files/Makefile

I don't think you can use VERSION_SED_SCRIPT for what you want to do (it has a very defined purpose). On line 159 of the same makefile, you can see a generic SED call.
git.openwrt.org Git - openwrt/openwrt.git/blob - package/base-files/Makefile
You might use a strategy like that in your files?

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.