blob: 02abc3a8d2407a12de1c8333700fcc2ca3671926 (
plain) (
blame)
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
|
prefix ?= /usr
includedir=$(prefix)/include
libdir=$(prefix)/lib
CFLAGS ?= -g -fomit-frame-pointer -O2
CFLAGS += -Wall -I.
SO_CFLAGS=-shared -fPIC $(CFLAGS)
L_CFLAGS=$(CFLAGS)
LINK_FLAGS=
LINK_FLAGS+=$(LDFLAGS)
ENABLE_SHARED ?= 1
soname=liburing.so.1
minor=0
micro=1
libname=$(soname).$(minor).$(micro)
all_targets += liburing.a
ifeq ($(ENABLE_SHARED),1)
all_targets += $(libname)
endif
all: $(all_targets)
liburing_srcs := setup.c queue.c syscall.c
liburing_objs := $(patsubst %.c,%.ol,$(liburing_srcs))
liburing_sobjs := $(patsubst %.c,%.os,$(liburing_srcs))
$(liburing_objs) $(liburing_sobjs): io_uring.h
%.os: %.c
$(CC) $(SO_CFLAGS) -c -o $@ $<
%.ol: %.c
$(CC) $(L_CFLAGS) -c -o $@ $<
AR ?= ar
RANLIB ?= ranlib
liburing.a: $(liburing_objs)
rm -f liburing.a
$(AR) r liburing.a $^
$(RANLIB) liburing.a
$(libname): $(liburing_sobjs) liburing.map
$(CC) $(SO_CFLAGS) -Wl,--version-script=liburing.map -Wl,-soname=$(soname) -o $@ $(liburing_sobjs) $(LINK_FLAGS)
install: $(all_targets)
install -D -m 644 io_uring.h $(includedir)/io_uring.h
install -D -m 644 liburing.h $(includedir)/liburing.h
install -D -m 644 compat.h $(includedir)/compat.h
install -D -m 644 barrier.h $(includedir)/barrier.h
install -D -m 644 liburing.a $(libdir)/liburing.a
ifeq ($(ENABLE_SHARED),1)
install -D -m 755 $(libname) $(libdir)/$(libname)
ln -sf $(libname) $(libdir)/$(soname)
ln -sf $(libname) $(libdir)/liburing.so
endif
$(liburing_objs): liburing.h
clean:
rm -f $(all_targets) $(liburing_objs) $(liburing_sobjs) $(soname).new
rm -f *.so* *.a *.o
|