Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
66 lines (50 loc) · 2.24 KB
/
Copy pathMakefile
File metadata and controls
66 lines (50 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT
all: libdto dtoctl dto-test-wodto man
.PHONY: man install-man
DML_LIB_CXX=-D_GNU_SOURCE
# Path to libdto.so that dtoctl prepends to LD_PRELOAD (matches "make install").
DTOCTL_LIBPATH ?= /usr/lib64/libdto.so
PANDOC ?= pandoc
MANDIR ?= /usr/share/man
# Version reported by "dtoctl --version", taken from the CMake project.
DTO_VERSION := $(shell grep -o 'DTO VERSION [0-9.]*' CMakeLists.txt | cut -d' ' -f3)
libdto: dto.c
gcc -shared -fPIC -Wl,-soname,libdto.so dto.c $(DML_LIB_CXX) -DDTO_STATS_SUPPORT -DDTO_ACCEL_CONFIG_SUPPORT -DDTO_NUMA_SUPPORT -o libdto.so.1.0 -laccel-config -ldl -lnuma -mwaitpkg
libdto_nostats: dto.c
gcc -shared -fPIC -Wl,-soname,libdto.so dto.c $(DML_LIB_CXX) -DDTO_ACCEL_CONFIG_SUPPORT -DDTO_NUMA_SUPPORT -o libdto.so.1.0 -laccel-config -ldl -lnuma -mwaitpkg
# the explicit dto_* API without the libc memcpy/memset/memmove/memcmp interposers
libdto_explicit: dto.c
gcc -shared -fPIC -Wl,-soname,libdto_explicit.so dto.c $(DML_LIB_CXX) -DDTO_NO_LIBC_INTERPOSE -DDTO_ACCEL_CONFIG_SUPPORT -DDTO_NUMA_SUPPORT -o libdto_explicit.so.1.0 -laccel-config -ldl -lnuma -mwaitpkg
dtoctl: dtoctl.c
gcc -O2 -Wall dtoctl.c -DLIBDTO_PATH=\"$(DTOCTL_LIBPATH)\" -DDTO_VERSION=\"$(DTO_VERSION)\" -o dtoctl
man: doc/dtoctl.1
doc/dtoctl.1: doc/dtoctl.md
@if command -v "$(PANDOC)" >/dev/null 2>&1; then \
"$(PANDOC)" --standalone --to=man $< -o $@; \
else \
echo "Skipping dtoctl manual generation: install pandoc to build the man page."; \
fi
install: dtoctl install-man
cp libdto.so.1.0 /usr/lib64/
cp dto.h /usr/include/
ln -sf /usr/lib64/libdto.so.1.0 /usr/lib64/libdto.so.1
ln -sf /usr/lib64/libdto.so.1.0 /usr/lib64/libdto.so
cp dtoctl /usr/bin/
install-man: man
@if [ -f doc/dtoctl.1 ]; then \
install -D -m 644 doc/dtoctl.1 "$(MANDIR)/man1/dtoctl.1"; \
else \
echo "Skipping dtoctl manual installation: no generated man page is available."; \
fi
install-local:
ln -sf ./libdto.so.1.0 ./libdto.so.1
ln -sf ./libdto.so.1.0 ./libdto.so
dto-test: dto-test.c
gcc -g dto-test.c $(DML_LIB_CXX) -o dto-test -ldto -lpthread
dto-test-wodto: dto-test.c
gcc -g dto-test.c $(DML_LIB_CXX) -o dto-test-wodto -lpthread
clean:
rm -rf *.o *.so dto-test dtoctl
rm -f doc/dtoctl.1