Allows additional C(XX)FLAGS to be passed through command line (#142)

* Allow passing additional compiler flags through command line

* Simplify branching for compiler flags

* Optimize for debug while debugging or sanitizing specified
This commit is contained in:
Emil Gedda
2019-04-17 04:07:03 +02:00
committed by Daniel Lemire
parent d4c03ce6cf
commit f4a06036c6
+8 -11
View File
@@ -7,19 +7,16 @@
.PHONY: clean cleandist
COREDEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/cJSON -Idependencies/jsmn
EXTRADEPSINCLUDE = -Idependencies/jsoncppdist -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
CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
CXXFLAGS := $(CXXFLAGS) -std=c++17 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -O3
CFLAGS := $(CFLAGS) -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src -O3
ifeq ($(SANITIZE),1)
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
CFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
else
ifeq ($(DEBUG),1)
CXXFLAGS += -g3 -O0
CFLAGS += -g3 -O0
else
CXXFLAGS += -O3
CFLAGS += -O3
CXXFLAGS += -g3 -Og -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
CFLAGS += -g3 -Og -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
endif
ifeq ($(DEBUG),1)
CXXFLAGS += -g3 -Og
CFLAGS += -g3 -Og
endif
MAINEXECUTABLES=parse minify json2json jsonstats statisticalmodel