[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Makefile dependencies for multiple directories project using g++
From: |
Yos P. |
Subject: |
Makefile dependencies for multiple directories project using g++ |
Date: |
8 Jan 2007 03:56:55 -0800 |
User-agent: |
G2/1.0 |
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.
- Makefile dependencies for multiple directories project using g++,
Yos P. <=