# differents types de fichiers 
.SUFFIXES:.o.c


#---------------------------------
# INITIALISATION DES VARIABLES 
#---------------------------------

# Indiquer le compilateur (cc ou gcc)
CC=gcc

# Les chemins ou se trouvent les fichiers a inclure
INCLUDES=-I/usr/openwin/include


# Options de compilation. Mettre -ggdb (gcc) ou -g pour debugger
CFLAGS=  ${INCLUDES} -ggdb -c
#CFLAGS = ${INCLUDES} -O2 -ffast-math -fstrength-reduce -fdelayed-branch \
#	-fexpensive-optimizations -fomit-frame-pointer -c

# Options pour le linker. Mettre -g -static (gcc) ou -g -Bstatic (cc) pour
# debugger
LFLAGS=  -ggdb
#LFLAGS= -o 

# Les librairies avec lesquelle on va effectueller l'edition de liens
LIBDIRS=
LIBS= $(LIBDIRS) -lm -lX11 -lXext

# Les fIchiers sources de l'application
FILES=main.c object.c graphics.c matrix.c color.c \
      line_command_options.c virtualball.c light.c psb_draw.c

#-----------
# LES CIBLES
#-----------

visu:  $(FILES:.c=.o)
	$(CC) $(LFLAGS) -o visu $(FILES:.c=.o) ${LIBS}

clean:
	/bin/rm $(FILES:.c=.o) visu

#-----------------------------------------------------------------------------
# LES REGLES DE DEPENDANCE. Certaines sont implicites mais je recommande d'en 
# mettre une par fichier source. 
#-----------------------------------------------------------------------------

main.o: main.c graphics.h

object.o: object.c object.h

graphics.o: graphics.c graphics.h psb_draw.c psb_draw.h

matrix.o: matrix.c matrix.h

virtual_ball.o: virtual_ball.c matrix.h object.h

light.o: light.h matrix.h object.h

color.o: color.c

line_command_options.o: line_command_options.c

psb_draw.o: psb_draw.c psb_draw.h object.h

#---------------------------------
# REGLES DE COMPILATION IMPLICITES
#---------------------------------

.c.o:; ${CC} ${CFLAGS} $*.c

