aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2016-12-23 20:49:34 +0000
committerbloodstalker <thabogre@gmail.com>2016-12-23 20:49:34 +0000
commit02744f56e3f7d59b9132b15f47851d5d9e766ba5 (patch)
tree930cff01065f28c93455da18690a69acd9eb9a07
parentadded the clean rule to the makefile (diff)
downloadmutator-02744f56e3f7d59b9132b15f47851d5d9e766ba5.tar.gz
mutator-02744f56e3f7d59b9132b15f47851d5d9e766ba5.zip
for different build modes, make will now return an error if the right compiler is not used for the build mode
-rw-r--r--makefile33
1 files changed, 29 insertions, 4 deletions
diff --git a/makefile b/makefile
index 293d693..62278ea 100644
--- a/makefile
+++ b/makefile
@@ -7,12 +7,18 @@ BUILD_MODE?=COV_NO_CLANG
CXX_FLAGS=$(shell $(LLVM_CONF) --cxxflags)
ifeq ($(BUILD_MODE), COV_USE)
+ifneq ($(CXX), clang++)
+$(error This build mode is only useable with clang++.)
+endif
EXTRA_CXX_FALGS=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
-std=c++11 -stdlib=libstdc++ -UNDEBUG -fprofile-instr-use=code.profdata
EXTRA_LD_FLAGS=-v tinyxml2/tinyxml2.o -fprofile-instr-use=code.profdata
endif
ifeq ($(BUILD_MODE), COV_GEN)
+ifneq ($(CXX), clang++)
+$(error This build mode is only useable with clang++.)
+endif
EXTRA_CXX_FALGS=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
-std=c++11 -stdlib=libstdc++ -UNDEBUG -fprofile-instr-generate
EXTRA_LD_FLAGS=-v tinyxml2/tinyxml2.o -fprofile-instr-generate
@@ -20,6 +26,9 @@ endif
#for gcov compatibility
ifeq ($(BUILD_MODE), COV_GNU)
+ifneq ($(CXX), clang++)
+$(error This build mode is only useable with clang++.)
+endif
EXTRA_CXX_FALGS=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
-std=c++11 -stdlib=libstdc++ -UNDEBUG -fprofile-arcs -ftest-coverage
EXTRA_LD_FLAGS=-v tinyxml2/tinyxml2.o -fprofile-arcs -ftest-coverage
@@ -32,12 +41,18 @@ EXTRA_LD_FLAGS=-v tinyxml2/tinyxml2.o
endif
ifeq ($(BUILD_MODE), COV_NO_CLANG_1Z)
+ifneq ($(CXX), clang++)
+$(error This build mode is only useable with clang++.)
+endif
EXTRA_CXX_FALGS=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
-std=c++1z -stdlib=libstdc++ -UNDEBUG
EXTRA_LD_FLAGS=-v tinyxml2/tinyxml2.o
endif
ifeq ($(BUILD_MODE), GNU_MODE)
+ifneq ($(CXX), g++)
+$(error This build mode is only useable with g++.)
+endif
EXTRA_CXX_FALGS=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include -I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
-std=c++11 -stdlib=libstdc++ -UNDEBUG
EXTRA_LD_FLAGS=-v tinyxml2/tinyxml2.o
@@ -82,7 +97,17 @@ clean:
rm -f *.o *~ $(TARGET0) $(TARGET) $(TARGET2)
help:
- @echo 'there is help.'
- @echo 'all is the default.'
- @echo 'clean.'
- @echo 'press tab for more targets if you have zsh!'
+ @echo '- There is help.'
+ @echo '- All is the default.'
+ @echo '- Clean.'
+ @echo '- You can use the target names as build targets to just build one executable.'
+ @echo '- LLVM_CONF will tell the makefile the name of llvm-config. llvm-config is the default.'
+ @echo '- CXX will let you set the compiler. currently the only accepted values are clang++ and g++. clang++ is the default.'
+ @echo '- BUILD_MODE will let you choose to build for different coverage formats. the default is COV_NO_CLANG. the supported values are:'
+ @echo ' COV_USE: adds the clang -fprofile-instr-use option(clang++ only mode).'
+ @echo ' COV_GEN: adds the clang -fprofile-instr-generate option(clang++ only mode).'
+ @echo ' COV_GNU: generates coverage for the build compatible with gcov(clang++ only mode).'
+ @echo ' COV_NO_CLANG: this build mode will not support any coverage format and is meant to be used with clang++(clang++ only mode).'
+ @echo ' COV_NO_CLANG_1Z: does not instrument the code for any coverage and uses -std=c++1z (clang++ only mode).'
+ @echo ' GNU_MODE: meant to be used for builds with g++. supports no coverage(g++ only mode).'
+ @echo '- Press tab for more targets if you have zsh!'