hi,
I am trying to export a variable from the parent makefile to a child instance of my makefile within the same directory.
the relevant code in my parent makefile is:
libvar := $(notdir $(basename ../src/file1))
export libvar
.PHONY: library
library:
make -f makechild libvar=file1
in the child makefile, i.e. makechild, I have the following relevant code:
LVAR: =
fname := $(addprefix lib, $(LVAR))
but obviously I am missing something because echo $(fname) returns 'lib' (instead of libfile1)when I run the make command in the parent makefile.:wall:
can you pls. help me fix the code so I can export the value of libvar into LVAR
---------- Post updated at 11:10 PM ---------- Previous update was at 09:52 PM ----------
I just figured out I was making a dumb error,
I should keep the variable names the same in both the parent and child makefile.
so, in my child makefile, I renamed LVAR to libvar and it worked.
.....just in case anyone might be interested.