Skip to content

Commit

Permalink
Merge pull request #7 from jeffdonahue/headers
Browse files Browse the repository at this point in the history
modify makefile to recompile on changes to header files
  • Loading branch information
Yangqing committed Nov 28, 2013
2 parents c0ba41c + ae9ed2a commit eb38091
Showing 1 changed file with 7 additions and 3 deletions.
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

0 comments on commit eb38091

Please sign in to comment.