'`source` command works in one Makefile/make target but not another in same script

The following entry in my Makefile works fine:

# in Makefile
format:
    source .venv/bin/activate && isort src/hercl/
    source .venv/bin/activate && black src/hercl/ -l 120
    source .venv/bin/activate && flake8 src/hercl/ --max-line-length 120 --ignore=W605
$ make format
..
All done! ✨ 🍰 ✨
4 files reformatted, 20 files left unchanged.

But this one does not :

# in Makefile
activate_venv:
    source .venv/bin/activate
$make activate_venv
source .venv/bin/activate
make: source: No such file or directory
make: *** [activate_venv] Error 1

Why will the same command source <something> work in one target and not the other?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source