2017-04-04 11:53:22 -07:00
|
|
|
|
2017-05-16 12:56:38 -07:00
|
|
|
IFLAGS := -isystem include/ -I ../include/ -I ../lib/zstd/ -isystem googletest/googletest/include -isystem ../../../lib/common/
|
2017-04-04 11:53:22 -07:00
|
|
|
|
2017-04-04 16:30:11 -07:00
|
|
|
SOURCES := $(wildcard ../lib/zstd/*.c)
|
2017-04-04 11:53:22 -07:00
|
|
|
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
|
|
|
|
|
|
|
|
ARFLAGS := rcs
|
2017-06-26 18:33:04 -07:00
|
|
|
CXXFLAGS += -std=c++11 -g -O3 -Wcast-align
|
|
|
|
CFLAGS += -g -O3 -Wframe-larger-than=400 -Wcast-align
|
2017-04-04 11:53:22 -07:00
|
|
|
CPPFLAGS += $(IFLAGS)
|
|
|
|
|
2017-04-04 16:30:11 -07:00
|
|
|
../lib/zstd/libzstd.a: $(OBJECTS)
|
2017-04-04 11:53:22 -07:00
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
2017-06-19 19:09:15 -07:00
|
|
|
DecompressCrash: DecompressCrash.o $(OBJECTS) libFuzzer.a
|
2017-06-26 18:33:04 -07:00
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
|
2017-06-19 19:09:15 -07:00
|
|
|
|
|
|
|
RoundTripCrash: RoundTripCrash.o $(OBJECTS) ../lib/xxhash.o libFuzzer.a
|
2017-06-26 18:33:04 -07:00
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
|
2017-06-19 19:09:15 -07:00
|
|
|
|
2017-05-17 14:56:37 -07:00
|
|
|
UserlandTest: UserlandTest.cpp ../lib/zstd/libzstd.a ../lib/xxhash.o
|
2017-06-26 18:33:04 -07:00
|
|
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ googletest/build/googlemock/gtest/libgtest.a googletest/build/googlemock/gtest/libgtest_main.a -o $@
|
2017-04-04 11:53:22 -07:00
|
|
|
|
2017-05-16 12:56:38 -07:00
|
|
|
XXHashUserlandTest: XXHashUserlandTest.cpp ../lib/xxhash.o ../../../lib/common/xxhash.o
|
|
|
|
$(CXX) $(CXXFLAGS) $(CFLAGS) $(CPPFLAGS) $^ googletest/build/googlemock/gtest/libgtest.a googletest/build/googlemock/gtest/libgtest_main.a -o $@
|
|
|
|
|
2017-06-19 19:09:15 -07:00
|
|
|
# Install libfuzzer
|
|
|
|
libFuzzer.a:
|
|
|
|
@$(RM) -rf Fuzzer
|
|
|
|
@git clone https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer
|
|
|
|
@./Fuzzer/build.sh
|
|
|
|
|
2017-04-04 11:53:22 -07:00
|
|
|
# Install googletest
|
|
|
|
.PHONY: googletest
|
|
|
|
googletest:
|
|
|
|
@$(RM) -rf googletest
|
|
|
|
@git clone https://github.com/google/googletest
|
|
|
|
@mkdir -p googletest/build
|
|
|
|
@cd googletest/build && cmake .. && $(MAKE)
|
|
|
|
|
|
|
|
clean:
|
2017-06-26 18:33:04 -07:00
|
|
|
$(RM) -f *.{o,a} ../lib/zstd/*.{o,a} ../lib/*.o
|
2017-06-19 19:09:15 -07:00
|
|
|
$(RM) -f DecompressCrash RoundTripCrash UserlandTest XXHashUserlandTest
|