# Makefile for xv


# your C compiler (and options) of choice
#
# if compiling on a Mips machine, try this: 
#    CCOPTS = -Olimit 600 -systype bsd43

# Remember:  if you change the C compiler (to gcc, or whatever), be sure to
# do the same thing to the Makefile in the 'jpeg' and 'tiff' subdirectories

# if you want to use gcc, use these two lines
# CC = gcc
# CCOPTS = -g -O -traditional

CC = cc
CCOPTS = -O


################ CONFIGURATION OPTIONS #################

# if, for whatever reason, you're unable to get the JPEG library to compile
# on your machine, *COMMENT OUT* the following lines
#
# Also, comment out the LIBJPEG dependancy at the end of this Makefile
#
JPEG = -DHAVE_JPEG
JPEGDIR = jpeg
LIBJPEG = $(JPEGDIR)/libjpeg.a
JPEGINCLUDE = -I$(JPEGDIR)


# if, for whatever reason, you're unable to get the TIFF library to compile
# on your machine, *COMMENT OUT* the following lines
#
# Also, comment out the LIBJPEG dependancy at the end of this Makefile
#
TIFF = -DHAVE_TIFF
TIFFDIR = tiff
LIBTIFF = $(TIFFDIR)/libtiff.a
TIFFINCLUDE = -I$(TIFFDIR)


# if, for whatever reason, you're unable to get the PDS/VICAR support
# to compile (xvpds.c, and vdcomp.c), *COMMENT OUT* the following line,
# and also remove 'vdcomp' from the 'all:' dependancy 
PDS = -DHAVE_PDS


# if, for whatever reason, you don't wish to use the fsQuick software
# (which currently only affects xv's performance on a 1-bit display)
# you should comment out the following line
# (fsQuick.c contains some huge macro definitions which could break your
# C preprocessor...
FSQUICK = -DHAVE_FSQUICK


# if you are running under DXWM, I pity you.  XV doesn't work correctly
# under DXWM.  You should probably be running MWM.  However, if such is
# not a valid option for you, try uncommenting the following line.  The
# behavior won't be 'right', but it will be less 'wrong'.
#DXWM = -DDXWM


# if you are running on a SysV-based machine, such as HP, Silicon Graphics,
# etc, uncomment the following line to get you most of the way there.  
#
#UNIX = -DSVR4


# If you are running on a POSIX-compatible machine, such as an
# IBM RS/6000, you MAY need to uncomment the 'NEED_DIRENT' line.
# To determine if such is the case, do a 'man readdir' on your machine.  If
# readdir() returns a pointer to 'struct direct', you will not have
# to change anything.  If, however, readdir() returns a pointer to
# 'struct dirent', you will have to add the '-DDIRENT' to CFLAGS
#
# One note: folks using an IBM RS/6000 don't have to touch this line.  
#           I check for '6000'-hood in xv.h
#
#NEED_DIRENT = -DDIRENT


#
# for UMAX V by Encore Computers uncomment the following line for
# the portable c compiler, system specific definitions and
# location of local X11 library(if site specific, modify -L option)
# No other switches should be necessary
#
#UMAX =  -q extensions=pcc_c -D__UMAXV__ -L/usr2/usr/lib/X11 -DSVR4 -DDIRENT


# If your machine doesn't have the 'strchr', 'memset' and 'memcpy' functions,
# but does have 'bcopy', uncomment the following line.  (And get a better 
# operating system!)
#
#USEMEM = -DNEED_MEMROUTINES

# if your machine doesn't have 'random()', but does have 'rand(),
# uncomment the following line:
#
#RAND = -DNO_RANDOM

# IF YOUR MACHINE DOESN'T HAVE 'vprintf()' OR 'vsprintf()'
#
# Vax BSD and IBM AOS don't have vprintf or vsprintf.
# Note that our local library versions of sprintf have been updated
# to return int, the number of characters in the formatted string,
# whereas the versions in stock 4.3BSD do not so return.  You may
# have to remove the "-DINTSPRINTF" below if you're compiling for
# stock 4.3BSD or for some other Vax or RT library package where
# sprintf returns char *.
#
# Also, I define NOVOID on the Vax because I'm using pcc to compile.
# If you use gcc or some other better compiler, this should not be
# necessary.  I define NOSTDHDRS on the RT because we don't have
# standard ANSI header files installed for the RT, even though the RT
# compiler claims to be ANSI-compliant.
#
#  (for BSD 4.3 VAX, uncomment the following line)
#VPRINTF = -DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOVOID
#  (for (stock) IBM RT AOS 4.3, uncomment the following line)
#VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS
#  (for Sequent running DYNIX 3.1.4, uncomment the following line)
#VPRINTF = -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS


# If your machine does not have the 'setitimer()' call, but does
# have the 'usleep()' call, uncomment the following line:
#
#TIMERS = -DUSLEEP
#
# alternately, if your machine does not have EITHER the 'setitimer()' or
# the 'usleep()' call, uncomment the following line:
#
#TIMERS = -DNOTIMER


# If you are using an AT&T machine, uncomment the following line
# If you have problems compiling xv.c and xvdir.c because of the DIR
# reference in dirent.h, append '-DATT' to the following line:
#
#ATT = -DDIRENT -DUSLEEP -DATT


