# Makefile
# Available feature macros
# NDEBUG => disable the debug function

CC = c99
CFLAGS = -Wall -g -finline-functions -DNDEBUG
# CFLAGS = -Wall -m32 -g -finline-functions
# CFLAGS = -Wall -g -m32 -DNDEBUG -O3
# CFLAGS = -Wall -g
LIBFLAGS = -lz

TARGETS = gr2gz sieve qg gz2gr independent sieve2 greedy grcheck gr2simple bfs degree checkG2 kpower

all: $(TARGETS)

gz2gr: common.h graph.h graph.c gz2gr.c
	$(CC) $(CFLAGS) -o gz2gr graph.c gz2gr.c $(LIBFLAGS)

gr2gz: common.h graph.h graph.c gr2gz.c
	$(CC) $(CFLAGS) -o gr2gz graph.c gr2gz.c $(LIBFLAGS)

sieve: common.h graph.h graph.c bucket.c bucket.h queue.c queue.h main.c
	$(CC) $(CFLAGS) -DSIEVE -o sieve graph.c bucket.c queue.c main.c $(LIBFLAGS)

sieve2: common.h graph.h graph.c bucket.c bucket.h queue.c queue.h main.c
	$(CC) $(CFLAGS) -DSIEVE2 -o sieve2 graph.c bucket.c queue.c main.c $(LIBFLAGS)

qg: common.h graph.h graph.c bucket.c bucket.h queue.c queue.h main.c
	$(CC) $(CFLAGS) -o qg graph.c bucket.c queue.c main.c $(LIBFLAGS)

independent: common.h graph.h graph.c bucket.c bucket.h queue.c queue.h independent.c
	$(CC) $(CFLAGS) -o independent graph.c bucket.c queue.c independent.c $(LIBFLAGS)

greedy: common.h graph.h graph.c bucket.c bucket.h queue.c queue.h greedy.c
	$(CC) $(CFLAGS) -o greedy graph.c bucket.c queue.c greedy.c $(LIBFLAGS)

grcheck: common.h graph.h graph.c grcheck.c
	$(CC) $(CFLAGS) -o grcheck graph.c grcheck.c $(LIBFLAGS)

gr2simple: common.h graph.h graph.c gr2simple.c
	$(CC) $(CFLAGS) -o gr2simple graph.c gr2simple.c $(LIBFLAGS)

bfs: common.h graph.h graph.c queue.h queue.c bfs.c
	$(CC) $(CFLAGS) -o bfs graph.c queue.c bfs.c $(LIBFLAGS)

degree: common.h graph.h graph.c degree.c
	$(CC) $(CFLAGS) -o degree graph.c degree.c $(LIBFLAGS)

checkG2: common.h graph.h graph.c checkG2.c
	$(CC) $(CFLAGS) -o checkG2 graph.c checkG2.c $(LIBFLAGS)

kpower: common.h graph.h graph.c queue.h queue.c kpower.c
	$(CC) $(CFLAGS) -o kpower graph.c queue.c kpower.c $(LIBFLAGS)

clean:
	-rm -f $(TARGETS)
