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


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

# Indiquer le compilateur (cc ou gcc)
CC=/opt/gnu/bin/gcc

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


# Options de compilation. 
#CFLAGS=  ${INCLUDES} -ggdb -Wall -c
CFLAGS= ${INCLUDES}\
	-O6 \
	-ffast-math \
	-fstrength-reduce \
	-fdelayed-branch \
	-fexpensive-optimizations \
	-fomit-frame-pointer -c

# Options pour le linker.
LFLAGS=  -ggdb


# Les librairies avec lesquelle on va effectueller l'edition de liens
LIBDIRS=-L/usr/lib/openwin -L/usr/dt/lib -L/usr/openwin/lib -L../ImageMagick/magick -L../ImageMagick/jpeg
LIBS= $(LIBDIRS) -lm -lXm -lXt -lX11 -lXext -lMagick -ljpeg

# Les fIchiers sources de l'application
FILES=main.c object.c fileCB.c surfCB.c interface.c graphics.c matrix.c color.c line_command_options.c \
      zbuff.c vimage.c creation.c implicit.c texture.c pr_time.c

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

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

clean:
	/bin/rm -f $(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

interface.o: interface.c interface.h

object.o: object.c object.h

fileCB.o: fileCB.c fileCB.h object.h vimage.h graphics.h

surfCB.o: surfCB.c surfCB.h creation.h object.h graphics.h

graphics.o: graphics.c graphics.h zbuff.h object.h color.h param.h vimage.h creation.h implicit.h texture.h

matrix.o: matrix.c matrix.h 

color.o: color.c color.h

zbuff.o: zbuff.c zbuff.h color.h object.h vimage.h texture.h 

vimage.o: vimage.c vimage.h color.h

creation.o: creation.c creation.h matrix.h object.h vimage.h

implicit.o: implicit.c implicit.h object.h matrix.h object.h

texture.o: texture.c texture.h object.h color.h vimage.h

line_command_options.o: line_command_options.c line_command_options.h

pr_time.o: pr_time.c

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

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

