CC = gcc
CFLAGS = -Wall

# If your system has Glibc
OPTIONS = -D_GNU_SOURCE -DUSE_GLIBC

# else enable macro in order to use dlsym() and RTLD_NEXT on your platform 
#OPTIONS = -D?

# Enable debug
# OPTIONS += -DDEBUG

# Human-readable output
# OPTIONS += -DHUMAN_READABLE

# If you are not running Glibc, you have to option in order to exploit loop between calloc() && dlsym()
# 1) use a dummy allocator (default option)
# 2) use a dummy allocator based on mmap() and remmap() (enable the next macro)
# More info at http://www.ercoppa.org/malloc

# If you want to recompile with -DUSE_MMAP, uncomment the next line:
# OPTIONS += -DUSE_MMAP

all: alloc-tracer.c 
	$(CC) $(CFLAGS) $(OPTIONS) -shared -fpic -o alloc-tracer.so alloc-tracer.c -ldl

clean:
	-rm alloc-tracer.so
