Frank Sorenson wrote: > How about: > > $(OBJECT_PATH)/%.o : $(SOURCE_PATH)/%.cpp > $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< > $(OBJECT_PATH)/%.o: $(SOURCE_PATH)/%.cpp $(SOURCE_PATH)/%.h > $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< > > If a .h file exists, the second rule will apply, otherwise, the > original rule will build the object. That will only create a dependency between a .cpp file and the correspondingly named .h file. If other header files are included, they won't be marked as dependent. You either need to make all .cpp files dependent on all .h files (in which case you might as well be using a shell script) or you need a dependency tool to detect the dependencies, which fortunately gcc can do.
-------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
