Skip to content
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

modify makefile to recompile on changes to header files #7

Merged
merged 1 commit into from
Nov 28, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ STATIC_NAME := lib$(PROJECT).a
##############################
# CXX_SRCS are the source files excluding the test ones.
CXX_SRCS := $(shell find src/caffe ! -name "test_*.cpp" -name "*.cpp")
# HXX_SRCS are the header files
HXX_SRCS := $(shell find include/caffe ! -name "*.hpp")
# CU_SRCS are the cuda source files
CU_SRCS := $(shell find src/caffe -name "*.cu")
# TEST_SRCS are the test source files
TEST_SRCS := $(shell find src/caffe -name "test_*.cpp")
GTEST_SRC := src/gtest/gtest-all.cpp
# EXSAMPLE_SRCS are the source files for the example binaries
# TEST_HDRS are the test header files
TEST_HDRS := $(shell find src/caffe -name "test_*.hpp")
# EXAMPLE_SRCS are the source files for the example binaries
EXAMPLE_SRCS := $(shell find examples -name "*.cpp")
# PROTO_SRCS are the protocol buffer definitions
PROTO_SRCS := $(wildcard src/caffe/proto/*.proto)
Expand Down Expand Up @@ -112,13 +116,13 @@ $(STATIC_NAME): $(PROTO_OBJS) $(OBJS)
runtest: test
for testbin in $(TEST_BINS); do $$testbin $(TEST_GPUID); done

$(TEST_BINS): %.testbin : %.o $(GTEST_OBJ) $(STATIC_NAME)
$(TEST_BINS): %.testbin : %.o $(GTEST_OBJ) $(STATIC_NAME) $(TEST_HDRS)
$(CXX) $< $(GTEST_OBJ) $(STATIC_NAME) -o $@ $(LDFLAGS) $(WARNINGS)

$(EXAMPLE_BINS): %.bin : %.o $(STATIC_NAME)
$(CXX) $< $(STATIC_NAME) -o $@ $(LDFLAGS) $(WARNINGS)

$(OBJS): $(PROTO_GEN_CC)
$(OBJS): $(PROTO_GEN_CC) $(HXX_SRCS)

$(EXAMPLE_OBJS): $(PROTO_GEN_CC)

Expand Down