From 1193b25c1795da321cdc2de3a9131557a4c8daca Mon Sep 17 00:00:00 2001 From: Evan Shelhamer Date: Sat, 30 Aug 2014 16:41:01 -0700 Subject: [PATCH] Makefile: fix boost::thread linking, drop pthread, sort --- Makefile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 9c420249..731e6fd1 100644 --- a/Makefile +++ b/Makefile @@ -159,9 +159,9 @@ ifneq ($(CPU_ONLY), 1) LIBRARIES := cudart cublas curand endif LIBRARIES += \ - glog gflags pthread protobuf leveldb snappy \ + glog gflags protobuf leveldb snappy \ lmdb \ - boost_system boost_thread \ + boost_system \ hdf5_hl hdf5 \ opencv_core opencv_highgui opencv_imgproc PYTHON_LIBRARIES := boost_python python2.7 @@ -205,16 +205,8 @@ ifeq ($(LINUX), 1) ifeq ($(shell echo $(GCCVERSION) \< 4.6 | bc), 1) WARNINGS += -Wno-uninitialized endif -endif - -# CPU-only configuration -ifeq ($(CPU_ONLY), 1) - OBJS := $(PROTO_OBJS) $(CXX_OBJS) - TEST_OBJS := $(TEST_CXX_OBJS) - TEST_BINS := $(TEST_CXX_BINS) - ALL_WARNS := $(ALL_CXX_WARNS) - TEST_FILTER := --gtest_filter="-*GPU*" - COMMON_FLAGS += -DCPU_ONLY + # boost::thread is reasonably called boost_thread (compare OS X) + LIBRARIES += boost_thread endif # OS X: @@ -228,6 +220,8 @@ ifeq ($(OSX), 1) CXXFLAGS += -stdlib=libstdc++ LINKFLAGS += -stdlib=libstdc++ endif + # boost::thread is called boost_thread-mt to mark multithreading on OS X + LIBRARIES += boost_thread-mt endif # Custom compiler @@ -242,6 +236,16 @@ else COMMON_FLAGS += -DNDEBUG -O2 endif +# CPU-only configuration +ifeq ($(CPU_ONLY), 1) + OBJS := $(PROTO_OBJS) $(CXX_OBJS) + TEST_OBJS := $(TEST_CXX_OBJS) + TEST_BINS := $(TEST_CXX_BINS) + ALL_WARNS := $(ALL_CXX_WARNS) + TEST_FILTER := --gtest_filter="-*GPU*" + COMMON_FLAGS += -DCPU_ONLY +endif + # BLAS configuration (default = ATLAS) BLAS ?= atlas ifeq ($(BLAS), mkl) @@ -273,7 +277,7 @@ LIBRARY_DIRS += $(BLAS_LIB) # Complete build flags. COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) -CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) +CXXFLAGS += -fPIC $(COMMON_FLAGS) $(WARNINGS) NVCCFLAGS := -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) # mex may invoke an older gcc that is too liberal with -Wuninitalized MATLAB_CXXFLAGS := $(CXXFLAGS) -Wno-uninitialized