CC=gcc
CFLAGS=-Wall -g -O0
LDFLAGS=-static -lm

.PHONY: default
default: bin/measureRemap bin/evaluate

.PHONY: run
run: bin/measureRemap
	bin/measureRemap

bin/%: build/memlib_memoryInspect.o build/memlib_pfnInspect.o build/memlib_util.o build/%.o
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

build/memlib_%.o: memlib/%.c memlib/%.h
	-mkdir -p build
	$(CC) $(CFLAGS) -c -o $@ $(word 1, $^)

build/%.o: %.c %.h
	-mkdir -p build
	$(CC) $(CFLAGS) -c -o $@ $(word 1, $^)

.PHONY: clean
clean:
	-rm -rf build/*

.PHONY: cleanall
cleanall: clean
	-rm -f bin/*
