Closed solidDoWant closed 2 months ago
If I'm understanding your issue correctly, what you're describing is currently by design in the Makefile Tools extension.
The makeDirectory
setting is used to determine what is passed to the command-line with the -C
command, but the make.exe
invocation always happens in the workspace root.
However, I'm not sure I fully understand your comment here:
"Following the docs, I basically need to run make -C ./kernel/master M=$PWD to build my module. This command works exactly as expected if I run it as a command in a shell with the workspace root as the working directory."
Are you saying that when you run it on the command-line, you DO run it from the workspace root? And it works? But that when the makefile tools extension does the same thing, it doesn't work?
Additionally, are you able to zip up your project and send it to us in a comment on this issue? This would make it easier to reproduce. Lastly, What operating system are you working on? Thanks!
@solidDoWant Closing based on last comment. Please follow up by creating a new issue if you find that this is still undesired behavior and not working for you. Thanks!
It appears that when performing the dry run, the
make
invocation always takes place in the workspace folder, even whenmakeDirectory
is set to another directory. The correct makefile ($makeDirectory/Makefile
) is executed, but it operates as if the file was in the workspace root. There are some cases where this causes makefile logic to not execute correctly.In my specific case, I'm writing some Linux kernel modules that are external to the Linux tree. I will probably not attempt to upstream them, so I am not forking the kernel git repo. Instead, I wrote some tooling to clone the kernel tree, and set it up so that it can be used for kernel development. My workspace directory looks like this:
Following the docs, I basically need to run
make -C ./kernel/master M=$PWD
to build my module. This command works exactly as expected if I run it as a command in a shell with the workspace root as the working directory.I tried to configure this plugin base on that. However, with this configuration:
I get a bunch of errors and messages logged that heavily indicate that
make
is operating out of the workspace root. For example, there are logs about files in themakeDirectory
not existing when they do exist (as regular files, not symlinks or anything else). Make also reports that some targets don't exist that exist under the kernel tree.To reproduce:
./kernel/master
should contain the kernel source tree (so the kernel's mainMakefile
should be there).my-module.c
can be empty, andKbuild
should contain onlyobj-m := my-module.o
.Install the kernel build requirements. On Ubuntu this will install everything:
This is a superset of what's required... sorry. Not sure what exactly is and isn't, but this will work.
cd ./kernel/master && make mrproper && make defconfig && make
.I'm not entirely certain if 2 and 3 are required, but I know that the issue will occur if they are performed.
It'd be nice if the working directory (not just
-C
var value) could be set when invokingmake
. I think that would allow me to work around the issue.