5

Making a make variable persist to subdirectory make files

view full story
linux-howto

http://forums.fedoraforum.org – If I have this structure Code: DirectoryA/DirectoryB and both DirectoryA and DirectoryB have a Makefile. The DirectoryA Makefile 'depend' target simply calls the makedepend command from DirectoryB. Code: makedepend -o$(OBJ) -- $(INCFLAGS) $(MAKEDEPEND_INCFLAGS) $(DEFINEFLAGS) -- $(ALL_FILES) If I set MAKEDEPEND_INCFLAGS in the DirectoryB Makefile, everything works. However, if I set MAKEDEPEND_INCFLAGS in the DirectoryA Makefile (the idea being that then I don't also have to put it in DirectoryC, D, etc (which all behave just like DirectoryB)), it doesn't work, it's as if the variable is not set. (by "set", i mean put Code: MAKEDEPEND_INCFLAGS = -I/usr/include/ -I/usr/include/linux -I/usr/include/c++/4.4.1 -I/usr/include/c++/4.4.1/i586-redhat-linux/ -I/usr/include/c++/4.4.1/backward -I/usr/include/c++/3.4.6/backward/ ) Is there a way to make the value of the variable persist even when it goes into the next level Makefile? Thanks, Dave ---------- Post added at 09:10 PM CST ---------- Previous post was at 08:44 PM CST ---------- I found out that you can "export" the variable (just like you would from .bashrc) and then the next level of make will find it. (HowTos)