I want to use the variables from another Makefile under the directory ~/kernelbuild/linux-3.14.37
in my own shell script.
Following is the variables that I need:
VERSION = 3
PATCHLEVEL = 14
SUBLEVEL = 37
The problem is that I am not allowed to change the Makefile, so export variable is not an option here.
Also, I have seen people saying to have a separate file that contains all the common variables need. This is practical but I need to put everything just in my single shell script.
I tried to include . ~/kernelbuild/linux-3.14.37/Makefile
in my shell script and I thought I should be able to use those variables, but it gives me following errors:
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 1: VERSION: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 2: PATCHLEVEL: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 3: SUBLEVEL: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 4: EXTRAVERSION: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 5: NAME: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 17: MAKEFLAGS: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 20: unexport: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 26: unexport: command not found
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 47: syntax error near unexpected token `"$(origin V)",'
/home/jl4347/kernelbuild/linux-3.14.37/Makefile: line 47: `ifeq ("$(origin V)", "command line")'
I think that's because the Makefile is not following the syntax rules for shell script. How can I do that then?
Thanks in advance!