title: makefile cd into dir and execute command
body: <p>I have several AWS lambda functions which i want to build and deploy and have the following <code>Makefile</code></p>
  
  <pre><code>#!/bin/bash
  #SHELL:=/bin/bash --login
  functions = $(sort $(dir $(wildcard */)))
  
  define deploy
    cd $1 &amp;&amp; npm deploy-dev
  endef
  
  deploy:
      $(foreach fn,$(functions),$(eval $(call deploy,$(fn))))
  </code></pre>
  
  <p>Basically each function is a node.js project that has the following entry in the package.json</p>
  
  <pre><code>  "scripts": {
      "deploy-dev": "npm build &amp;&amp; rm -rf node_modules &amp;&amp; npm i --production  --legacy-bundling &amp;&amp; AWS_PROFILE=dev SLS_DEBUG=* sls deploy --stage dev --region us-east-1"
  </code></pre>
  
  <p>cd into <code>dir</code> and running <code>npm deploy-dev</code> works as expected, but how to automate this?</p>
  
  <p>i get an error:</p>
  
  <pre><code>➜  new_ingest git:(feature/organise) ✗ make deploy                                                                                                    (git)-[feature/organise] 
  Makefile:11: *** missing separator. Stop.
  </code></pre>