blob: d674a2ecd22a8ccb9c9c09f3bf83e195cd0e5a8d (
plain)
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
|
CXXFLAGS = -fPIE -g -Wall -Werror -fno-builtin -DTSAN_DEBUG=$(DEBUG)
ifeq ($(DEBUG), 0)
CXXFLAGS += -O3
endif
# For interception. FIXME: move interception one level higher.
INTERCEPTION=../../interception
COMMON=../../sanitizer_common
INCLUDES= -I../.. -I../../../include
EXTRA_CXXFLAGS=-fno-exceptions
NO_SYSROOT=--sysroot=.
CXXFLAGS+=$(EXTRA_CXXFLAGS)
CXXFLAGS+=$(CFLAGS)
ifeq ($(DEBUG), 0)
CXXFLAGS+=-fomit-frame-pointer
ifeq ($(CXX), g++)
CXXFLAGS+=-Wframe-larger-than=512
endif # CXX=g++
endif # DEBUG=0
ifeq ($(CXX), clang++)
# Global constructors are banned.
CXXFLAGS+=-Wglobal-constructors
endif
all: libtsan.a
LIBTSAN_HEADERS=$(wildcard *.h) \
$(wildcard $(INTERCEPTION)/*.h) \
$(wildcard $(COMMON)/*.h)
LIBTSAN_SRC=$(wildcard *.cc)
LIBTSAN_ASM_SRC=$(wildcard *.S)
INTERCEPTION_SRC=$(wildcard $(INTERCEPTION)/*.cc)
COMMON_SRC=$(wildcard $(COMMON)/*.cc)
LIBTSAN_OBJ=$(patsubst %.cc,%.o,$(LIBTSAN_SRC)) \
$(patsubst %.S,%.o,$(LIBTSAN_ASM_SRC)) \
$(patsubst $(INTERCEPTION)/%.cc,%.o,$(INTERCEPTION_SRC)) \
$(patsubst $(COMMON)/%.cc,%.o,$(COMMON_SRC))
%_linux.o: %_linux.cc Makefile.old $(LIBTSAN_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
%_new_delete.o: %_new_delete.cc Makefile.old $(LIBTSAN_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
%.o: %.cc Makefile.old $(LIBTSAN_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(NO_SYSROOT) -c $<
%.o: $(INTERCEPTION)/%.cc Makefile.old $(LIBTSAN_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
%.o: $(COMMON)/%.cc Makefile.old $(LIBTSAN_HEADERS)
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
libtsan.a: $(LIBTSAN_OBJ)
ar ru $@ $(LIBTSAN_OBJ)
libtsan_dummy.a: tsan_dummy_rtl.o
ar ru $@ $<
clean:
rm -f *.o *.a
|