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

.PHONY: default
default: bin/measureTiming

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

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

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

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

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