-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
41 lines (30 loc) · 847 Bytes
/
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
CC ?= cc
AR ?= ar
CFLAGS ?= -O2
PREFIX ?= /usr/local
LIBDIR ?= $(PREFIX)/lib
SOBASE = libatomic.so
SONAME = $(SOBASE).1
SHAREDLIB = $(SONAME).69.0
STATICLIB = libatomic.a
EXTRA_CFLAGS = -std=c99 -Wall -Wextra -fPIC
OBJS = atomic.o
all: $(SHAREDLIB) $(STATICLIB)
.c.o:
$(CC) $(EXTRA_CFLAGS) $(CFLAGS) -c -o $@ $<
$(SHAREDLIB): $(OBJS)
$(CC) $(OBJS) $(EXTRA_CFLAGS) $(CFLAGS) $(LDFLAGS) \
-nolibc -shared -Wl,-soname,$(SONAME) -o $(SHAREDLIB)
$(STATICLIB): $(OBJS)
$(AR) -rcs $(STATICLIB) $(OBJS)
# no tests
check:
:
clean:
rm -f $(OBJS) $(SHAREDLIB) $(STATICLIB)
install: $(SHAREDLIB) $(STATICLIB)
install -d $(DESTDIR)$(LIBDIR)
install -m 755 $(SHAREDLIB) $(DESTDIR)$(LIBDIR)
install -m 755 $(STATICLIB) $(DESTDIR)$(LIBDIR)
ln -sf $(SHAREDLIB) $(DESTDIR)$(LIBDIR)/$(SOBASE)
ln -sf $(SHAREDLIB) $(DESTDIR)$(LIBDIR)/$(SONAME)