Home | History | Annotate | Download | only in rtl
      1 CXXFLAGS = -fPIE -g -Wall -Werror -fno-builtin -DTSAN_DEBUG=$(DEBUG) -DSANITIZER_DEBUG=$(DEBUG)
      2 CLANG=clang
      3 ifeq ($(DEBUG), 0)
      4   CXXFLAGS += -O3
      5 endif
      6 
      7 # For interception. FIXME: move interception one level higher.
      8 INTERCEPTION=../../interception
      9 COMMON=../../sanitizer_common
     10 INCLUDES= -I../.. -I../../../include
     11 EXTRA_CXXFLAGS=-fno-exceptions -fno-rtti
     12 NO_SYSROOT=--sysroot=.
     13 CXXFLAGS+=$(EXTRA_CXXFLAGS)
     14 CXXFLAGS+=$(CFLAGS)
     15 ifeq ($(DEBUG), 0)
     16   CXXFLAGS+=-fomit-frame-pointer
     17 ifeq ($(CXX), g++)
     18   CXXFLAGS+=-Wframe-larger-than=512
     19 endif  # CXX=g++
     20 endif  # DEBUG=0
     21 
     22 ifeq ($(CXX), $(CLANG)++)
     23   # Global constructors are banned.
     24   CXXFLAGS+=-Wglobal-constructors
     25 endif
     26 
     27 
     28 
     29 all: libtsan.a
     30 
     31 LIBTSAN_HEADERS=$(wildcard *.h) \
     32 		$(wildcard $(INTERCEPTION)/*.h) \
     33 		$(wildcard $(COMMON)/*.h)
     34 LIBTSAN_SRC=$(wildcard *.cc)
     35 LIBTSAN_ASM_SRC=$(wildcard *.S)
     36 INTERCEPTION_SRC=$(wildcard $(INTERCEPTION)/*.cc)
     37 COMMON_SRC=$(wildcard $(COMMON)/*.cc)
     38 
     39 LIBTSAN_OBJ=$(patsubst %.cc,%.o,$(LIBTSAN_SRC)) \
     40 	    $(patsubst %.S,%.o,$(LIBTSAN_ASM_SRC)) \
     41 	    $(patsubst $(INTERCEPTION)/%.cc,%.o,$(INTERCEPTION_SRC)) \
     42 	    $(patsubst $(COMMON)/%.cc,%.o,$(COMMON_SRC))
     43 
     44 %_linux.o: %_linux.cc Makefile.old $(LIBTSAN_HEADERS)
     45 	$(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
     46 %.o: %.cc Makefile.old $(LIBTSAN_HEADERS)
     47 	$(CXX) $(CXXFLAGS) $(INCLUDES) $(NO_SYSROOT) -c $<
     48 %.o: $(INTERCEPTION)/%.cc Makefile.old $(LIBTSAN_HEADERS)
     49 	$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
     50 %.o: $(COMMON)/%.cc Makefile.old $(LIBTSAN_HEADERS)
     51 	$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
     52 
     53 libtsan.a: $(LIBTSAN_OBJ)
     54 	ar ru $@ $(LIBTSAN_OBJ)
     55 
     56 libtsan_dummy.a: tsan_dummy_rtl.o
     57 	ar ru $@ $<
     58 
     59 clean:
     60 	rm -f *.o *.a
     61