aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cgrep.cpp24
-rw-r--r--makefile15
-rw-r--r--pch.hpp20
3 files changed, 31 insertions, 28 deletions
diff --git a/cgrep.cpp b/cgrep.cpp
index 1c4ab3f..e09ad63 100644
--- a/cgrep.cpp
+++ b/cgrep.cpp
@@ -7,30 +7,8 @@
* */
/*************************************************************************************************/
/*included modules*/
-/*project headers*/
+#include "./pch.hpp"
#include "./cfe-extra/cfe_extra.h"
-/*standard headers*/
-#include <cassert>
-#include <cstdlib>
-#include <dirent.h>
-#include <fstream>
-#include <iostream>
-#include <regex>
-#include <string>
-#include <vector>
-/*LLVM headers*/
-#include "clang/AST/AST.h"
-#include "clang/AST/ASTConsumer.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
-#include "clang/Basic/LLVM.h"
-#include "clang/Frontend/CompilerInstance.h"
-#include "clang/Frontend/FrontendActions.h"
-#include "clang/Lex/Lexer.h"
-#include "clang/Rewrite/Core/Rewriter.h"
-#include "clang/Tooling/CommonOptionsParser.h"
-#include "clang/Tooling/Tooling.h"
-#include "llvm/Support/raw_ostream.h"
/*************************************************************************************************/
/*used namespaces*/
using namespace llvm;
diff --git a/makefile b/makefile
index 289d775..5ffe346 100644
--- a/makefile
+++ b/makefile
@@ -28,7 +28,8 @@ LLVM_CONF?=llvm-config
LLVM_CXX_FLAGS=$(shell $(LLVM_CONF) --cxxflags)
LLVM_CXX_FLAGS+=-I$(shell $(LLVM_CONF) --src-root)/tools/clang/include\
-I$(shell $(LLVM_CONF) --obj-root)/tools/clang/include\
- -stdlib=libstdc++ -std=c++17 -fexceptions
+ -std=c++17 -fexceptions
+#LLVM_LD_FLAGS=-Wl,--start-group $(shell $(LLVM_CONF) --libs) -Wl, --end-group
LLVM_LD_FLAGS=-Wl,--start-group -lclangAST -lclangAnalysis -lclangBasic\
-lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool\
-lclangLex -lclangParse -lclangSema -lclangEdit -lclangASTMatchers\
@@ -75,7 +76,7 @@ LD_FLAGS+=$(EXTRA_LD_FLAGS)
.PHONY:all clean help ASM SO TAGS
-all:$(TARGET)
+all: pch.hpp.gch $(TARGET)
everything:$(TARGET) A ASM SO $(TARGET)-dbg TAGS $(TARGET)-cov
@@ -89,8 +90,8 @@ depend:.depend
-include ./.depend
-.cpp.o:
- $(CXX) $(CXX_FLAGS) -c $< -o $@
+%.o:%.cpp
+ $(CXX) -include-pch pch.hpp.gch $(CXX_FLAGS) -c $< -o $@
%.odbg:%.cpp
$(CXX) $(CXX_FLAGS) -g -c $< -o $@
@@ -98,6 +99,9 @@ depend:.depend
%.ocov:%.cpp
$(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@
+pch.hpp.gch: pch.hpp
+ $(CXX) $(CXX_FLAGS) -c $< -o $@
+
./cfe-extra/cfe_extra.o:./cfe-extra/cfe_extra.cpp
$(CXX) $(CXX_FLAGS) -c $< -o $@
@@ -162,12 +166,13 @@ format:
- clang-format -i $(SRCS) $(HDRS)
clean:
- rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov ./keccak-tiny/*.o ./keccak-tiny/*.ocov ./keccak-tiny/*.odbg
+ rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov
deepclean: clean
- rm tags
- rm .depend
- $(MAKE) -C ./cfe-extra clean
+ - rm *.gch
help:
@echo "--all is the default target, runs $(TARGET) target"
diff --git a/pch.hpp b/pch.hpp
new file mode 100644
index 0000000..6923390
--- /dev/null
+++ b/pch.hpp
@@ -0,0 +1,20 @@
+#include <cassert>
+#include <cstdlib>
+#include <dirent.h>
+#include <fstream>
+#include <iostream>
+#include <regex>
+#include <string>
+#include <vector>
+#include "clang/AST/AST.h"
+#include "clang/AST/ASTConsumer.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Basic/LLVM.h"
+#include "clang/Frontend/CompilerInstance.h"
+#include "clang/Frontend/FrontendActions.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Rewrite/Core/Rewriter.h"
+#include "clang/Tooling/CommonOptionsParser.h"
+#include "clang/Tooling/Tooling.h"
+#include "llvm/Support/raw_ostream.h"