diff --git a/Makefile b/Makefile deleted file mode 100644 index d29c933d23..0000000000 --- a/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -###################User Config Varaibles ############################# -HOME_DIR := /usr/ -# Lib folder for system and external libs. You may need to change it. -LIBRARY_DIRS := $(HOME_DIR)/lib64 $(HOME_DIR)/lib $(HOME_DIR)/local/lib -# Header folder for system and external libs. You may need to change it. -INCLUDE_DIRS := $(HOME_DIR)/include ./include -# g++ location, should support c++11, tested with 4.8.1 -CXX := g++ - -######################Setting Varialbes####################################### -LIBRARIES := glog gflags protobuf rt opencv_highgui opencv_imgproc opencv_core\ - lmdb openblas zmq czmq - -LDFLAGS := $(foreach librarydir, $(LIBRARY_DIRS), -L$(librarydir))\ - $(foreach library, $(LIBRARIES), -l$(library)) -# Folder to store compiled files -BUILD_DIR := build -MSHADOW_FLAGS :=-DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 -CXXFLAGS := -O2 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ - $(MSHADOW_FLAGS) -DCPU_ONLY=1 \ - -funroll-loops $(foreach includedir, $(INCLUDE_DIRS), -I$(includedir)) - -# find user defined .proto file, and then compute the corresponding .h, .cc -# files, which cannot be found by shell find, because they haven't been -# generated currently -PROTOS := $(shell find src/proto/ -name "*.proto") -PROTO_SRCS :=$(PROTOS:.proto=.pb.cc) -PROTO_HDRS :=$(patsubst src%, include%, $(PROTOS:.proto=.pb.h)) -PROTO_OBJS :=$(addprefix $(BUILD_DIR)/, $(PROTO_SRCS:.cc=.o)) - -# each singa src file will generate a .o file -SINGA_SRCS := $(shell find src/ \( -path "src/test" -o -path "src/main.cc" \) \ - -prune -o \( -name "*.cc" -type f \) -print ) -SINGA_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(SINGA_SRCS:.cc=.o)) \ - $(PROTO_OBJS) ) --include $(SINGA_OBJS:%.o=%.P) - -TEST_SRCS :=$(shell find src/test/ -maxdepth 1 -name "*.cc") -TEST_OBJS := $(sort $(addprefix $(BUILD_DIR)/, $(TEST_SRCS:.cc=.o))) --include $(TEST_OBJS:%.o=%.P) - -GTEST_SRC := include/gtest/gtest-all.cc -GTEST_HDR := include/gtest/gtest.h -GTEST_LIB := $(BUILD_DIR)/libgtest.a - -OBJS := $(sort $(SINGA_OBJS) $(TEST_OBJS) ) - -########################Compilation Section################################### -.PHONY: singa test - -singa: $(PROTO_OBJS) $(SINGA_OBJS) - $(CXX) $(SINGA_OBJS) src/main.cc -o $(BUILD_DIR)/singa $(CXXFLAGS) $(LDFLAGS) - @echo - -loader: proto $(LOADER_OBJS) - $(CXX) $(LOADER_OBJS) -o $(BUILD_DIR)/loader $(CXXFLAGS) $(LDFLAGS) - @echo - -test: proto $(GTEST_LIB) $(TEST_OBJS) $(SINGA_OBJS) - $(CXX) $(TEST_OBJS) include/gtest/gtest_main.cc $(GTEST_LIB) \ - $(SINGA_OBJS) -o $(BUILD_DIR)/test $(CXXFLAGS) $(LDFLAGS) - @echo - -$(GTEST_LIB): $(GTEST_HDR) $(GTEST_SRC) - $(CXX) $(GTEST_SRC) -c -o $(BUILD_DIR)/gtest-all.o $(CXXFLAGS) - ar -rv $(GTEST_LIB) $(BUILD_DIR)/gtest-all.o - -# compile all files -$(OBJS):$(BUILD_DIR)/%.o : %.cc - @mkdir -p $(dir $@) - $(CXX) $< $(CXXFLAGS) -MMD -c -o $@ - cp $(BUILD_DIR)/$*.d $(BUILD_DIR)/$*.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(BUILD_DIR)/$*.d >> $(BUILD_DIR)/$*.P; \ - rm -f $*.d - -proto: $(PROTO_OBJS) - -$(PROTO_SRCS): $(PROTOS) - protoc --proto_path=src/proto --cpp_out=src/proto $(PROTOS) - mkdir -p include/proto/ - cp src/proto/*.pb.h include/proto/ - @echo - -clean: - rm -rf *.a *.so - rm -rf include/proto/* - rm -rf src/proto/*.pb.h src/proto/*.pb.cc - rm -rf $(BUILD_DIR) - @echo diff --git a/Makefile.am b/Makefile.am index defd5f1b3f..d5335f7380 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,10 +6,13 @@ MSHADOW_FLAGS = -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 AC_CXXFLAGS = -O3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ $(MSHADOW_FLAGS) -DCPU_ONLY=1 -funroll-loops +INCLUDES=-I$(top_srcdir)/include + PROTOS := src/proto/cluster.proto src/proto/model.proto PROTO_SRCS := src/proto/cluster.pb.cc src/proto/model.pb.cc PROTO_HDRS := src/proto/cluster.pb.h src/proto/model.pb.h PROTO_OBJS := src/proto/cluster.pb.o src/proto/model.pb.o + SINGA_SRCS := src/utils/cluster.cc \ src/utils/graph.cc \ src/utils/common.cc \ @@ -79,7 +82,6 @@ lib_LTLIBRARIES = libsinga.la libsinga_la_SOURCES = $(PROTO_HDRS) $(PROTO_SRCS) $(SINGA_SRCS) $(SINGA_HDRS) libsinga_la_CXXFLAGS = -O3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ $(MSHADOW_FLAGS) -DCPU_ONLY=1 -funroll-loops -gdwarf-2 -gstrict-dwarf -Woverloaded-virtual -INCLUDES=-I$(top_srcdir)/include libsinga_la_LDFLAGS = -I./include bin_PROGRAMS=singa @@ -96,11 +98,13 @@ singa_LDFLAGS = -I./include \ -lopencv_imgproc \ -lopencv_core \ -lopenblas \ - -lgtest \ -lzmq \ -lczmq \ -llmdb +clean-local: + rm -rf $(PROTO_SRCS) $(PROTO_HDRS) + $(PROTO_HDRS) $(PROTO_SRCS): $(PROTOS) protoc --proto_path=src/proto --cpp_out=src/proto $(PROTOS) diff --git a/Makefile.in b/Makefile.in index 57c3abf9aa..d3f322bc5d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -228,6 +228,7 @@ MSHADOW_FLAGS = -DMSHADOW_USE_CUDA=0 -DMSHADOW_USE_CBLAS=1 -DMSHADOW_USE_MKL=0 AC_CXXFLAGS = -O3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ $(MSHADOW_FLAGS) -DCPU_ONLY=1 -funroll-loops +INCLUDES = -I$(top_srcdir)/include PROTOS := src/proto/cluster.proto src/proto/model.proto PROTO_SRCS := src/proto/cluster.pb.cc src/proto/model.pb.cc PROTO_HDRS := src/proto/cluster.pb.h src/proto/model.pb.h @@ -303,7 +304,6 @@ libsinga_la_SOURCES = $(PROTO_HDRS) $(PROTO_SRCS) $(SINGA_SRCS) $(SINGA_HDRS) libsinga_la_CXXFLAGS = -O3 -Wall -pthread -fPIC -std=c++11 -Wno-unknown-pragmas \ $(MSHADOW_FLAGS) -DCPU_ONLY=1 -funroll-loops -gdwarf-2 -gstrict-dwarf -Woverloaded-virtual -INCLUDES = -I$(top_srcdir)/include libsinga_la_LDFLAGS = -I./include singa_SOURCES = src/main.cc singa_CXXFLAGS = -O3 -Wall -pthread -fPIC -std=c++11 -MMD -Wno-unknown-pragmas \ @@ -319,7 +319,6 @@ singa_LDFLAGS = -I./include \ -lopencv_imgproc \ -lopencv_core \ -lopenblas \ - -lgtest \ -lzmq \ -lczmq \ -llmdb @@ -994,7 +993,7 @@ maintainer-clean-generic: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool mostlyclean-am + clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) @@ -1048,8 +1047,8 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \ - dist-shar dist-tarZ dist-zip distcheck distclean \ + clean-libtool clean-local ctags dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ @@ -1064,6 +1063,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ uninstall-libLTLIBRARIES +clean-local: + rm -rf $(PROTO_SRCS) $(PROTO_HDRS) + $(PROTO_HDRS) $(PROTO_SRCS): $(PROTOS) protoc --proto_path=src/proto --cpp_out=src/proto $(PROTOS) mkdir -p include/proto/