#  Generic makefile for display, animate, montage, and import for
#  computers that do not have xmkmf.
#
#  Copyright 1994 E. I. du Pont de Nemours & Company
#
#  Permission to use, copy, modify, distribute, and sell this software and
#  its documentation for any purpose is hereby granted without fee,
#  provided that the above Copyright notice appear in all copies and that
#  both that Copyright notice and this permission notice appear in
#  supporting documentation, and that the name of E. I. du Pont de Nemours
#  & Company not be used in advertising or publicity pertaining to
#  distribution of the software without specific, written prior
#  permission.  E. I. du Pont de Nemours & Company makes no representations
#  about the suitability of this software for any purpose.  It is provided
#  "as is" without express or implied warranty.
#
#  E. I. du Pont de Nemours & Company disclaims all warranties with regard
#  to this software, including all implied warranties of merchantability
#  and fitness, in no event shall E. I. du Pont de Nemours & Company be
#  liable for any special, indirect or consequential damages or any
#  damages whatsoever resulting from loss of use, data or profits, whether
#  in an action of contract, negligence or other tortious action, arising
#  out of or in connection with the use or performance of this software.
#

# If your system does not have /usr/include/dirent.h, define NoDIRENT.
#
#DIRENT_DEFINES= -DNoDIRENT

#
# Uncomment the following lines if you have the JPEG, TIFF, or XPM  libraries.
# See README for more details.
#
#JPEG_DEFINES= -DHasJPEG
#JPEG_INCLUDES= -I../jpeg
#JPEG_LIBRARIES= -Ljpeg -ljpeg
#TIFF_DEFINES= -DHasTIFF
#TIFF_INCLUDES= -I../tiff/libtiff
#TIFF_LIBRARIES= -Ltiff/libtiff -ltiff
#XPM_DEFINES= -DHasXPM
#XPM_INCLUDES= -I../xpm
#XPM_LIBRARIES= -Lxpm -lXpm

MAGICK_INCLUDES= -Imagick
MAGICK_LIBRARIES= -Lmagick -lMagick
X_INCLUDES= -I/usr/local/include
X_LIBRARIES= -L/usr/local/lib -lX11

CC= cc -O -I/usr/include/X11R5
DESTDIR= /usr/bin/X11
INSTALL = install -c
RM= /bin/rm -f

DEFINES= $(MAGICK_INCLUDES) $(DIRENT_DEFINES) $(JPEG_DEFINES) $(JPEG_INCLUDES)\
  $(TIFF_DEFINES) $(TIFF_INCLUDES) $(XPM_DEFINES) $(XPM_INCLUDES) $(X_INCLUDES)
SYS_LIBRARIES= $(MAGICK_LIBRARIES) $(JPEG_LIBRARIES) $(TIFF_LIBRARIES) \
  $(XPM_LIBRARIES) $(X_LIBRARIES) -lm

DisplayObjects= display.o
ImportObjects= import.o
MontageObjects= montage.o
AnimateObjects= animate.o
ConvertObjects= convert.o
MogrifyObjects= mogrify.o
CombineObjects= combine.o
SegmentObjects= segment.o

PROGRAMS= display import montage animate convert mogrify combine segment

CFLAGS= $(DEFINES)

all: libmagick.a $(PROGRAMS)

libmagick.a: 
	(cd magick; make CFLAGS="$(CFLAGS)")

clean::
	(cd magick; make clean)

display: $(DisplayObjects)
	$(RM) $@
	$(CC) -o $@ $(DisplayObjects) $(SYS_LIBRARIES)

clean::
	$(RM) display

install:: display
	$(INSTALL) display $(DESTDIR)

import: $(ImportObjects)
	$(RM) $@
	$(CC) -o $@ $(ImportObjects) $(SYS_LIBRARIES)

clean::
	$(RM) import

install:: import
	$(INSTALL) import $(DESTDIR)

montage: $(MontageObjects)
	$(RM) $@
	$(CC) -o $@ $(MontageObjects) $(SYS_LIBRARIES)

clean::
	$(RM) montage

install:: montage
	$(INSTALL) montage $(DESTDIR)

animate: $(AnimateObjects)
	$(RM) $@
	$(CC) -o $@ $(AnimateObjects) $(SYS_LIBRARIES)

clean::
	$(RM) animate

install:: animate
	$(INSTALL) animate $(DESTDIR)

convert: $(ConvertObjects)
	$(RM) $@
	$(CC) -o $@ $(ConvertObjects) $(SYS_LIBRARIES)

clean::
	$(RM) convert

install:: convert
	$(INSTALL) convert $(DESTDIR)

mogrify: $(MogrifyObjects)
	$(RM) $@
	$(CC) -o $@ $(MogrifyObjects) $(SYS_LIBRARIES)

clean::
	$(RM) mogrify

install:: mogrify
	$(INSTALL) mogrify $(DESTDIR)

combine: $(CombineObjects)
	$(RM) $@
	$(CC) -o $@ $(CombineObjects) $(SYS_LIBRARIES)

clean::
	$(RM) combine

install:: combine
	$(INSTALL) combine $(DESTDIR)

segment: $(SegmentObjects)
	$(RM) $@
	$(CC) -o $@ $(SegmentObjects) $(SYS_LIBRARIES)

clean::
	$(RM) segment

install:: segment
	$(INSTALL) segment $(DESTDIR)

clean::
clean::
	$(RM) *.ln *.bak *.o core errs ,* *~ *.a .emacs_* make.log MakeOut

