-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (42 loc) · 1.25 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
.PHONY: all check stress install dist clean
INSTALL ?= install
PREFIX ?= /usr/local
DESTDIR ?=
CC ?= cc
PKG_CONFIG ?= pkg-config
CFLAGS += -std=c11
CFLAGS += -Wall -Wextra -pedantic
CFLAGS += -pthread
#CFLAGS += -fsanitize=address
#CFLAGS += -fno-omit-frame-pointer
CFLAGS += -fsanitize=undefined
CFLAGS += -fsanitize=thread
CFLAGS += -fprofile-arcs -ftest-coverage
CFLAGS += -O3
CFLAGS += `$(PKG_CONFIG) --cflags cmocka`
LDFLAGS += `$(PKG_CONFIG) --libs cmocka`
PACKAGE = ringbuf
VERSION = 0.0.0
DIST = Makefile ringbuf.h unused.h test.c LICENSE
all:
@echo 'As this is a header only library there is nothing to be done.'
@echo 'See `make check`, `make stress`, and `make install`.'
check: test
./test
stress: stress.c ringbuf.h
$(CC) stress.c -o $@ $(CFLAGS) $(LDFLAGS)
./stress
test: test.c ringbuf.h unused.h
$(CC) test.c -o $@ $(CFLAGS) $(LDFLAGS)
install: ringbuf.h
$(INSTALL) -D -m644 ringbuf.h "$(DESTDIR)$(PREFIX)/include/ringbuf.h"
dist: $(DIST)
mkdir -p $(PACKAGE)-$(VERSION)
cp $(DIST) $(PACKAGE)-$(VERSION)
tar -cf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION)
gzip -fk $(PACKAGE)-$(VERSION).tar
xz -f $(PACKAGE)-$(VERSION).tar
clean:
rm -f test stress *.gcov *.gcda *.gcno
distclean: clean
rm -rf $(PACKAGE)-$(VERSION){,.tar.gz,.tar.xz}