Your Makefile has two errors:
It relies on bash
(or on a shell with the same array syntax) without setting the make
variable SHELL
to /bin/bash
(or whatever the path is to the shell executable file).
It relies on each action being run in the same shell instance. Usually, each action line is invoked by a separate $SHELL
(/bin/sh
by default), which means that you can't set a shell variable on one line and then use it on another, or cd
into one directory and then assume that you're still in the same directory on the next line of the Makefile.
I would probably rewrite the setup
target as something like
setup:
mkdir -p proj/lib proj/bin
find /usr/lib/man-db -type f -name '*.so' -exec cp {} proj/lib \;
This additionally does not rely on the bash
shell being the shell used by make
, and it also corrects the ordering of the arguments to cp
(you have yours back to front).