Best practice for extracting information from a makefile

Richard Shaw hobbes1069 at gmail.com
Tue Aug 16 13:18:54 UTC 2011


I'm working on a small library that uses a very simple makefile (no
autoconf, etc.) and it sets the library name and soname within the
makefile.

Instead of hard coding it in the spec file I would like to extract the
library name and soname from the makefile.

I tried "grep soname Makefile | awk..." type approach which works for
the soname but the library name is generated from the soname with a
variable and I haven't found a way to get an "evaluated" version of
the makefile.

I was hoping something like "make -p ..." would work but it doesn't
evaluated the variables, which seems useless since if I just wanted
the raw output 'cat' would work.

One method I've found (but not tried) would be to use sed to insert an
"export" in front of the two assignments so I can use the environment
variables.

Any ideas?

Thanks,
Richard


More information about the devel mailing list