92 lines
3.3 KiB
Makefile
92 lines
3.3 KiB
Makefile
HERE:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
ROOT:=$(HERE)/../..
|
|
VTABLE:=$(ROOT)/parquet
|
|
SQLITE:=$(ROOT)/sqlite
|
|
|
|
# Directories
|
|
ARROW=$(HERE)/arrow
|
|
ARROW_RELEASE=$(ARROW)/cpp/release
|
|
BROTLI=$(ARROW_RELEASE)/brotli_ep/src/brotli_ep-install/lib/x86_64-linux-gnu
|
|
LZ4=$(ARROW_RELEASE)/lz4_ep-prefix/src/lz4_ep/lib
|
|
PARQUET_CPP=$(HERE)/parquet-cpp
|
|
SNAPPY=$(ARROW_RELEASE)/snappy_ep/src/snappy_ep-install/lib
|
|
ZLIB=$(ARROW_RELEASE)/zlib_ep/src/zlib_ep-install/lib
|
|
ZSTD=$(ARROW_RELEASE)/zstd_ep-prefix/src/zstd_ep/lib
|
|
|
|
# Libraries
|
|
ARROW_LIB = $(ARROW_RELEASE)/release/libarrow.a
|
|
BOOST_FILESYSTEM_LIB = /usr/lib/x86_64-linux-gnu/libboost_filesystem.so
|
|
BOOST_LIB = /usr/lib/x86_64-linux-gnu/libboost_regex.so
|
|
BOOST_SYSTEM_LIB = /usr/lib/x86_64-linux-gnu/libboost_system.so
|
|
BROTLI_COMMON_LIB = $(BROTLI)/libbrotlicommon.a
|
|
BROTLI_DEC_LIB = $(BROTLI)/libbrotlidec.a
|
|
BROTLI_ENC_LIB = $(BROTLI)/libbrotlienc.a
|
|
LZ4_LIB = $(LZ4)/liblz4.a
|
|
PARQUET_CPP_LIB = $(PARQUET_CPP)/build/release/libparquet.a
|
|
SNAPPY_LIB = $(SNAPPY)/libsnappy.a
|
|
SQLITE3_LIB = $(SQLITE)/libsqlite3.a
|
|
THRIFT_LIB = $(PARQUET_CPP)/thrift_ep/src/thrift_ep-install/lib/libthrift.a
|
|
ZLIB_LIB = $(ZLIB)/libz.a
|
|
ZSTD_LIB = $(ZSTD)/libzstd.a
|
|
|
|
# Flags
|
|
CC = g++
|
|
CPUS:=$(shell nproc)
|
|
CFLAGS = -I $(SQLITE) -I $(PARQUET_CPP)/src -I $(ARROW)/cpp/src -O3 -std=c++11 -Wall -fPIC -g
|
|
|
|
LDFLAGS = -O3 \
|
|
-Wl,--whole-archive $(PARQUET_CPP_LIB) $(LZ4_LIB) $(ZSTD_LIB) $(THRIFT_LIB) $(SNAPPY_LIB) $(ARROW_LIB) \
|
|
$(BROTLI_ENC_LIB) $(BROTLI_COMMON_LIB) $(BROTLI_DEC_LIB) \
|
|
-Wl,--no-whole-archive -lz -lcrypto -lssl $(BOOST_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_FILESYSTEM_LIB)
|
|
OBJ = parquet.o parquet_filter.o parquet_table.o parquet_cursor.o
|
|
LIBS = $(ARROW_LIB) \
|
|
$(PARQUET_CPP_LIB)
|
|
|
|
libparquet.so: $(LIBS) $(OBJ)
|
|
$(CC) -shared -o $@ $(OBJ) $(LDFLAGS)
|
|
|
|
parquet_filter.o: $(VTABLE)/parquet_filter.cc $(VTABLE)/parquet_filter.h
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
parquet_cursor.o: $(VTABLE)/parquet_cursor.cc $(VTABLE)/parquet_cursor.h $(VTABLE)/parquet_table.h $(VTABLE)/parquet_filter.h
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
parquet_table.o: $(VTABLE)/parquet_table.cc $(VTABLE)/parquet_table.h
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
parquet.o: $(VTABLE)/parquet.cc $(VTABLE)/parquet_cursor.h $(VTABLE)/parquet_table.h $(VTABLE)/parquet_filter.h
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
|
|
|
$(ARROW_LIB):
|
|
rm -rf $(ARROW)
|
|
git clone https://github.com/apache/arrow.git $(ARROW)
|
|
cd $(ARROW) && git checkout apache-arrow-0.9.0
|
|
mkdir $(ARROW)/cpp/release
|
|
cd $(ARROW)/cpp/release && cmake .. -DCMAKE_BUILD_TYPE=Release
|
|
cd $(ARROW)/cpp/release && make -j$(CPUS) unittest
|
|
|
|
$(PARQUET_CPP_LIB): $(ARROW_LIB)
|
|
rm -rf $(PARQUET_CPP)
|
|
git clone https://github.com/apache/parquet-cpp.git $(PARQUET_CPP)
|
|
cd $(PARQUET_CPP) && git checkout apache-parquet-cpp-1.4.0
|
|
cd $(PARQUET_CPP) && SNAPPY_STATIC_LIB=$(SNAPPY_LIB) BROTLI_STATIC_LIB_ENC=$(BROTLI_ENC_LIB) BROTLI_STATIC_LIB_DEC=$(BROTLI_DEC_LIB) BROTLI_STATIC_LIB_COMMON=$(BROTLI_COMMON_LIB) ZLIB_STATIC_LIB=$(ZLIB_LIB) LZ4_STATIC_LIB=$(LZ4_LIB) ZSTD_STATIC_LIB=$(ZSTD_LIB) cmake -DCMAKE_BUILD_TYPE=Release -DPARQUET_MINIMAL_DEPENDENCY=ON -DPARQUET_ARROW_LINKAGE=static .
|
|
cd $(PARQUET_CPP) && make -j$(CPUS)
|
|
|
|
$(SQLITE3_LIB):
|
|
cd $(ROOT) && ./build-sqlite
|
|
|
|
.PHONY: clean arrow parquet sqlite
|
|
|
|
clean:
|
|
rm -f *.o *.so
|
|
|
|
distclean:
|
|
rm -rf $(SQLITE) $(HERE)
|
|
|
|
|
|
arrow: $(ARROW_LIB)
|
|
|
|
parquet: $(PARQUET_CPP_LIB)
|
|
|
|
sqlite: $(SQLITE3_LIB)
|