# @(#)Makefile	1.9 91/09/27 XLOCK

FLAGBITS    = unix
BITMAPTYPE	= x11
PIXMAPTYPE	= x11
LIFEBITMAP	= ${BITMAPTYPE}
MAZEBITMAP	= ${BITMAPTYPE}
IMAGEBITMAP	= ${BITMAPTYPE}
IMAGEPIXMAP	= ${PIXMAPTYPE}

# Set your ANSI C compiler
#CC		= gcc -Wall
CC		= cc

LINT		= lint

BITMAPDIR       = ./bitmaps
PIXMAPDIR       = ./pixmaps
FLAGDIR         = ./flags

# X include files
XINC		= -I/usr/local/include
#XINC		= -I/usr/include/X11R4
#XINC		= -I/usr/include/X11R5
#XINC		= -I${OPENWINHOME}/include
#XINC		= -I${MOTIFHOME}/include

# X libraries
XLIBPATH	= -L/usr/local/lib
#XLIBPATH	= -L/usr/lib/X11R4
#XLIBPATH	= -L/usr/lib/X11R5
#XLIBPATH	= -L${OPENWINHOME}/lib
#XLIBPATH	= -L${MOTIFHOME}/lib

# to use full color xpm images, uncomment
#XPMDEF		= -DHAS_XPM
#
# XPM include path, below is a guess, it is assumed that it is in X11/xpm.h
#XPMINC		= -I/usr/local/include
#
# XPM library, the path is a guess
#XPMLIB		= -L/usr/local/lib -lXpm
# also see image.c below

# to use for CDE DT saver, uncomment
#DTSAVERDEF	= -DDT_SAVER
#
# CDE DT include path, below is a guess
#DTSAVERINC	= -I/usr/dt/include
#
# CDE DT library, the path is a guess
#DTSAVERLIB	= -L/usr/dt/lib -lDtSvc

# to use RPLAY audio, uncomment
#RPLAYDEF	= -DHAS_RPLAY
#
# RPLAY include path, below is a guess
#RPLAYINC	= -I/usr/local/include
#
# RPLAY library, the path is a guess
#RPLAYLIB	= -L/usr/local/lib -lrplay
#
# system play
# SUNOS 4.1.3
#DEF_PLAY = "/usr/demo/SOUND/play sounds/"
# IRIX 5.3
#DEF_PLAY = "/usr/sbin/sfplay sounds/"

# special password defines
# (Shadow, KERBEROS, or DCE authentication)
#PASSWDDEF	= -DHAS_SHADOW
#PASSWDDEF	= -DKERBEROS
#PASSWDDEF	= -DDCE_PASSWD
#
# special password include path
# The following is needed for KERBEROS or DCE authentication
#PASSWDINC	= -I/usr/athena/include
#PASSWDINC	= -I/usr/include/reentrant
#
# special password library (Shadow, KERBEROS, or DCE authentication)
#PASSWDLIB	= -lshadow
#PASSWDLIB	= -L/usr/athena/lib -ldes -lkrb
#PASSWDLIB	= -ldce -lc_r
#
# special encryption library
#CRYPTLIB	= -lcrypt
#

# directory of your app-defaults directory, below is a guess
LIBDIR		= /usr/local/lib/X11

# miscellaneous defines
# -DUSE_VROOT		allows xlock to run in root window (may
#			cause problems with certain window managers)
# -DALWAYS_ALLOW_ROOT	users can not turn off allowroot
# -DSYSLOG	for paranoid administrators
# -DMULTIPLE_ROOT	multiple root users ... security?
# -DMOUSE_MOTION	password screen displayed with mouse motion
# -DOLD_EVENT_LOOP	some machines may still need this (fd_set
#			errors may be a sign)
#
# For personal use you may want to consider:
#  -DUSE_XLOCKRC	paranoid admin or unknown shadow passwd alg
#
# For labs you may want to consider:
#  -DAUTO_LOGOUT	enable auto-logout code
#  -DLOGOUT_BUTTON	enable logout button
#  -DCLOSEDOWN_LOGOUT	use with above two if using xdm
#  -DLO_BUTTON_TIME=5	minutes until logout button appears
#  -DSTAFF_FILE=\"/etc/xlock.staff\"	file of staff who are exempt from above

