simdjson/Makefile

91 lines
3.8 KiB
Makefile
Raw Normal View History

2018-03-23 12:05:32 +08:00
.SUFFIXES:
#
.SUFFIXES: .cpp .o .c .h
.PHONY: clean cleandist
2018-11-21 03:09:43 +08:00
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11
2018-11-10 10:31:14 +08:00
ifeq ($(SANITIZE),1)
2018-11-21 00:56:10 +08:00
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
else
CXXFLAGS += -O3
2018-11-10 10:31:14 +08:00
endif
2018-10-24 08:19:33 +08:00
EXECUTABLES=parse jsoncheck numberparsingcheck stringparsingcheck minifiercompetition parsingcompetition minify allparserscheckfile
2018-03-23 12:05:32 +08:00
HEADERS= include/jsonparser/simdutf8check.h include/jsonparser/stringparsing.h include/jsonparser/numberparsing.h include/jsonparser/jsonparser.h include/jsonparser/common_defs.h include/jsonparser/jsonioutil.h benchmark/benchmark.h benchmark/linux/linux-perf-events.h include/jsonparser/simdjson_internal.h include/jsonparser/stage1_find_marks.h include/jsonparser/stage2_flatten.h include/jsonparser/stage34_unified.h include/jsonparser/jsoncharutils.h
2018-09-26 13:22:55 +08:00
LIBFILES=src/jsonioutil.cpp src/jsonparser.cpp src/stage1_find_marks.cpp src/stage2_flatten.cpp src/stage34_unified.cpp
MINIFIERHEADERS=include/jsonparser/jsonminifier.h include/jsonparser/simdprune_tables.h
2018-08-21 05:40:50 +08:00
MINIFIERLIBFILES=src/jsonminifier.cpp
2018-03-23 12:05:32 +08:00
2018-08-21 05:27:25 +08:00
RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
2018-09-28 12:00:52 +08:00
SAJSON_INCLUDE:=dependencies/sajson/include
2018-11-21 03:09:43 +08:00
JSON11_INCLUDE:=dependencies/json11/json11.hpp
2018-07-29 08:18:56 +08:00
2018-09-28 12:00:52 +08:00
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE)
all: $(LIBS) $(EXECUTABLES)
2018-10-24 08:19:33 +08:00
test: jsoncheck numberparsingcheck stringparsingcheck
./numberparsingcheck
./stringparsingcheck
./jsoncheck
2018-10-24 08:19:33 +08:00
@echo
@tput setaf 2
@echo "It looks like the code is good!"
@tput sgr0
2018-03-23 12:05:32 +08:00
2018-09-28 12:00:52 +08:00
$(SAJSON_INCLUDE):
git submodule update --init --recursive
2018-08-21 05:27:25 +08:00
$(RAPIDJSON_INCLUDE):
git submodule update --init --recursive
2018-11-21 03:09:43 +08:00
$(JSON11_INCLUDE):
git submodule update --init --recursive
2018-08-21 05:27:25 +08:00
bench: benchmarks/bench.cpp $(RAPIDJSON_INCLUDE) $(HEADERS)
$(CXX) -std=c++11 -O3 -o $@ benchmarks/bench.cpp -I$(RAPIDJSON_INCLUDE) -Iinclude -march=native -lm -Wall -Wextra -Wno-narrowing
2018-08-21 02:45:51 +08:00
parse: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o parse $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
jsoncheck:tests/jsoncheck.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o jsoncheck $(LIBFILES) tests/jsoncheck.cpp -I. $(LIBFLAGS)
numberparsingcheck:tests/numberparsingcheck.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o numberparsingcheck tests/numberparsingcheck.cpp src/jsonioutil.cpp src/jsonparser.cpp src/stage1_find_marks.cpp src/stage2_flatten.cpp -I. $(LIBFLAGS) -DJSON_TEST_NUMBERS
2018-10-24 08:19:33 +08:00
stringparsingcheck:tests/stringparsingcheck.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o stringparsingcheck tests/stringparsingcheck.cpp src/jsonioutil.cpp src/jsonparser.cpp src/stage1_find_marks.cpp src/stage2_flatten.cpp -I. $(LIBFLAGS) -DJSON_TEST_STRINGS
2018-08-21 05:40:50 +08:00
minifiercompetition: benchmark/minifiercompetition.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
$(CXX) $(CXXFLAGS) -o minifiercompetition $(LIBFILES) $(MINIFIERLIBFILES) benchmark/minifiercompetition.cpp -I. $(LIBFLAGS)
2018-08-21 05:27:25 +08:00
2018-09-28 12:00:52 +08:00
minify: tools/minify.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
$(CXX) $(CXXFLAGS) -o minify $(MINIFIERLIBFILES) $(LIBFILES) tools/minify.cpp -I.
2018-08-21 05:27:25 +08:00
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS)
2018-10-18 00:00:44 +08:00
allparserscheckfile: tests/allparserscheckfile.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o allparserscheckfile $(LIBFILES) tests/allparserscheckfile.cpp -I. $(LIBFLAGS)
2018-03-23 12:05:32 +08:00
2018-08-21 02:45:51 +08:00
parsehisto: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o parsehisto benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS) -DBUILDHISTOGRAM
2018-07-30 01:09:47 +08:00
2018-03-23 12:05:32 +08:00
clean:
2018-07-29 06:28:50 +08:00
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
2018-03-23 12:05:32 +08:00
cleandist:
2018-07-29 06:28:50 +08:00
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)