Defining Makefiles variables from a script
Posted
by Freddy
on Stack Overflow
See other posts from Stack Overflow
or by Freddy
Published on 2010-04-27T02:21:29Z
Indexed on
2010/04/27
2:23 UTC
Read the original article
Hit count: 314
I am creating a Makefile which I want it to be a single file for different architectures, OSes, libraries, etc. To do this I have a build specific XML file which defines the different configuration options for each architecture. The config file is read by Perl (it could be any language) and the Perl output returns something like:
var1 := var1_value
var2 := var2_value
var3 := var3_value
What I am trying to do is define this variables in my Makefile. From the makefile I am calling my readconfig script and it is giving the correct output, but I have not been able to get this variables as part of my Makefile. I have tried the use of eval
and value
, but none of them have work (although it could be an issue of me not knowing how to use them. In overall what I am trying to do is something like:
read_config:
$(eval (perl '-require "readConfig.pl"'))
@echo $(var1)
It could be assumed I am using only GNU Make behavior. Things I could not change:
- Config file is on XML
- Using Perl as a XML parser
© Stack Overflow or respective owner