File: Makefile

package info (click to toggle)
libaio 0.3.110-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,132 kB
  • ctags: 749
  • sloc: ansic: 1,931; makefile: 195; sh: 14
file content (68 lines) | stat: -rw-r--r-- 1,742 bytes parent folder | download | duplicates (2)
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
67
68
DESTDIR=
prefix=/usr
includedir=$(prefix)/include
libdir=$(prefix)/lib
libdevdir=$(prefix)/lib

MK_CPPFLAGS=-I.
MK_CFLAGS=-nostdlib -nostartfiles -fomit-frame-pointer -fPIC $(CFLAGS)
CFLAGS=-Wall -g -O2
SO_CFLAGS=-shared $(MK_CFLAGS)
L_CFLAGS=$(MK_CFLAGS)
MK_LDFLAGS=-Wl,--as-needed -lgcc -lc $(LDFLAGS)

soname=libaio.so.1
minor=0
micro=1
libname=$(soname).$(minor).$(micro)
all_targets += libaio.a $(libname)

all: $(all_targets)

# libaio provided functions
libaio_srcs := io_queue_init.c io_queue_release.c
libaio_srcs += io_queue_wait.c io_queue_run.c

# real syscalls
libaio_srcs += io_getevents.c io_submit.c io_cancel.c
libaio_srcs += io_setup.c io_destroy.c

# internal functions
libaio_srcs += raw_syscall.c

# old symbols
libaio_srcs += compat-0_1.c

libaio_objs := $(patsubst %.c,%.ol,$(libaio_srcs))
libaio_sobjs := $(patsubst %.c,%.os,$(libaio_srcs))

$(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h

%.os: %.c
	$(CC) $(MK_CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<

%.ol: %.c
	$(CC) $(MK_CPPFLAGS) $(L_CFLAGS) -c -o $@ $<

AR ?= ar
RANLIB ?= ranlib
libaio.a: $(libaio_objs)
	rm -f libaio.a
	$(AR) r libaio.a $^
	$(RANLIB) libaio.a

$(libname): $(libaio_sobjs) libaio.map
	$(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(MK_LDFLAGS)

install: $(all_targets)
	install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h
	install -D -m 644 libaio.a $(DESTDIR)$(libdevdir)/libaio.a
	install -D -m 755 $(libname) $(DESTDIR)$(libdir)/$(libname)
	ln -sf $(libdir)/$(libname) $(DESTDIR)$(libdir)/$(soname)
	ln -sf $(libdir)/$(libname) $(DESTDIR)$(libdevdir)/libaio.so

$(libaio_objs): libaio.h

clean:
	rm -f $(all_targets) $(libaio_objs) $(libaio_sobjs) $(soname).new
	rm -f *.so* *.a *.o