Hello,
I'm using this makefile to compile a C++ project (using g++):

CC = g++
CFLAGS = -Wall
OBJ = somefile.o somefile.o... somefile_in_another_dir.o...
somefile_in_another_dir.o...

all: test

.cpp.o:
        $(CC) $(CFLAGS) -c $<

test: $(OBJ)
        $(CC) $(CFLAGS) $^ -o $@

clean:
        rm -f *.o *~ test

depend:
        echo -e '\n' >> Makefile
        $(CC) -MM *.cpp >> Makefile

.PHONY: all clean

By now, all of my files were in the same directory, but since my
project grew larger I've add some sub-directories.
My questions are:
1. How do I config the depend to include dependencies from other
directories.

2. I'll be happy if anyone could remind me the g++ flags for compiling
when #include from other directories, and linking when involved .o
files from multiple directories.

Thanks,
Yos P.

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to