Read a macro from a .h into Makefile
How to read a macro constant from a header file into a Makefile?
In my software I plan to have a version.h which has, say, VERSION="1.2.3" and I want the software to instal in a directory specified by the software version. For example, if I have a BASEDIR which is /home/usr, I want version 1.2.3 of my software installed in home/usr/1.2.3, 1.2.4 in home/usr/1.2.4, and so on.
I currently have a file called VERSION, and this in my Makefile:
VERSION = `cat VERSION`
BINDIR = $(BASEDIR)/$(VERSION)
mkdir -p $(BINDIR); \
\rm -f $(BINDIR)/$@; \
cp $@ $(BINDIR)/$@ ; \
chmod -R 755 $(BINDIR)
But I would rather put the version number in a header file so that an application of my system can use something like this:
.....use a feature available in 1.2.3