-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
73 lines (55 loc) · 1.58 KB
/
makefile
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
69
70
71
72
73
.PHONY: so install uninstall
libmajor = 0
libminor = 1
libname = libufiber.so
soname = $(libname).$(libmajor)
realname = $(soname).$(libminor)
prefix = /usr/local
bindir = $(prefix)/bin
libdir = $(prefix)/lib
mandir = $(prefix)/share/man
includedir = $(prefix)/include
CC = gcc -std=c99
CFLAGS = -Wall -Wextra -Wno-unused-parameter -pedantic -g
ALLCFLAGS = $(CFLAGS)
AS = as
AR = ar
ARFLAGS = rcs
LD = $(CC)
LDFLAGS =
INSTALL = @scripts/install
man3 = doc/ufiber_create.3 doc/ufiber_exit.3 doc/ufiber_join.3 \
doc/ufiber_ref.3 doc/ufiber_self.3 doc/ufiber_yield.3
libobjects = arch.o ufiber.o
soobjects = $(addprefix so.,$(libobjects))
objects = $(libobjects) $(soobjects) check.o
clean = $(objects) $(realname) ufiber.a
all: ufiber.a
so: $(realname)
include rules.mk
quiet_cmd_ldconf = LDCONF $(libdir)
cmd_ldconf = ldconfig -n $(libdir)
quiet_cmd_libln = LN $(libdir)/$(libname)
cmd_libln = ln -f -s $(realname) $(libdir)/$(libname)
quiet_cmd_sold = LD $@
cmd_sold = $(LD) $(LDFLAGS) -shared -Wl,-soname,$(1) -o $@ $^
so.%.o: %.c
$(call cmd,cc,-fPIC)
so.%.o: %.S
$(call cmd,ccas)
$(realname): $(soobjects)
$(call cmd,sold,$(soname))
ufiber.a: $(libobjects)
$(call cmd,ar)
check: check.o ufiber.a
$(call cmd,ld,-lcheck)
install: $(realname)
$(INSTALL) -m755 $(libdir) $(realname)
$(call cmd,ldconf)
$(call cmd,libln)
$(INSTALL) -m644 $(includedir) ufiber.h
$(INSTALL) -m644 $(mandir)/man3 $(man3)
uninstall:
rm -f $(libdir)/$(realname)
rm -f $(libdir)/$(soname)
rm -f $(libdir)/$(libname)