Answer the question
In order to leave comments, you need to log in
How to use one variable in multiple makefiles?
I have two makefiles, the first one calls the second one.
I would like to get some data from the second makefile.
For a better understanding of the issue, an example:
Makefile
SHAREDVAR =
all:
cd test && $(MAKE)
@echo main: $(SHAREDVAR) # Output expected: main: aaa
SHAREDVAR = aaa
all:
@echo test: $(SHAREDVAR) # Succeeds: aaa
include Makefile.variable
all:
cd test && $(MAKE)
@echo main: $(SHAREDVAR)
SHAREDVAR = temp
.PHONY: all
include ../Makefile.variable
SHAREDVAR = aaa
all:
@echo test: $(SHAREDVAR)
Answer the question
In order to leave comments, you need to log in
I have two makefiles, the first one calls the second one.
I would like to get some data from the second makefile.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question