diff --git a/Makefile b/Makefile index 2d86af9..5779f18 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,6 @@ VERSION = 1 CC = gcc -# Location for the build files for instrumentation purposes -INST_BUILD_LOC = /home/courses/cs3214/bin/heap-visualizer/processing/build - # for benchmarking - this turns asserts off. CFLAGS = -Wall -O3 -Werror -pthread -DNDEBUG=1 # for debugging, with asserts on @@ -18,15 +15,20 @@ OBJS = $(SHARED_OBJS) mm.o MTOBJS = $(SHARED_OBJS) mmts.o GBACK_IMPL_OBJS = $(SHARED_OBJS) mm-gback-implicit.o -all: mdriver +# Variables used for instrumentation purposes +INST_BUILD_LOC = /home/courses/cs3214/bin/heap-visualizer/processing/build +CLANGFLAGS = -O3 -ggdb3 -emit-llvm -c -fPIC +LLCFLAGS = --relocation-model=pic -O3 -filetype=obj + +all: mdriver libMallocInstrumented.so mdriver: $(OBJS) $(CC) $(CFLAGS) -o mdriver $(OBJS) -minstrumented: - clang -O3 -ggdb3 -emit-llvm mm.c -c -fPIC -o mm.bc +libMallocInstrumented.so: mm.c + clang $(CLANGFLAGS) mm.c -o mm.bc LD_LIBRARY_PATH=$(INST_BUILD_LOC)/lib opt -load libLLVMMallocInjectorPass.so -mallocinjector mm.bc -o mm-instrumented.bc - llc --relocation-model=pic -O3 -filetype=obj mm-instrumented.bc -o mm-instrumented.o + llc $(LLCFLAGS) mm-instrumented.bc -o mm-instrumented.o clang -shared mm-instrumented.o $(INST_BUILD_LOC)/build-instrumentation/list-instrumented.o -o libMallocInstrumented.so # if multi-threaded implementation is attempted @@ -54,6 +56,6 @@ handin: /home/courses/cs3214/bin/submit.py p3 mm.c clean: - rm -f *~ *.o *.so *.bc mdriver libMallocInstrumented.so + rm -f *~ *.o *.so *.bc debug.txt mdriver libMallocInstrumented.so