I have several files to include from a subfolder and I just can't get this to work. I'm propably missing something here...
The Makefile and .cpp with main function are located at /path/to/ and files to be included are at /path/to/src/buffer and /path/to/src/hash. Both of these folders have .cpp and .h for respective class. I've had no problems compiling until I put this whole project together and made a single Makefile for them.
Here's my try on the Makefile:
objects = delta.o hash.o buffer.o
buffer_dir = path/to/src/buffer
hash_dir = path/to/src/hash
delta: $(objects)
g++ -g -o $(objects)
delta.o: delta.cpp buffer.o hash.o
g++ -g -c delta.cpp buffer.o hash.o
buffer.o: buffer.cpp buffer.h
g++ -g -c -I$(buffer_dir) buffer.cpp
hash.o: hash.cpp hash.h sha2.o sha4.o buffer.o
g++ -g -c -I$(hash_dir) -I$(buffer_dir) hash.cpp
sha2.o: sha2.c sha2.h config.h
g++ -g -c -I$(hash_dir) sha2.c
sha4.o: sha4.c sha4.h config.h
g++ -g -c -I$(hash_dir) sha4.c
I have obviously missunderstood how to use the -I(capital i) flag. The compiler (g++) gives me this short answer:
make: *** No rule to make target `buffer.cpp', needed by `buffer.o'. Stop.
I would appreciate a little help with this. I've gone through a bunch of googles for "Makefile examples", but still can't figure out what's the problem.
I'm on Linux by the way...