PROG=Opgave2_VanVeen_Kroes

MKDIR=mkdir
PACK=tar -czvf
CC=gcc
LFLAGS=-lm
CP=cp
RM=rm -rf

CFLAGS = -std=c99 -pedantic -Wall -Wextra -lm

ifdef DEBUG
CFLAGS += -g -ggdb -DDEBUG 
else
CFLAGS += -g0 -O3
endif

ifdef PROFILE
CFLAGS += -pg
endif

scheduler: scheduler.o mt19937ar.o simul.o mem_alloc.o
	$(CC) $(CFLAGS) $(LFLAGS) -o $@ $^

clean:
	rm -f scheduler.o scheduler $(PROG).tar.gz
	rm -Rf logs/
	rm -Rf $(PROG)/

tarball:
	$(MAKE) clean
	$(MKDIR) $(PROG)
	$(CP) * report/report.pdf $(PROG) 2> /dev/null || true
	$(PACK) $(PROG).tar.gz $(PROG)/*
	$(RM) $(PROG)

%.o: %.c
	$(CC) -c $(CFLAGS) -o $@ $<

scheduler.o: scheduler.h
mt19937ar.o: mt19937.h
mem_alloc.o: mem_alloc.h
