%% "DeMarco, Paul" <[EMAIL PROTECTED]> writes:
dp> I absolutly could not get separate directory compilation working:
dp> be in the object dir with source in another dir
You cannot have sources and objects in separate directories with suffix
rules.
If you want to do this you need to use pattern rules.
%.o: $(SRC)/%.cpp $(INCL)/%.h
...
dp> So I fell back to old faithful:
dp> node.o: $(SRC)/node.cpp $(INCL)/node.h
dp> $(CC) $(CPPFLAGS) $(SRC)/node.cpp
You should not use a C compiler to build C++ files.
Use $(CXX) and $(CXXFLAGS). $(CC) is a C compiler, and $(CPPFLAGS) are
flags to the C preprocessor (-I, -D, etc.)
dp> node.o: $(SRC)/$(@:.o=.cpp) $(INCL)/$(@:.cpp=.h)
dp> $(CC) $(CPPFLAGS) $(SRC)/$(@:.o=.cpp)
This is not correct. Automatic variables like $@, etc. are defined only
within the context of the command script; they have no value in the
prerequisite list.
Since $@ has no value, your rule above is equivalent to:
node.o: $(SRC)/ $(INCL)/
...
which makes your .o depend on the directories--and explains the strange
rebuild behavior you're seeing.
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make