blob: b7f49f163c2929f37cd16e0b73535b72c69a62df [file] [log] [blame]
Marc Kupietzad332042021-03-13 18:05:14 +01001COLLOCATDB_MAJOR=1
2COLLOCATDB_MINOR=2
3COLLOCATDB_PATCH=0
4
5INSTALL_PATH ?= /usr/local
6
Marc Kupietz28cc53e2017-12-23 17:24:55 +01007PLATFORM_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
8PLATFORM_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
9PLATFORM=OS_LINUX
Marc Kupietzad332042021-03-13 18:05:14 +010010PLATFORM_LDFLAGS= -L$(INSTALL_PATH)/lib -Wl,-rpath=$(INSTALL_PATH)/lib -lpthread -lrt -lsnappy -lz -lbz2 -llz4 -lzstd
Marc Kupietz28cc53e2017-12-23 17:24:55 +010011
Marc Kupietzad332042021-03-13 18:05:14 +010012CXXFLAGS = -Wall -Wno-reorder -I/usr/local/include -g -std=c++11 -Ofast
13CFLAGS = -Wall -I/usr/local/rocksdb -I$(INSTALL_PATH)/include -g -std=gnu99 -O2
Marc Kupietz4b799e92018-01-02 11:04:56 +010014
15ARFLAGS = ${EXTRA_ARFLAGS} rs
Marc Kupietz18375e12017-12-24 10:11:18 +010016
Marc Kupietz28cc53e2017-12-23 17:24:55 +010017ifneq ($(USE_RTTI), 1)
18 CXXFLAGS += -fno-rtti
19endif
20LIB_SOURCES = collocatordb.cc
21
22LIBOBJECTS = $(LIB_SOURCES:.cc=.o)
Marc Kupietzad332042021-03-13 18:05:14 +010023
24.PHONY: static_lib shared_lib install-static install-shared
25
26all: static_lib shared_lib dumpllr c_testcdb
27
28install: install-static install-shared
Marc Kupietz28cc53e2017-12-23 17:24:55 +010029
Marc Kupietz678185d2018-06-05 13:37:02 +020030hello_world: hello_world.c collocatordb.h collocatordb.o Makefile
Marc Kupietzad332042021-03-13 18:05:14 +010031 $(CC) $(CFLAGS) -L. -L$(INSTALL_PATH)/lib $@.c -o$@ collocatordb.o --std=gnu99 -lstdc++ -lm $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS) -lrocksdb
Marc Kupietz678185d2018-06-05 13:37:02 +020032
Marc Kupietz4b799e92018-01-02 11:04:56 +010033testcdb: testcdb.cc collocatordb.h collocatordb.o Makefile
Marc Kupietzad332042021-03-13 18:05:14 +010034 $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -o$@ collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS)
Marc Kupietz4b799e92018-01-02 11:04:56 +010035
Marc Kupietz3400aa52018-06-05 10:28:55 +020036dumpllr: dumpllr.cc collocatordb.h collocatordb.o Makefile
Marc Kupietzad332042021-03-13 18:05:14 +010037 $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ collocatordb.o $(INSTALL_PATH)/lib/librocksdb.a $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS)
Marc Kupietz3400aa52018-06-05 10:28:55 +020038
Marc Kupietzb5bb1942018-10-07 17:59:43 +020039dumppmicubed: dumppmicubed.cc collocatordb.h collocatordb.o Makefile
Marc Kupietzad332042021-03-13 18:05:14 +010040 $(CXX) $(CXXFLAGS) -L. -L$(INSTALL_PATH)/lib $@.cc -fopenmp -o$@ collocatordb.o -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS)
41
42dumpldafdiff: 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 Kupietzb5bb1942018-10-07 17:59:43 +020044
Marc Kupietz06c9a9f2018-01-02 16:56:43 +010045c_testcdb: c_testcdb.c collocatordb.h collocatordb.o Makefile
Marc Kupietzad332042021-03-13 18:05:14 +010046 $(CC) $(CFLAGS) -L. -L$(INSTALL_PATH)/lib $@.c -o$@ collocatordb.o -std=gnu99 -lstdc++ -lm -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CCFLAGS) $(EXEC_LDFLAGS)
Marc Kupietzc8ddf452018-01-07 21:33:12 +010047
Marc Kupietz4b799e92018-01-02 11:04:56 +010048collocatordb: collocatordb.cc Makefile
Marc Kupietzad332042021-03-13 18:05:14 +010049 $(CXX) $(CXXFLAGS) -L$(INSTALL_PATH)/lib $@.cc -o$@ -lrocksdb $(PLATFORM_LDFLAGS) $(PLATFORM_CXXFLAGS) $(EXEC_LDFLAGS)
50
51static_lib: libcollocatordb.a
52
53shared_lib: libcollocatordb.so.$(COLLOCATDB_MAJOR).$(COLLOCATDB_MINOR)
Marc Kupietz28cc53e2017-12-23 17:24:55 +010054
55libcollocatordb.a: $(LIBOBJECTS)
Marc Kupietz4b799e92018-01-02 11:04:56 +010056 $(AM_V_AR)rm -f $@
Marc Kupietz28cc53e2017-12-23 17:24:55 +010057 $(AM_V_at)$(AR) $(ARFLAGS) $@ $(LIBOBJECTS)
58
Marc Kupietzad332042021-03-13 18:05:14 +010059libcollocatordb.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 Kupietz4b799e92018-01-02 11:04:56 +010061
Marc Kupietz28cc53e2017-12-23 17:24:55 +010062.cc.o:
Marc Kupietz18375e12017-12-24 10:11:18 +010063 $(CXX) $(CXXFLAGS) -c $< -o$@ $(PLATFORM_CXXFLAGS)
Marc Kupietzd1659762018-06-05 11:22:12 +020064
Marc Kupietzad332042021-03-13 18:05:14 +010065install-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 Kupietzd1659762018-06-05 11:22:12 +020070
Marc Kupietzad332042021-03-13 18:05:14 +010071install-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
79clean:
80 rm -f *.so* *.a *.o c_testcdb collocatordb dumpldafdiff dumppmicubed dumpllr testcdb hello_world