# 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} -g -Wall -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=  -g
#LFLAGS= -o 

# Les librairies avec lesquelle on va effectueller l'edition de liens
LIBDIRS=-L/usr/openwin/lib
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 light.c Tracage.c

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

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

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

#-----------------------------------------------------------------------------
# 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

Tracage.o: Tracage.c Tracage.h object.h

graphics.o: graphics.c graphics.h object.h Tracage.h

matrix.o: matrix.c matrix.h

color.o: color.c

line_command_options.o: line_command_options.c

light.o: light.c light.h

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

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