# If you are using an HP running HPUX 7.0, uncomment the following line
#
#HPUX7 = -DSVR4 -DATT +Ns4000 -DHPUX7


# For SCO and ODT machines, uncomment the following:
#
#SCO = -Dsco -DPOSIX -DNOTIMER
#
# Itimers will be in 3.2v3 (yeah!) but that won't be out in the public's
# hands for a while.
#
# Also, you'll want to change LIBS to
#
#  -lX11 -lm -lsocket -lmalloc -lc -lx
#
# -lx must be after -lc so you get the right directory routines.
#

CFLAGS = $(CCOPTS) $(NEED_DIRENT) $(VPRINTF) $(TIMERS) $(ATT) \
	$(SCO) $(UNIX) $(USEMEM) $(HPUX7) $(JPEG) $(JPEGINCLUDE) \
	$(DXWM) $(UMAX) $(FSQUICK) $(RAND) $(TIFF) $(TIFFINCLUDE) $(PDS)

LIBS = -lX11 $(LIBJPEG) $(LIBTIFF) -lm

BITMAPS = bitmaps/grasp bitmaps/penn bitmaps/down bitmaps/down1 \
	  bitmaps/up bitmaps/up1 bitmaps/scrlgray bitmaps/gray50 \
	  bitmaps/gray25 bitmaps/i_fifo bitmaps/i_chr bitmaps/i_dir \
	  bitmaps/i_blk bitmaps/i_lnk bitmaps/i_sock bitmaps/i_reg \
	  bitmaps/rb_off bitmaps/rb_on bitmaps/rb_off1 bitmaps/rb_on1 \
	  bitmaps/fc_left bitmaps/fc_leftm bitmaps/fc_mid bitmaps/fc_midm \
	  bitmaps/fc_right bitmaps/fc_rightm bitmaps/fc_left1 \
	  bitmaps/fc_left1m bitmaps/fc_right1 bitmaps/fc_right1m \
	  bitmaps/icon bitmaps/dial_cw1 bitmaps/dial_cw2 bitmaps/dial_ccw1 \
	  bitmaps/dial_ccw2 bitmaps/iconmask bitmaps/gf1_addh \
	  bitmaps/gf1_delh bitmaps/gf1_line bitmaps/gf1_rst \
	  bitmaps/gf1_spln bitmaps/gf1_gamma \
	  bitmaps/h_rotl bitmaps/h_rotr bitmaps/h_sinc bitmaps/h_sdec \
	  bitmaps/h_flip bitmaps/cb_off bitmaps/cb_on bitmaps/cb_off1 \
	  bitmaps/cb_on1 bitmaps/h_sat bitmaps/h_desat bitmaps/root_weave \
          bitmaps/cboard50 bitmaps/mb_chk

OBJS = 	xv.o xvevent.o xvroot.o xvmisc.o xvimage.o xvcolor.o xvsmooth.o \
	xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o \
	xvgifwr.o xvdir.o xvbutt.o xvpbm.o xvxbm.o xvgam.o \
	xvdial.o xvgraf.o xvsunras.o xvjpeg.o xvps.o xvpopup.o xvdflt.o \
	xvtiff.o xvtiffwr.o xvpds.o vprintf.o fsQuick.o 

MISC = README CHANGELOG IDEAS

.c.o:	; $(CC) -c $(CFLAGS) -o $@ $*.c

all: $(LIBJPEG) $(LIBTIFF) xv bggen vdcomp

xv: $(OBJS) $(LIBJPEG)
	$(CC) $(CFLAGS) -o xv $(OBJS) $(LIBS)

bggen: bggen.c
	$(CC) $(CFLAGS) -o bggen bggen.c

vdcomp: vdcomp.c
	$(CC) $(CFLAGS) -o vdcomp vdcomp.c
	
clean:
	rm -f $(OBJS)
# comment out one or both of the following if you aren't using the JPEG and
# TIFF libraries
	( cd $(JPEGDIR) ; make clean )
	( cd $(TIFFDIR) ; make clean )
	rm -f vdcomp


tar:
	tar cf xv.tar Makefile* Imakefile *.c *.h bitmaps \
		docs unsupt $(JPEGDIR) $(TIFFDIR) $(MISC)

$(OBJS):   xv.h
xv.o:      bitmaps.h
xvbutt.o:  bitmaps.h
xvctrl.o:  bitmaps.h
xvdial.o:  bitmaps.h
xvinfo.o:  bitmaps.h
xvmisc.o:  bitmaps.h
xvscrl.o:  bitmaps.h
xvgraf.o:  bitmaps.h

xvdflt.o:  bitmaps/xvpic_logo bitmaps/xvpic_rev bitmaps/xvpic_jhb
xvdflt.o:  bitmaps/xf_left bitmaps/xf_right


bitmaps.h: $(BITMAPS)
	cat $(BITMAPS) > bitmaps.h




# if, for whatever reason, you're unable to get the JPEG library to compile
# on your machine, *COMMENT OUT* the following lines
#
$(LIBJPEG):
	( cd $(JPEGDIR) ; make libjpeg.a )

# if, for whatever reason, you're unable to get the TIFF library to compile
# on your machine, *COMMENT OUT* the following lines
#
$(LIBTIFF):
	( cd $(TIFFDIR) ; make )

