How to source a script in a Makefile?

Makefile default shell is /bin/sh which does not implement source.

Changing shell to /bin/bash makes it possible:

# Makefile

SHELL := /bin/bash

rule:
    source env.sh && YourCommand

Leave a Comment