makefile through vs-code (with makefile-tools) fails shell commands

165 Views Asked by At

I'm running VS-code on SSH mode (From WIN11 to UBUNTU server).

The C project uses a makefile.

The makefile 'collects' all the C files using 'find' command from shell:

SRCDIR := components/my_sources
SRCS := $(shell find $(SRCDIR) -name '*.c')

When I run 'make' through the terminal windows of VS-code, the make completes successully, while I am trying to build from VS-C, it fails:

find: ‘components/my_sources’: No such file or directory

I checked the 'find' command itself both in the terminal and in the makefile, and I see the difference. in the terminal I get a list of files, while from VS-Code 'build', I get empty list.

I also tried to use full path as input to the 'find' command. yet if fails

What should I define in VS code to make it work?

1

There are 1 best solutions below

2
On

As @MadScientist mentioned, the make command was running in an erroneous directory.

I had to update in Makefile Tools configuration, the field (as for v0.7.0):

***Makefile: Make Directory***

The folder path to be passed to make via the switch -C