Skip to content

Instantly share code, notes, and snippets.

@tforgione
Last active July 26, 2016 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tforgione/88c1d2d487fbc83684a66029bcc6308e to your computer and use it in GitHub Desktop.
Save tforgione/88c1d2d487fbc83684a66029bcc6308e to your computer and use it in GitHub Desktop.
#include "cling/Interpreter/Interpreter.h"
int main(int argc, char** argv) {
const char* LLVMRESDIR = "/usr/local/"; //path to llvm resource directory
cling::Interpreter interp(argc, argv, LLVMRESDIR);
interp.declare("int p=0;");
}
SOURCES = main.cpp
OBJECTS = $(SOURCES:.cpp=.o)
TARGET = main
LIBS = -L/opt/cling/lib \
$(shell llvm-config --cxxflags --ldflags --libs all) \
-lclingInterpreter -lclingUtils -lclangFrontend \
-lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangEdit \
-lclangLex -lclangDriver -lclangCodeGen -lclangBasic -lclangAST \
-lz -pthread -ldl -ltinfo
INCLUDES = -I/opt/cling/include/
%.o: %.cpp
$(CXX) -std=c++14 -o $@ -c $< -Wall $(INCLUDES)
all: $(OBJECTS)
$(CXX) -std=c++14 -o $(TARGET) $(OBJECTS) $(LIBS) -Wall $(INCLUDES)
x: all
./$(TARGET)
clean:
rm -rf $(OBJECTS)
superclean: clean
rm -rf $(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment