/*
 * 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 RS6000, you MAY need 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
 */
NEED_DIRENT = -DDIRENT


/* If, when 'Applying' colors, or when loading new pictures, you get an
 * X Protocol Error on the XFreeColors() call, your X Server is Wrong.
 * Several workarounds:  You can specify '-bfc' on the command line, or
 * set the 'xv.brokeFreeCols' resource to 'true'.  Alternately, you can
 * uncomment the BROKECOLS line below to compile in the workarounds
 * permanently.  If you do this, '-bfc' will toggle OFF the workarounds.
 *
 * Noteworthy Offenders:  AIX 3.1 on IBM 6000, and OLW on Suns
 */
/* BROKECOLS = -DBROKEFREECOLS */


/* 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.
 */
#if defined(VaxArchitecture) && !defined(UltrixArchitecture)
VPRINTF=	-DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOVOID
#else 
#  if defined(RtArchitecture) && !defined(AIXArchitecture)
VPRINTF=	-DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOSTDHDRS
#  endif
#endif


/* 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 ptoblems compiling xv.c and xvdir.c because of the DIR
 * reference in dirent.h, append '-DATT' to the following line:
 */
/* ATT = -DSYSV -DDIRENT -DUSLEEP -DATT */


#if defined(SCOArchitecture)
DEFINES= -DPOSIX -DNOITIMER
SYS_LIBRARIES=        $(XLIB) -lm -lc -lx
#else
SYS_LIBRARIES=        $(XLIB) -lm
#endif

CCOPTIONS= $(UNIX) $(NEED_DIRENT) $(BROKECOLS) $(VPRINTF) $(TIMERS) $(ATT)

SYS_LIBRARIES=	-lX11 -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

SRCS1 =	xv.c xv24to8.c xvbutt.c xvctrl.c xvdir.c xvfish.c xvgam.c\
	xvgif.c xvgifwr.c xvinfo.c xvmisc.c xvpbm.c xvpm.c xvscrl.c\
	xvxbm.c vprintf.c

OBJS1 =	xv.o xv24to8.o xvbutt.o xvctrl.o xvdir.o xvfish.o xvgam.o\
	xvgif.o xvgifwr.o xvinfo.o xvmisc.o xvpbm.o xvpm.o xvscrl.o \
	xvxbm.o vprintf.o

SRCS2=	bggen.c
OBJS2=	bggen.o

PROGRAMS= xv bggen

ComplexProgramTarget_1(xv,,)
ComplexProgramTarget_2(bggen,,)

InstallNonExec(docs/xv.man,$(MANDIR)/xv.ManSuffix)
InstallNonExec(docs/bggen.man,$(MANDIR)/bggen.ManSuffix)

tar:
	tar cf xv.tar Makefile *.c *.h bitmaps docs $(MISC)

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

depend:: bitmaps.h

