source
is a shell built-in command, not an executable that you can start from anywhere but a shell. What source
does is to read and execute the contents of a file in the current shell, without starting a new shell.
The purpose of that is to modify the state of the current shell (if you just sh venv/bin/activate
, your shell would also execute the contents of the activate
script, but then be done, and quit).
But what you want to do is modify the state of your make
program. Running the activate
script in a shell that you spawn, in whatever way, from make
, is not going to change anything about the environment that make
sees.
That's because every program (A) launched by another program (B) gets its own copy of the environment of the launching program (B), which it (A) can change to its heart's desire, without affecting the environment of the launching program (B).
So, what you want to do cannot work, even theoretically.
If you need to run some Makefile inside a venv, you will have to source the activate
script first, and from the thus modified shell then start make
; not the other way around.
```
…```
syntax, showing the actual line break(s).make env
as an alias forsource venv/bin/activate
in your interactive shell? Or do you want to modify the state of yourmake
program, so you can use commands from the Python virtual environment in yourMakefile
?