-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (27 loc) · 697 Bytes
/
Makefile
File metadata and controls
38 lines (27 loc) · 697 Bytes
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
CC = /usr/bin/env clang
# Remove -DSHM to disable using shm
CFLAGS = -DSHM -Wall -fPIC
AR = /usr/bin/env ar
ARFLAGS = -c -v -r
SRCDIR = src
OBJECT = $(SRCDIR)/rbuf.o
STATIC = librbuf.a
DYNAMIC = librbuf.so
all: dynamic static
static: $(STATIC)
dynamic: $(DYNAMIC)
$(STATIC): $(OBJECT)
$(AR) $(ARFLAGS) $@ $<
$(DYNAMIC): $(OBJECT)
$(CC) $(CFLAGS) -shared -o $@ $<
$(OBJECT): $(SRCDIR)/rbuf.c $(SRCDIR)/rbuf.h
$(CC) $(CFLAGS) -c -o $@ $<
test: $(SRCDIR)/test.c $(DYNAMIC) $(STATIC)
$(CC) $(CFLAGS) -g -o $@_static $< $(STATIC)
./$@_static
$(CC) $(CFLAGS) -g -o $@_dynamic $< -I$(SRCDIR)/ -rpath ./ -L./ -lrbuf
./$@_dynamic
clean:
rm -f *.{a,so}
rm -f test_*
rm -f $(SRCDIR)/*.o