This will do it:
bin/myBinaryName: file1.c file2.c file3.c
gcc $^ -Iheader -lncurses -o $@
vpath %.c src
There are more sophisticated approaches than this, but I suspect that you are taking the same course as the other newcomers who have asked very similar questions over the past couple of weeks.
If you want a more basic introduction, or a more sophisticated makefile, you can try a different question.
EDIT:
Let's try something simpler. Write this makefile (and name it makefile
):
all:
echo hello world
Note that the whitespace before "echo" is a TAB. Now try make
on the command line. What happens?