1ifndef config 2 ifneq ("$(wildcard ./config.mk)","") 3 config = config.mk 4 else 5 config = make/config.mk 6 endif 7endif 8# use customized config file 9include $(config) 10include make/dmlc.mk 11 12NOLINT_FILES = --exclude_path include/dmlc/concurrentqueue.h include/dmlc/blockingconcurrentqueue.h 13 14# this is the common build script for dmlc lib 15export LDFLAGS= -pthread -lm 16export CFLAGS = -O3 -Wall -Wno-unknown-pragmas -Iinclude 17ifeq ($(USE_GNU11), 1) 18 CFLAGS += -std=gnu++11 19else 20 CFLAGS += -std=c++0x 21endif 22LDFLAGS+= $(DMLC_LDFLAGS) $(ADD_LDFLAGS) 23CFLAGS+= $(DMLC_CFLAGS) $(ADD_CFLAGS) 24 25ifndef USE_SSE 26 USE_SSE = 1 27endif 28 29ifeq ($(USE_SSE), 1) 30 CFLAGS += -msse2 31endif 32 33ifdef DEPS_PATH 34CFLAGS+= -I$(DEPS_PATH)/include 35LDFLAGS+= -L$(DEPS_PATH)/lib 36endif 37 38.PHONY: clean all test lint doc example pylint 39 40OBJ=line_split.o indexed_recordio_split.o recordio_split.o input_split_base.o io.o filesys.o local_filesys.o data.o recordio.o config.o 41 42ifeq ($(USE_HDFS), 1) 43 OBJ += hdfs_filesys.o 44endif 45 46ifeq ($(USE_S3), 1) 47 OBJ += s3_filesys.o 48endif 49 50ifeq ($(USE_AZURE), 1) 51 OBJ += azure_filesys.o 52endif 53 54ifndef LINT_LANG 55 LINT_LANG="all" 56endif 57 58 59ALIB=libdmlc.a 60all: $(ALIB) test 61 62include test/dmlc_test.mk 63include example/dmlc_example.mk 64 65ifeq ($(BUILD_TEST), 1) 66test: $(ALL_TEST) 67endif 68 69example: $(ALL_EXAMPLE) 70 71line_split.o: src/io/line_split.cc 72recordio_split.o: src/io/recordio_split.cc 73indexed_recordio_split.o: src/io/indexed_recordio_split.cc 74input_split_base.o: src/io/input_split_base.cc 75filesys.o: src/io/filesys.cc 76hdfs_filesys.o: src/io/hdfs_filesys.cc 77s3_filesys.o: src/io/s3_filesys.cc 78azure_filesys.o: src/io/azure_filesys.cc 79local_filesys.o: src/io/local_filesys.cc 80io.o: src/io.cc 81data.o: src/data.cc 82recordio.o: src/recordio.cc 83config.o: src/config.cc 84 85libdmlc.a: $(OBJ) 86 87 88$(BIN) : 89 $(CXX) $(CFLAGS) -o $@ $(filter %.cpp %.o %.c %.cc %.a, $^) $(LDFLAGS) 90 91$(OBJ) : 92 $(CXX) -c $(CFLAGS) -o $@ $(firstword $(filter %.cpp %.c %.cc, $^) ) 93 94$(ALIB): 95 $(AR) cr $@ $+ 96 97lint: 98 scripts/lint.py dmlc ${LINT_LANG} include src scripts $(NOLINT_FILES) 99 100pylint: 101 scripts/lint.py dmlc ${LINT_LANG} tracker/dmlc_tracker 102 103doxygen: 104 doxygen doc/Doxyfile 105 106clean: 107 $(RM) $(OBJ) $(BIN) $(ALIB) $(ALL_TEST) $(ALL_TEST_OBJ) *~ src/*~ src/*/*~ include/dmlc/*~ test/*~ 108