commit 0d7fe5fcafa33313b1708fd540e7098bc1a1286e
parent 3950fb99bbc33577aa4ee27e749a8340df04853e
Author: kyle <kyle@getaddrinfo.net>
Date: Thu, 29 Oct 2015 01:25:59 -0600
instrument: move into instrument/ directory
- make this tool just like the others
- provide root makefile that compiles each subdir separately
Diffstat:
4 files changed, 45 insertions(+), 21 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,20 +0,0 @@
-CXXFLAGS += -I/usr/local/include
-CXXFLAGS += -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-CXXFLAGS += -std=c++1y -fno-rtti -g
-CXX = eg++
-
-LDLIBS += \
- -lclangFrontend -lclangDriver -lclangSerialization -lclangParse \
- -lclangSema -lclangAnalysis -lclangRewriteCore -lclangRewriteFrontend \
- -lclangEdit -lclangAST -lclangLex -lclangBasic -lclangTooling \
- -lLLVMOption -lLLVMMCParser -lLLVMTransformUtils -lLLVMMC -lLLVMBitReader \
- -lLLVMCore -lLLVMSupport \
- -lpthread -lz
-
-instrument: instrument.cpp
-
-test: instrument
- sh run_tests.sh
-
-clean:
- rm instrument
diff --git a/instrument/Makefile b/instrument/Makefile
@@ -0,0 +1,44 @@
+CXXFLAGS += -I/usr/local/include
+CXXFLAGS += -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
+CXXFLAGS += -fno-rtti -g
+CXX = eg++ -std=c++1y
+
+# clang has a circular dependencies here, use "linker group options" to avoid
+LDLIBS += \
+ -Wl,--start-group \
+ -lclangAST \
+ -lclangAnalysis \
+ -lclangBasic \
+ -lclangDriver \
+ -lclangEdit \
+ -lclangFrontend \
+ -lclangFrontendTool \
+ -lclangLex \
+ -lclangParse \
+ -lclangRewriteCore \
+ -lclangRewriteFrontend \
+ -lclangSema \
+ -lclangSerialization \
+ -lclangTooling \
+ -Wl,--end-group \
+ -lLLVMOption \
+ -lLLVMMCParser \
+ -lLLVMTransformUtils \
+ -lLLVMMC \
+ -lLLVMBitReader \
+ -lLLVMCore \
+ -lLLVMSupport \
+ -lpthread -lz
+
+BIN = instrument
+SRCS = instrument.cpp
+OBJS = $(SRCS:cpp=o)
+
+$(BIN): $(OBJS)
+ $(CXX) -o $(BIN) -L/usr/local/lib $(OBJS) $(LDLIBS)
+
+clean:
+ rm -f $(BIN) $(OBJS)
+
+depend:
+ mkdep $(CXXFLAGS) $(SRCS)
diff --git a/instrument.cpp b/instrument/instrument.cpp
diff --git a/run_tests.sh b/run_tests.sh
@@ -11,7 +11,7 @@ fi
export LD_LIBRARY_PATH="runtime"
for t in `ls tests/*/prog.c`; do
- ./instrument $t -- > $temp_file
+ ./instrument/instrument $t -- > $temp_file
dirname=`dirname ${t}`
failed=0