Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 1 | COLLOCATDB_MAJOR=1 |
| 2 | COLLOCATDB_MINOR=2 |
| 3 | COLLOCATDB_PATCH=0 |
| 4 | |
| 5 | INSTALL_PATH ?= /usr/local |
| 6 | |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 7 | PLATFORM_CCFLAGS= -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=1 -DZLIB -DBZIP2 -DLZ4 -DZSTD -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -march=native -DROCKSDB_SUPPORT_THREAD_LOCAL |
| 8 | PLATFORM_CXXFLAGS=-std=c++11 -DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX -fno-builtin-memcmp -DROCKSDB_FALLOCATE_PRESENT -DSNAPPY -DGFLAGS=1 -DZLIB -DBZIP2 -DLZ4 -DZSTD -DROCKSDB_MALLOC_USABLE_SIZE -DROCKSDB_PTHREAD_ADAPTIVE_MUTEX -DROCKSDB_BACKTRACE -DROCKSDB_RANGESYNC_PRESENT -DROCKSDB_SCHED_GETCPU_PRESENT -march=native -DROCKSDB_SUPPORT_THREAD_LOCAL |
| 9 | PLATFORM=OS_LINUX |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 10 | PLATFORM_LDFLAGS= -L$(INSTALL_PATH)/lib -Wl,-rpath=$(INSTALL_PATH)/lib -lpthread -lrt -lsnappy -lz -lbz2 -llz4 -lzstd |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 11 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 12 | CXXFLAGS = -Wall -Wno-reorder -I/usr/local/include -g -std=c++11 |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 13 | CFLAGS = -Wall -I/usr/local/rocksdb -I$(INSTALL_PATH)/include -g -std=gnu99 -O2 |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 14 | |
| 15 | ARFLAGS = ${EXTRA_ARFLAGS} rs |
Marc Kupietz | 18375e1 | 2017-12-24 10:11:18 +0100 | [diff] [blame] | 16 | |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 17 | ifneq ($(USE_RTTI), 1) |
| 18 | CXXFLAGS += -fno-rtti |
| 19 | endif |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 20 | SOURCE_DIR := src |
| 21 | BUILD_DIR := build |
| 22 | BIN_DIR := bin |
| 23 | LIB_DIR := lib |
| 24 | LIB_SOURCES = src/collocatordb.cc |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 25 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 26 | LIB_OBJECTS := $(subst $(SOURCE_DIR),$(BUILD_DIR),$(LIB_SOURCES:.cc=.o)) |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 27 | |
| 28 | .PHONY: static_lib shared_lib install-static install-shared |
| 29 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 30 | all: static_lib shared_lib |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 31 | |
| 32 | install: install-static install-shared |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 33 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 34 | bin/hello_world: examples/hello_world.c src/collocatordb.h build/collocatordb.o Makefile |
| 35 | mkdir -p bin |
| 36 | $(CC) $(CFLAGS) -L. -L$(INSTALL_PATH)/lib examples/hello_world.c -o$@ build/collocatordb.o --std=gnu99 -lstdc++ -lm $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS) -lrocksdb |
Marc Kupietz | 678185d | 2018-06-05 13:37:02 +0200 | [diff] [blame] | 37 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 38 | bin/testcdb: src/testcdb.cc src/collocatordb.h build/collocatordb.o Makefile |
| 39 | $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -o$@ build/collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 40 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 41 | bin/dumpllr: examples/dumpllr.cc src/collocatordb.h build/collocatordb.o Makefile |
| 42 | $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ build/collocatordb.o $(INSTALL_PATH)/lib/librocksdb.a $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
Marc Kupietz | 3400aa5 | 2018-06-05 10:28:55 +0200 | [diff] [blame] | 43 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 44 | bin/dumppmicubed: examples/dumppmicubed.cc src/collocatordb.h build/collocatordb.o Makefile |
| 45 | $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ build/collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 46 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 47 | bin/dumpldafdiff: dumpldafdiff.cc src/collocatordb.h build/collocatordb.o Makefile |
| 48 | $(CXX) $(CXXFLAGS) -D_GLIBCXX_PARALLEL -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ build/collocatordb.o /vol/work/kupietz/rocksdb/librocksdb.a $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
Marc Kupietz | b5bb194 | 2018-10-07 17:59:43 +0200 | [diff] [blame] | 49 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 50 | bin/c_testcdb: examples/c_testcdb.c src/collocatordb.h build/collocatordb.o Makefile |
| 51 | $(CC) $(CFLAGS) -L. -L$(INSTALL_PATH)/lib $@.c -o$@ build/collocatordb.o -std=gnu99 -lstdc++ -lm -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS) |
Marc Kupietz | c8ddf45 | 2018-01-07 21:33:12 +0100 | [diff] [blame] | 52 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 53 | bin/collocatordb: src/collocatordb.cc Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 54 | $(CXX) $(CXXFLAGS) -L$(INSTALL_PATH)/lib $@.cc -o$@ -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
| 55 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 56 | static_lib: lib/libcollocatordb.a |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 57 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 58 | shared_lib: lib/libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 59 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 60 | lib/libcollocatordb.a: $(LIB_OBJECTS) |
| 61 | mkdir -p lib |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 62 | $(AM_V_AR)rm -f $@ |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 63 | $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIB_OBJECTS) |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 64 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 65 | lib/libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR): $(LIB_SOURCES) |
| 66 | $(CXX) $(CXXFLAGS) -Wall -D_GLIBCXX_PARALLEL -fopenmp -c $< -Wl,-soname=libcollocatordb.so.1 -Wl,--version-script=collocatordb.exmap -shared -fPIC -o $@ |
| 67 | |
| 68 | build/collocatordb.o : src/collocatordb.cc |
| 69 | mkdir -p build |
| 70 | $(CXX) $(CXXFLAGS) -c $< -o$@ $(PLATFORM_CXXFLAGS) |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 71 | |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 72 | .cc.o: |
Marc Kupietz | 18375e1 | 2017-12-24 10:11:18 +0100 | [diff] [blame] | 73 | $(CXX) $(CXXFLAGS) -c $< -o$@ $(PLATFORM_CXXFLAGS) |
Marc Kupietz | d165976 | 2018-06-05 11:22:12 +0200 | [diff] [blame] | 74 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 75 | install-static: lib/libcollocatordb.a src/collocatordb.h |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 76 | install -d $(INSTALL_PATH)/include && \ |
| 77 | install -d $(INSTALL_PATH)/lib && \ |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 78 | install -t $(INSTALL_PATH)/include -D -C -m 644 src/collocatordb.h $ && \ |
| 79 | install -t $(INSTALL_PATH)/lib -C -D -m 755 lib/libcollocatordb.a |
Marc Kupietz | d165976 | 2018-06-05 11:22:12 +0200 | [diff] [blame] | 80 | |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 81 | install-shared: lib/libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) src/collocatordb.h |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 82 | install -d $(INSTALL_PATH)/include && \ |
| 83 | install -d $(INSTALL_PATH)/lib && \ |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 84 | install -Dt $(INSTALL_PATH)/include -C -m 644 src/collocatordb.h && \ |
| 85 | install -Dt $(INSTALL_PATH)/lib -C -m 755 lib/libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) && \ |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 86 | ln -fs $(INSTALL_PATH)/lib/libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) $(INSTALL_PATH)/lib/libcollocatordb.so.$(COLLOCATDB_MAJOR) && \ |
| 87 | ln -fs $(INSTALL_PATH)/lib/libcollocatordb.so.$(COLLOCATDB_MAJOR) $(INSTALL_PATH)/lib/libcollocatordb.so |
| 88 | |
| 89 | clean: |
Marc Kupietz | c2e4321 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 90 | rm -rf $(LIB_DIR) $(BUILD_DIR) $(BIN_DIR) |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame] | 91 | rm -f *.so* *.a *.o c_testcdb collocatordb dumpldafdiff dumppmicubed dumpllr testcdb hello_world |