2017-04-04 18:53:22 +00:00
|
|
|
|
2017-05-16 19:56:38 +00:00
|
|
|
IFLAGS := -isystem include/ -I ../include/ -I ../lib/zstd/ -isystem googletest/googletest/include -isystem ../../../lib/common/
|
2017-04-04 18:53:22 +00:00
|
|
|
|
2017-04-04 23:30:11 +00:00
|
|
|
SOURCES := $(wildcard ../lib/zstd/*.c)
|
2017-04-04 18:53:22 +00:00
|
|
|
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
|
|
|
|
|
|
|
|
ARFLAGS := rcs
|
|
|
|
CXXFLAGS += -std=c++11
|
|
|
|
CFLAGS += -g -O0
|
|
|
|
CPPFLAGS += $(IFLAGS)
|
|
|
|
|
2017-04-04 23:30:11 +00:00
|
|
|
../lib/zstd/libzstd.a: $(OBJECTS)
|
2017-04-04 18:53:22 +00:00
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
2017-04-04 23:30:11 +00:00
|
|
|
UserlandTest: UserlandTest.cpp ../lib/zstd/libzstd.a
|
2017-04-04 18:53:22 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(CFLAGS) $(CPPFLAGS) $^ googletest/build/googlemock/gtest/libgtest.a googletest/build/googlemock/gtest/libgtest_main.a -o $@
|
|
|
|
|
2017-05-16 19:56:38 +00:00
|
|
|
../lib/zstd/xxhash.o: ../lib/zstd/xxhash.c
|
|
|
|
$(CC) $(CFLAGS) -c $^ -o $@
|
|
|
|
|
|
|
|
../../../lib/common/xxhash.o: ../../../lib/common/xxhash.c
|
|
|
|
$(CC) $(CFLAGS) -c $^ -o $@
|
|
|
|
|
|
|
|
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-04-04 18:53:22 +00: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-04-04 23:30:11 +00:00
|
|
|
$(RM) -f *.{o,a} ../lib/zstd/*.{o,a}
|