simdjson/Makefile

137 lines
5.7 KiB
Makefile
Raw Normal View History

2018-03-23 12:05:32 +08:00
.SUFFIXES:
#
.SUFFIXES: .cpp .o .c .h
.PHONY: clean cleandist
2018-12-15 10:32:42 +08:00
COREDEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include
EXTRADEPSINCLUDE = -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include -Idependencies/gason/src -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
CXXFLAGS = -std=c++17 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux
2018-11-21 05:43:22 +08:00
CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
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
2018-11-21 05:43:22 +08:00
CFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
2018-12-12 06:20:29 +08:00
else
ifeq ($(DEBUG),1)
CXXFLAGS += -g3 -O0
CFLAGS += -g3 -O0
2018-11-21 00:56:10 +08:00
else
CXXFLAGS += -O3
2018-11-21 05:43:22 +08:00
CFLAGS += -O3
2018-11-10 10:31:14 +08:00
endif
2018-12-12 06:20:29 +08:00
endif
2018-11-10 10:31:14 +08:00
2018-12-07 06:22:22 +08:00
MAINEXECUTABLES=parse minify json2json
2018-12-01 11:02:32 +08:00
TESTEXECUTABLES=jsoncheck numberparsingcheck stringparsingcheck
2018-12-15 10:32:42 +08:00
COMPARISONEXECUTABLES=minifiercompetition parsingcompetition parseandstatcompetition distinctuseridcompetition allparserscheckfile
2018-03-23 12:05:32 +08:00
2018-11-30 22:37:57 +08:00
HEADERS= include/simdjson/simdutf8check.h include/simdjson/stringparsing.h include/simdjson/numberparsing.h include/simdjson/jsonparser.h include/simdjson/common_defs.h include/simdjson/jsonioutil.h benchmark/benchmark.h benchmark/linux/linux-perf-events.h include/simdjson/parsedjson.h include/simdjson/stage1_find_marks.h include/simdjson/stage2_flatten.h include/simdjson/stage34_unified.h include/simdjson/jsoncharutils.h include/simdjson/jsonformatutils.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
2018-11-30 22:37:57 +08:00
MINIFIERHEADERS=include/simdjson/jsonminifier.h include/simdjson/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-11-21 03:32:12 +08:00
FASTJSON_INCLUDE:=dependencies/include/fastjson/fastjson.h
2018-11-21 05:43:22 +08:00
GASON_INCLUDE:=dependencies/gason/src/gason.h
UJSON4C_INCLUDE:=dependencies/ujson4c/src/ujdecode.c
2018-07-29 08:18:56 +08:00
2018-11-21 05:43:22 +08:00
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE)
2018-12-15 10:32:42 +08:00
EXTRAOBJECTS=ujdecode.o
2018-12-01 11:02:32 +08:00
all: $(MAINEXECUTABLES)
2018-12-15 10:32:42 +08:00
competition: $(COMPARISONEXECUTABLES)
2018-12-15 10:50:55 +08:00
.PHONY: benchmark test
benchmark:
bash ./scripts/parser.sh
bash ./scripts/parseandstat.sh
2018-10-24 08:19:33 +08:00
test: jsoncheck numberparsingcheck stringparsingcheck
./numberparsingcheck
./stringparsingcheck
./jsoncheck
2018-12-07 06:22:22 +08:00
./scripts/testjson2json.sh
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
2018-11-21 03:32:12 +08:00
$(FASTJSON_INCLUDE):
git submodule update --init --recursive
2018-08-21 05:27:25 +08:00
2018-11-21 05:43:22 +08:00
$(GASON_INCLUDE):
git submodule update --init --recursive
$(UJSON4C_INCLUDE):
git submodule update --init --recursive
2018-08-21 05:27:25 +08:00
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)
2018-12-15 10:32:42 +08:00
$(CXX) $(CXXFLAGS) -o minifiercompetition $(LIBFILES) $(MINIFIERLIBFILES) benchmark/minifiercompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE)
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-12-07 06:22:22 +08:00
json2json: tools/json2json.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o json2json $ tools/json2json.cpp $(LIBFILES) -I.
2018-11-21 05:43:22 +08:00
ujdecode.o: $(UJSON4C_INCLUDE)
$(CC) $(CFLAGS) -c dependencies/ujson4c/src/ujdecode.c
2018-12-15 10:32:42 +08:00
parseandstatcompetition: benchmark/parseandstatcompetition.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o parseandstatcompetition $(LIBFILES) benchmark/parseandstatcompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE)
distinctuseridcompetition: benchmark/distinctuseridcompetition.cpp $(HEADERS) $(LIBFILES)
$(CXX) $(CXXFLAGS) -o distinctuseridcompetition $(LIBFILES) benchmark/distinctuseridcompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE)
2018-12-12 11:39:39 +08:00
2018-12-15 10:32:42 +08:00
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES) $(EXTRAOBJECTS)
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp $(EXTRAOBJECTS) -I. $(LIBFLAGS) $(COREDEPSINCLUDE) $(EXTRADEPSINCLUDE)
2018-08-21 05:27:25 +08:00
2018-12-15 10:32:42 +08:00
allparserscheckfile: tests/allparserscheckfile.cpp $(HEADERS) $(LIBFILES) $(EXTRAOBJECTS)
$(CXX) $(CXXFLAGS) -o allparserscheckfile $(LIBFILES) tests/allparserscheckfile.cpp $(EXTRAOBJECTS) -I. $(LIBFLAGS) $(COREDEPSINCLUDE) $(EXTRADEPSINCLUDE)
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-11-30 22:37:57 +08:00
cppcheck:
cppcheck --enable=all src/*.cpp benchmarks/*.cpp tests/*.cpp -Iinclude -I. -Ibenchmark/linux
2018-03-23 12:05:32 +08:00
clean:
2018-12-15 10:32:42 +08:00
rm -f $(EXTRAOBJECTS) $(MAINEXECUTABLES) $(EXTRA_EXECUTABLES) $(TESTEXECUTABLES) $(COMPARISONEXECUTABLES)
2018-03-23 12:05:32 +08:00
cleandist:
2018-12-15 10:32:42 +08:00
rm -f $(EXTRAOBJECTS) $(MAINEXECUTABLES) $(EXTRA_EXECUTABLES) $(TESTEXECUTABLES) $(COMPARISONEXECUTABLES)