COPT		= -O

DEFINES		= -DUSE_VROOT -DALWAYS_ALLOW_ROOT\
	-DDEF_FILESEARCHPATH=\"$(LIBDIR)/%T/%N%S\"\
	${XPMDEF} ${DTSAVERDEF} ${RPLAYDEF} ${PASSWDDEF}
# -DSYSLOG -DMULTIPLE_ROOT\
# -DDEF_PLAY=\"$(DEF_PLAY)\"\
#	-DUSE_XLOCKRC\
#	-DAUTO_LOGOUT -DLOGOUT_BUTTON -DLO_BUTTON_TIME=5\
#	-DSTAFF_FILE=\"/etc/xlock.staff\"

INCLUDES	= ${XINC} -I. ${XPMINC} ${DTSAVERINC} ${RPLAYINC} ${PASSWDINC}

CFLAGS		= ${COPT} ${DEFINES} ${INCLUDES}

LIBS		= ${XLIBPATH} -lX11 ${XPMLIB} ${DTSAVERLIB} ${RPLAYLIB} -lm\
	${CRYPTLIB} ${PASSWDLIB}

HDRS		= xlock.h mode.h vroot.h ras.h

SRCS		= xlock.c passwd.c resource.c\
	utils.c logout.c mode.c ras.c xbm.c color.c\
	ant.c bat.c blot.c bouboule.c bounce.c braid.c bug.c\
	clock.c demon.c eyes.c flag.c flame.c forest.c\
	galaxy.c geometry.c grav.c helix.c hop.c hyper.c\
	image.c kaleid.c laser.c life.c life1d.c life3d.c lissie.c\
	marquee.c maze.c mountain.c nose.c petal.c puzzle.c pyro.c\
	qix.c rock.c rotor.c\
	shape.c slip.c sphere.c spiral.c spline.c swarm.c swirl.c\
	triangle.c wator.c world.c worm.c\
	blank.c random.c

OBJS		=${SRCS:.c=.o}

PROGRAM         = xlock

VER             = ${PROGRAM}more


all:		${OBJS}
		${CC} ${COPT} -o ${PROGRAM} ${OBJS} ${LIBS}

debug:	xlock
#debug:=COPT=-g -DDEBUG

#resource.o:=DEFINES=-DDEF_FILESEARCHPATH=\"$(LIBDIR)/%T/%N%S\"

flag.c: flag.h
life.c:	life.xbm
maze.c:	maze.xbm

# change for XPM
image.c:	image.xbm
#image.c:	image.xbm image.xpm

flag.c: flag.h
	rm -f flag.h
	ln -s ${FLAGDIR}/flag-$(FLAGBITS).h flag.h
 
life.xbm:
	rm -f life.xbm
	ln -s ${BITMAPDIR}/life-$(LIFEBITMAP).xbm life.xbm

maze.xbm:
	rm -f maze.xbm
	ln -s ${BITMAPDIR}/maze-$(MAZEBITMAP).xbm maze.xbm
 
image.xbm:
	rm -f image.xbm
	ln -s ${BITMAPDIR}/image-$(IMAGEBITMAP).xbm image.xbm

image.xpm:
	rm -f image.xpm
	ln -s ${PIXMAPDIR}/image-$(IMAGEPIXMAP).xpm image.xpm

tar:	clean.all
	cd .. ; tar cvf ${VER}.tar ${VER}/*

compress:	tar
	cd .. ; compress -f ${VER}.tar

gzip:	tar
	cd .. ; gzip -f ${VER}.tar

tgz:	tar
	cd .. ; gzip -c ${VER}.tar > `echo ${VER} | cut -c1-8`.tgz ;\
		rm -f ${VER}.tar

man:
	nroff -man ${PROGRAM}.man | more

read:
	more README

lint:
	${LINT} -ax -DLINT ${DEFINES} ${INCLUDES} ${SRCS}

clean:
	rm -f *.o ${PROGRAM} core *~ *% *.bak make.log MakeOut life.xbm maze.xbm image.xbm image.xpm flag.h

clean.all:	clean
	rm -f Makefile

install:	${PROGRAM}
	install ${PROGRAM} /usr/local/bin
