.KEEP_STATE:
#
# Makefile for olvwm
#
#  To make olvwm, simply type make
#  To install olvwm, type make install

# Set this to the directory to place the olvwm executable
INSTALLDIR = ${OPENWINHOME}/bin

# If you want to use the OPENWINDOWS help facility, then set HELPDIR
# to the directory where those files are kept.  If you cannot write
# to that directory but still want to install the helpfile, set HELPDIR
# to some other directory and add that directory to your HELPPATH.
# If you don't want to install the help file at all, set HELPDIR to /dev/null.
HELPDIR = ${OPENWINHOME}/lib/help

# Where to install the man pages:  man1 dir is where olvwm.man will go;
# and man5 dir is where olvwmrc.man will go; you may want to set these
# to a local directory somewhere.
# If you don't want to install the man pages, set these to /dev/null.

MAN1DIR = ${OPENWINHOME}/man/man1
MAN5DIR = ${OPENWINHOME}/man/man5

# If you don't have olwm installed anywhere and want to install the olwm
# man page (which discusses most of the olvwm functionality too) uncomment
# out the following line
#OLWMMAN = olwm.man

#
# Set MORECCFLAGS to any options you want to pass to the compiler.  These
# include and defines, and debugging and/or optimization flags, and the like.
# Also, if you have headers for things like the XPM library in a non-standard
# place, include the appropriate -I flag here.
#
# There are a bunch of defines, and I can't honestly say I've used or even
# tested all of them (since much of this code came from the xview 3.2 release)
# and certainly I haven't used all combinations of them.  See below for
# suggested settings:
#
# Here's a set of possible defines:
#  -DALLPLANES		Support the AllPlanes extension (valid in SunOs/Solaris)
#  -DDEBUG		Include some debugging code
#  -DIDENT		Include ident directives for the compiler
#  -DMAXPID=32768	For 386BSD
#  -DMEMDEBUG		To debug the memory allocation
#  -DOW_I18N_L3		Include support for Level 3 internationalization
#			    (Note:  I haven't tested without this, and I can't
#			     test it in any locale but C, so include it, but
#			     take it with a grain of salt -- the original olwm
#			     code will work, but the olvwm extensions may not
#			     support the correctinternationalization)
#  -DOW_I18N_L4		Include support for Level 4 internationalization
#			    (Note:  This is not yet supported, but it may work)
#  -DREGEXP		Support for the 386 BSD regular expression library
#  -DRLIMIT_NOFILE	Support for the 386BSD/Ultrix RLIMIT calls
#  -DSHAPE		Support the shapes extension (valid in SunOS/Solaris)
#  -DSYSV		Support for System V (Release 3 or 4)
#  -DSVR4		Support for System V Release 4 (you must also include
#			    	-DSYSV)
#  -DXPM		Support the XPM color pixmaps -- requires that you
#				have the xpm library (version 3.0) somewhere.
#				If your xpm header isn't in /usr/openwin/include
#				make sure to add the appropriate -I flag to
#				MORECCFLAGS.  Also remember to add the
#				library name to LDFLAGS.
#
# I haven't tested this on Solaris 1.x, but I'd suggest
#MORECCFLAGS=-DOW_I18N_L3 -DSHAPE -DIDENT

# For a generic Solaris 2.x system, I'd suggest
MORECCFLAGS=-DOW_I18N_L3 -DSHAPE -DSVR4 -DSYSV -DIDENT -x O4

#
# Set LDFLAGS to any link options you want.  For a generic Solaris 1.x
# system, I'd suggest
#LDFLAGS=-L${OPENWINHOME}/lib
#
# For Solaris 2.x, I'd suggest
LDFLAGS=-L${OPENWINHOME}/lib -R${OPENWINHOME}/lib -lintl

#
# Which compiler to use
CC = cc

#
# You shouldn't need to change anything below this line

INC = -I${OPENWINHOME}/include
CFLAGS = ${INC} ${MORECCFLAGS}

HEADERS = cmdstream.h cursors.h debug.h defaults.h dsdm.h environ.h error.h \
	  events.h gettext.h globals.h group.h helpcmd.h i18n.h iconimage.h \
	  iconmask.h kbdfuncs.h list.h mem.h menu.h notice.h olcursor.h \
	  olgx_impl.h ollocale.h olwm.h patchlevel.h properties.h resources.h \
	  screen.h selection.h slots.h st.h virtual.h win.h

SRCS = atom.c client.c cmdstream.c cursors.c debug.c defaults.c dsdm.c \
       environ.c error.c evbind.c events.c fontset.c gettext.c gif.c group.c \
       helpsend.c i18n.c images.c info.c kbdfuncs.c list.c mem.c menu.c \
       moveresize.c notice.c ol_button.413.c ol_button.svr4.c olvwmrc.c \
       olwm.c pixmap.c properties.c reduce.c resources.c screen.c \
       selection.c services.c slave.c slots.c st.c states.c usermenu.c \
       usleep.c virtual.c win.c winbusy.c winbutton.c wincolor.c winframe.c \
       wingframe.c winicon.c winipane.c winmenu.c winnofoc.c winpane.c \
       winpinmenu.c winpush.c winresize.c winroot.c

LIBS = ${LDFLAGS} -lolgx -lXext -lX11 -ll -lm

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

olvwm : ${OBJS}
	${CC} -o olvwm ${OBJS} ${LIBS}

lint:
	lint ${CFLAGS} ${SRCS}

parse.c : parse.l
	lex -t parse.l > parse.c   
		 
olvwmrc.c : olvwmrc.y 
	yacc olvwmrc.y 
	mv y.tab.c olvwmrc.c

olvwmrc.o : parse.c olvwmrc.c 

clean :
	/bin/rm -f olvwm .make.state .nse_depinfo parse.c olvwmrc.c *.o core errs ,* .emacs_* tags TAGS make.log MakeOut "#"*

install:
	@echo "Installing olvwm in $(INSTALLDIR)"
	@/bin/cp olvwm $(INSTALLDIR)
	@echo "Installing help file in $(HELPDIR)"
	@/bin/cp olvwm.info $(HELPDIR)
	@echo "Installing olvwm man page in $(MAN1DIR)"
	@/bin/cp olvwm.man olvwm.1
	@/bin/cp olvwm.1 $(MAN1DIR)
	@/bin/rm -f olvwm.1
	@echo "Installing olvwmrc man page in $(MAN5DIR)"
	@/bin/cp olvwmrc.man olvwmrc.5
	@/bin/cp olvwmrc.5 $(MAN5DIR)
	@/bin/rm -f olvwmrc.5
	-@/bin/cp ${OLWMMAN} ${MAN1DIR}/olwm.1 >/dev/null 2>&1
