How do compile 2 .cpp files and 1 .h file in a makefile? I am noob with makefile but I don't want to do it in the command line all the time (Because I need to add libraries and linker options etc. but I know how to do that).
I've done a ton of research, including the manual, but I still don't get it.
Here's the makefile I wrote:
HEADERS = program.h headers.h
default: program
program.o: program.cpp $(HEADERS)
g++ -c program.cpp -o program.o
program: program.o
g++ program.o -o program
clean:
-rm -f program.o
-rm -f program
The makefile I have is for 1 file. How do I do it for 3 files (2 .cpp, 1 .h)?
ANY help is much appreciated.