forked from cgaebel/pipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (34 loc) · 1.27 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
CC=gcc
OBJS=pipe.c pipe_test.c pipe_util.c
NAME=pipe
CFLAGS=-Wall -Wextra -Wpointer-arith -fstrict-aliasing -std=c99 -DFORTIFY_SOURCE=2 -pipe -pedantic #-Werror
D_CFLAGS=-DDEBUG -g -O0
R_CFLAGS=-DNDEBUG -O3 -funroll-loops #-pg #-flto
target = $(shell sh -c '$(CC) -v 2>&1 | grep "Target:"')
ifeq (,$(findstring mingw,$(target)))
CFLAGS += -pthread
endif
all: pipe_debug pipe_release thread_ring_debug thread_ring_release
pipe_debug: $(OBJS) main.c
$(CC) $(CFLAGS) $(D_CFLAGS) -o pipe_debug $(OBJS) main.c
pipe_release: $(OBJS) main.c
$(CC) $(CFLAGS) $(R_CFLAGS) -o pipe_release $(OBJS) main.c
thread_ring_debug: $(OBJS) thread_ring.c
$(CC) $(CFLAGS) $(D_FLAGS) -o thread_ring_debug $(OBJS) thread_ring.c
thread_ring_release: $(OBJS) thread_ring.c
$(CC) $(CFLAGS) $(R_FLAGS) -o thread_ring_release $(OBJS) thread_ring.c
pipe.h:
main.c: pipe.h
pipe.c: pipe.h
pipe_test.c: pipe.h pipe_util.h
pipe_util.c: pipe.h pipe_util.h
.PHONY : clean analyze
analyze: $(OBJS) pipe_debug pipe_release
clang --analyze $(CFLAGS) $(OBJS)
valgrind ./pipe_debug
valgrind ./pipe_release
valgrind --tool=callgrind --dump-instr=yes --trace-jump=yes ./pipe_release
valgrind --tool=cachegrind ./pipe_release
valgrind --tool=massif ./pipe_release
clean:
rm -f *.plist pipe_debug pipe_release