-
Notifications
You must be signed in to change notification settings - Fork 18.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Makefile improvements: rule consolidation, dependency generation #1472
Conversation
b5b9869
to
bf166b6
Compare
@@ -472,15 +464,19 @@ $(STATIC_NAME): $(OBJS) | $(LIB_BUILD_DIR) | |||
ar rcs $@ $(OBJS) | |||
@ echo | |||
|
|||
$(TEST_BUILD_DIR)/%.o: src/$(PROJECT)/test/%.cpp $(HXX_SRCS) $(TEST_HXX_SRCS) \ | |||
| $(TEST_BUILD_DIR) | |||
$(BUILD_DIR)/%.o: %.cpp | $(ALL_BUILD_DIRS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does make
know the object files also depend on whichever automatically generated *.hpp
header dependencies gcc says are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make merges multiple rules into one with a union over prerequisites, see https://www.gnu.org/software/make/manual/html_node/Multiple-Rules.html. The additional rules are provided in the .d
files included in the last line of the Makefile
. (Note that on first build, the .d
files don't exist, but this doesn't matter, because everything has to be built anyway.)
Cool, LGTM! Thanks for setting up the automatic dependency generation, that should speed up builds quite a bit. |
Nice job On Wednesday, November 26, 2014, Jeff Donahue notifications@github.com
Sergio |
Nice! Sorry if I'm blind, but is the nvcc |
bf166b6
to
c9bf734
Compare
@shelhamer, that's weird, where did that go? I'm glad somebody is paying attention (and |
c9bf734
to
7cbe8cd
Compare
Two bugs have been fixed.
|
This will allow nvcc's -M dependency generation option to work harmoniously, since it assumes that output will have a .o extension.
7cbe8cd
to
d3524b2
Compare
d3524b2
to
fba2471
Compare
Two more bugs have been fixed.
I know of no other issues that have come up in my use of this branch, so (with @jeffdonahue's approval a few bugs ago) I think I'll merge this now (and #1561). Note that building may still be slow sometimes, because of the monolithic header files and test binary. I'll make an issue about that shortly. |
Makefile improvements: rule consolidation, dependency generation
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
Automatic header file dependency was introduced in BVLC#1472, but not correctly applied to matcaffe. Fix it by moving ./caffe_.d to build/matlab/+caffe/private/caffe_.d and add it to DEPS
This PR addresses #599 using the
-MMD
option of gcc/clang (and the-M
option of nvcc) to automatically generate header file dependencies, finally making the build truly incremental.In addition, some consolidation of build rules is included (more might be possible), and the explicit enumeration of build directories is made a bit more automatic (further improvements in this direction are also possible).
This is pretty fresh so you might want to let it age a couple days in case I messed something up; I'll be working off this branch.