I have the following structure in my project.
- /
- src/
- bin/
- Makefile
In src directory there will be multiple src files (each has a main function). I need to write makefile such that when I run
make program1
It should search for program1.c in src folder and compile the executable as program1* in bin folder.
I have came across this question How can Makefile use separate directories for source code and binaries? But, it seems that I need to manually enter all program names into PROG variable. I just need to supply binary name with make and it should do the compilation for that respective src file?