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


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

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

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

# Options de compilation. Mettre -ggdb (gcc) ou -g pour debugger
CFLAGS=  ${INCLUDES} -ggdb -Wall -c

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

# Les librairies avec lesquelle on va effectueller l'edition de liens
LIBDIRS=-L/usr/openwin/lib -L/usr/dt/lib
LIBS= $(LIBDIRS) -lXm -lXt -lX11 

# Les fichiers sources de l'application
FILES=menu_cascade.c

FILES1=menu_pull.c

# Les fichiers sources de l'application
FILES_bitmaps=bitmaps.c
FILES_bitmaps_included=bitmaps_included.c
FILES_double_buffering=double_buffering.c
FILES_xmainwindow=xmainwindow.c
FILES_dialog1= dialog1.c
FILES_dialog2= dialog2.c

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

all: menu_cascade menu_pull bitmaps bitmaps_included double_buffering \
	xmainwindow dialog1 dialog2

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

menu_pull:  $(FILES1:.c=.o)
	$(CC) $(LFLAGS) menu_pull $(FILES1:.c=.o) ${LIBS}

xmainwindow:  $(FILES_xmainwindow:.c=.o)
	$(CC) $(LFLAGS) xmainwindow $(FILES_xmainwindow:.c=.o) ${LIBS}

bitmaps:  $(FILES_bitmaps:.c=.o)
	$(CC) $(LFLAGS) bitmaps $(FILES_bitmaps:.c=.o) ${LIBS}

bitmaps_included:  $(FILES_bitmaps_included:.c=.o)
	$(CC) $(LFLAGS) bitmaps_included $(FILES_bitmaps_included:.c=.o) ${LIBS}

double_buffering:  $(FILES_double_buffering:.c=.o)
	$(CC) $(LFLAGS) double_buffering $(FILES_double_buffering:.c=.o) ${LIBS}

dialog1:  $(FILES_dialog1:.c=.o)
	$(CC) $(LFLAGS) dialog1 $(FILES_dialog1:.c=.o) ${LIBS}

dialog2:  $(FILES_dialog2:.c=.o)
	$(CC) $(LFLAGS) dialog2 $(FILES_dialog2:.c=.o) ${LIBS}
clean:
	/bin/rm -f *.o menu_cascade menu_pull bitmaps bitmaps_included xmainwindow


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

menu_cascade.o: menu_cascade.c

menu_pull.o: menu_pull.c

xmainwindow.o: xmainwindow.c

dialog1.o: dialog1.c

dialog2.o : dialog2.c

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

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

