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 | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 12 | CXXFLAGS = -Wall -Wno-reorder -I/usr/local/include -g -std=c++11 -Ofast |
| 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 |
| 20 | LIB_SOURCES = collocatordb.cc |
| 21 | |
| 22 | LIBOBJECTS = $(LIB_SOURCES:.cc=.o) |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 23 | |
| 24 | .PHONY: static_lib shared_lib install-static install-shared |
| 25 | |
| 26 | all: static_lib shared_lib dumpllr c_testcdb |
| 27 | |
| 28 | install: install-static install-shared |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 29 | |
Marc Kupietz | 678185d | 2018-06-05 13:37:02 +0200 | [diff] [blame] | 30 | hello_world: hello_world.c collocatordb.h collocatordb.o Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 31 | $(CC) $(CFLAGS) -L. -L$(INSTALL_PATH)/lib $@.c -o$@ 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] | 32 | |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 33 | testcdb: testcdb.cc collocatordb.h collocatordb.o Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 34 | $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -o$@ collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 35 | |
Marc Kupietz | 3400aa5 | 2018-06-05 10:28:55 +0200 | [diff] [blame] | 36 | dumpllr: dumpllr.cc collocatordb.h collocatordb.o Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 37 | $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ 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] | 38 | |
Marc Kupietz | b5bb194 | 2018-10-07 17:59:43 +0200 | [diff] [blame] | 39 | dumppmicubed: dumppmicubed.cc collocatordb.h collocatordb.o Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 40 | $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
| 41 | |
| 42 | dumpldafdiff: dumpldafdiff.cc collocatordb.h collocatordb.o Makefile |
| 43 | $(CXX) $(CXXFLAGS) -D_GLIBCXX_PARALLEL -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ 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] | 44 | |
Marc Kupietz | 06c9a9f | 2018-01-02 16:56:43 +0100 | [diff] [blame] | 45 | c_testcdb: c_testcdb.c collocatordb.h collocatordb.o Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 46 | $(CC) $(CFLAGS) -L. -L$(INSTALL_PATH)/lib $@.c -o$@ 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] | 47 | |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 48 | collocatordb: collocatordb.cc Makefile |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 49 | $(CXX) $(CXXFLAGS) -L$(INSTALL_PATH)/lib $@.cc -o$@ -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS) |
| 50 | |
| 51 | static_lib: libcollocatordb.a |
| 52 | |
| 53 | shared_lib: libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 54 | |
| 55 | libcollocatordb.a: $(LIBOBJECTS) |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 56 | $(AM_V_AR)rm -f $@ |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 57 | $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS) |
| 58 | |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 59 | libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR): collocatordb.cc |
| 60 | $(CXX) $(CXXFLAGS) -Wall -D_GLIBCXX_PARALLEL -fopenmp -c collocatordb.cc -Wl,-soname=libcollocatordb.so.1 -Wl,--version-script=collocatordb.exmap -shared -fPIC -o libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) |
Marc Kupietz | 4b799e9 | 2018-01-02 11:04:56 +0100 | [diff] [blame] | 61 | |
Marc Kupietz | 28cc53e | 2017-12-23 17:24:55 +0100 | [diff] [blame] | 62 | .cc.o: |
Marc Kupietz | 18375e1 | 2017-12-24 10:11:18 +0100 | [diff] [blame] | 63 | $(CXX) $(CXXFLAGS) -c $< -o$@ $(PLATFORM_CXXFLAGS) |
Marc Kupietz | d165976 | 2018-06-05 11:22:12 +0200 | [diff] [blame] | 64 | |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 65 | install-static: libcollocatordb.a collocatordb.h |
| 66 | install -d $(INSTALL_PATH)/include && \ |
| 67 | install -d $(INSTALL_PATH)/lib && \ |
| 68 | install -t $(INSTALL_PATH)/include -D -C -m 644 collocatordb.h $ && \ |
| 69 | install -t $(INSTALL_PATH)/lib -C -D -m 755 libcollocatordb.a |
Marc Kupietz | d165976 | 2018-06-05 11:22:12 +0200 | [diff] [blame] | 70 | |
Marc Kupietz | ad33204 | 2021-03-13 18:05:14 +0100 | [diff] [blame^] | 71 | install-shared: libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) collocatordb.h |
| 72 | install -d $(INSTALL_PATH)/include && \ |
| 73 | install -d $(INSTALL_PATH)/lib && \ |
| 74 | install -Dt $(INSTALL_PATH)/include -C -m 644 collocatordb.h && \ |
| 75 | install -Dt $(INSTALL_PATH)/lib -C -m 755 libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) && \ |
| 76 | ln -fs $(INSTALL_PATH)/lib/libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR) $(INSTALL_PATH)/lib/libcollocatordb.so.$(COLLOCATDB_MAJOR) && \ |
| 77 | ln -fs $(INSTALL_PATH)/lib/libcollocatordb.so.$(COLLOCATDB_MAJOR) $(INSTALL_PATH)/lib/libcollocatordb.so |
| 78 | |
| 79 | clean: |
| 80 | rm -f *.so* *.a *.o c_testcdb collocatordb dumpldafdiff dumppmicubed dumpllr testcdb hello_world |