#Makefile pour le projet
#1 seul .c ici
EXEC = shakespeare

#nom du compilo et options de compil
CC = gcc -g
CFLAGS = -Wall

#flags de compil
LDFLAGS = -Llibhash -lhash -Llibliste -lliste
INCLUDES= -Ilibhash -Ilibliste
LIBS = libhash/libhash.a libliste/libliste.a

CFILES = main.c
OBJS  = $(patsubst %.c,%.o,$(CFILES)) 

all :  $(EXEC) 

libliste/libliste.a : libliste/liste.c
	cd libliste ; make

libhash/libhash.a: libhash/hash.c
	cd libhash ; make

$(EXEC) :  $(LIBS) $(OBJS) 
	$(CC) -o $@ $(OBJS) $(LDFLAGS)

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

clean:
	rm -f *.o *~ $(EXEC)
	cd libhash ; make clean
	cd libliste ; make clean
