-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.unittest
64 lines (46 loc) · 1.74 KB
/
Makefile.unittest
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
# The intentaion is not to build these snippets as a .lib, just include them in your source.
# This serves to run a unit test.
CXX = clang++
LINK = clang++
BACKTRACE_CXXFLAGS = -fno-omit-frame-pointer
BACKTRACE_LFLAGS = -rdynamic
# no-omit-frame-pointer and -rdynamic aren't strictly needed for backtrace to work
# but it makes info in the backtrace more likely to correspond to your code.
# pick one, release or debug
#DEBUG_RELEASE = -D_DEBUG
DEBUG_RELEASE = -O3
# shared_state configuration
#
# shared_state supports concurrent reads by default. The overhead of enabling
# concurrent reads is about 5% larger than when concurernt reads are disabled
# if there is no lock contention. The overhead is about 0.8 microseconds.
#
#SHARED_STATE = -DSHARED_STATE_NO_SHARED_MUTEX
#SHARED_STATE = -DSHARED_STATE_NO_TIMEOUT
#SHARED_STATE = -DSHARED_STATE_NO_SHARED_MUTEX -DSHARED_STATE_NO_TIMEOUT
# Boost mutexes
#
# std (libc++) is 20% faster than boost with concurrent reads enabled.
# boost (pthreads) is 1% faster than std with concurrent reads disabled.
#
#LIBS += -lboost_system-mt -lboost_chrono-mt -lboost_thread-mt
#SHARED_STATE += -DSHARED_STATE_BOOST_MUTEX
# MacPorts
#
#INCPATH += -I/opt/local/include
#LIBS += -L/opt/local/lib
TARGET = ./backtrace-unittest
CXXFLAGS = -std=c++11 -W -Wall -g $(BACKTRACE_CXXFLAGS) $(DEBUG_RELEASE) $(SHARED_STATE) $(INCPATH)
LFLAGS = $(BACKTRACE_LFLAGS)
SRCS = $(wildcard *.cpp)
OBJS = $(SRCS:%.cpp=%.o) main/main.o
all: $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
.depend: *.cpp *.h
mkdep $(CXXFLAGS) *.cpp
$(OBJS): Makefile.unittest
$(TARGET): $(OBJS) .depend
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
$(TARGET) || true
include .depend