CC	= g++
LD      = $(CC)
ifeq ($(DEBUG),1)
CFLAGS	= -g
else
CFLAGS	= -O6 -march=native -mtune=native
endif
CCOPTS  = -c $(CFLAGS) -Wall -pedantic -fpermissive -ansi -I/usr/include/X11 -DLINUX -D_BSD_SOURCE -D_XOPEN_SOURCE
LDOPTS	=
OBJS	= mandel.o child.o util.o EditField.o Rubberband.o ppm.o \
		about.o callback.o fselect.o message.o option.o quit.o size.o
OBJS1	= mandel-calc.o iter.o util.o

all    : mandel mandel-calc

mandel : $(OBJS)
	$(LD) $(LDOPTS) $(OBJS) -o mandel -L/usr/X11R6/lib -lXaw3d -lXt -lX11 -lm

mandel-calc : $(OBJS1)
	$(LD) $(LDOPTS) $(OBJS1) -o mandel-calc -lm

.c.o     :
	$(CC) $(CCOPTS) $<

clean	:
	rm -f core *.o mandel mandel-calc

mandel.o :  dialog.h EditField.h Rubberband.h mdefs.h mandel.h mandel.c
mandel-calc.o :  mdefs.h mandel.h mandel-calc.c
child.o  :  mdefs.h mandel.h child.c
compand.o : mdefs.h mandel.h compand.c
mconfig.o : mandel.h mconfig.c
mutils.o :  mdefs.h mandel.h mutils.c
mselect.o : mdefs.h mandel.h mselect.c
mouse.o :   mouse.c
mtrans.o :  mdefs.h mtrans.c
iter.o :    mdefs.h mandel.h iter.c
	$(CC) -c -O3 -fpermissive -fomit-frame-pointer -Wall -I/usr/include/X11 -DLINUX $*.c
EditField.o : EditField.h EditField.c
Rubberband.o : Rubberband.h Rubberband.c
ppm.o :     mandel.h ppm.c
about.o :   about.c
message.o : message.c
option.o :  EditField.h mandel.h option.c
quit.o :    quit.c
size.o :    EditField.h mandel.h size.c
fselect.o : EditField.h dialog.h mandel.h fselect.c

