CCC = g++
FLAGS = -Wall -O
GALIB = ../ga
GAINCL = ..
XLIB = /usr/X11R6/lib
XINCL = /usr/X11R6/include/X11
KLIB = ../env
KINCL = ..
KENV = $(KLIB)/environnement.o $(KLIB)/monde.o
KAFF = $(KLIB)/affichage.o $(KENV)

all: genkermit xkermit kermit

tests: test_rn test_evol

test_rn: test_rn.o rn.o
	$(CCC) $(FLAGS) -o test_rn test_rn.o rn.o -lm

test_evol: gal test_evol.o evol.o rn.o environn
	$(CCC) $(FLAGS) -o test_evol test_evol.o evol.o rn.o \
	$(KENV) -I$(GAINCL) -L$(GALIB) -lga -lm

environn:
	cd $(KLIB); make environ

affich:
	cd $(KLIB); make affich

gal:
	cd $(GALIB); make

xkermit: affich xkermit.o rn.o 
	$(CCC) $(FLAGS) -o XKermit xkermit.o rn.o \
	$(KAFF) -lm -L${XLIB} -lX11

kermit: environn kermit.o rn.o 
	$(CCC) $(FLAGS) -o Kermit kermit.o rn.o \
	$(KENV) -lm

genkermit: gal environn rn.o genkermit.o evol.o
	$(CCC) $(FLAGS) -o genKermit genkermit.o rn.o evol.o \
	$(KENV) -lm -L$(GALIB) -lga

clean:
	rm -rf *.o *~ core 

# regles explicites
.SUFFIXES: .cpp .o
.cpp.o:
	$(CCC) $(FLAGS) -c $< -I$(GAINCL) -I$(KINCL)
