I am trying to write a makefile which should pick the sources from src/ and headers from inc/
~/Linuz/src: 1.c, 2.c, 3.c ...
~/Linuz/inc: abc.h, dyz.h
Please help me to create a makefile which should be available at
~/Linuz/some_other_dir/Makefile
PS: Trying to compile it for my linux machine.
Thank you for your suggestions.
If you put your Makefile in the ~/Linuz/some_other_dir/, the following rule
will get the c files from the
../src/
folder (~/Linuz/src/) and create the object (*.o) files in the same folder of the Makefile.The
-I../inc/
option means that the makefile canl get a header files from the../inc/
folder (~/Linuz/inc/).The
my_program: 1.o 2.o 3.o
rule means that the makefile will create the binary in the same directory of Makefile from the object files1.o
and2.o
and3.o
From the make manual: