#
#	Imakefile for xkal - X appointment calendar
#
#	George Ferguson, ferguson@cs.rochester.edu, 15 Oct 1990.
#	Version 1.1 - 27 Feb 1991.
#
#	$Id: Imakefile,v 1.2 91/12/20 12:04:16 jik Exp $
#

#
# Here's what to change to customize the installation...
#
# Where do you want this stuff? Uncomment these to change the destinations
# of "make install" and "make install.man" if the defaults are not
# satisfactory.
#
#BINDIR = /u/ferguson/bin
KALLIBDIR = /mit/sipb/lib
#MANDIR = /u/ferguson/man/man1
##undef ManSuffix
##define ManSuffix 1

#
# Where is the ezMenu package?
#
EZMENU_DIR =		../EzMenu
EZMENU_INCLUDES =	-I$(EZMENU_DIR)
EZMENU_LIBRARIES =	-L$(EZMENU_DIR) -lezMenu$(TARGET_MACH)

#
# Where is the app-defaults to C converter?
# Only needed if you change the app-defaults file Xkal.ad and want the changes
# compiled into the program. If you do not have ad2c you should remove the
# extra clean target for Xkal.ad.h below. If you lose Xkal.ad.h and can not
# remake it, create it to be a line containing NULL (i.e. those four
# characters) only.
#
AD2C = ../Ad2c/ad2c

#
# Do you want to use popup alert boxes (can you compile them)? If not,
# comment out these definitions and error messages will go to stderr.
#
ALERTC = alert.c
ALERTO = alert.o
ALERTDEFS = -DUSE_ALERT

#
# Is dysize(3) in your standard library? If not, you need these definitions.
# It appears that Ultrix and maybe SGI systems need this for sure.
#
DYSIZEC = dysize.c
DYSIZEO = dysize.o

#
# Is strcasecmp(3) in your standard library? If not, you need these
# definitions. It appears that at least Sun 386i systems need this for sure.
#
#STRCASECMPC = strcasecmp.c
#STRCASECMPO = strcasecmp.o

#
# Do you want to try to get rid of the "cannot convert string NULL to widget"
# message? If so, leave these uncommmented to use the hacked error
# message printer. If you get linker errors (multiply defined symbols, etc)
# then you are stuck with the message and should comment these out.
#
#STRINGCONVERTC = string-convert.c
#STRINGCONVERTO = string-convert.o

#
# This is -g for debugging or -O for optimization (or nothing).
#

#	#	#	#	#	#	#	#	#	#
# Nothing to change below here
#

PROGRAMS	=	xkal xkal2xremind xkal2pcal
DEFINES		=	-DXAPPLOADDIR=\"$(XAPPLOADDIR)\" $(ALERTDEFS)
EXTRA_INCLUDES  =	$(EZMENU_INCLUDES)
LOCAL_LIBRARIES =	$(EZMENU_LIBRARIES) XawClientLibs

#
# These definitions are for xkal itself
#
SRCS1 = xkal.c month.c day.c edit.c edit-defaults.c db.c \
	util.c date-strings.c resources.c \
	$(STRINGCONVERTC) $(ALERTC) $(DYSIZEC) $(STRCASECMPC)
OBJS1 = xkal.o month.o day.o edit.o edit-defaults.o db.o \
	util.o date-strings.o resources.o \
	$(STRINGCONVERTO) $(ALERTO) $(DYSIZEO) $(STRCASECMPO)

ComplexProgramTarget_1(xkal,$(LOCAL_LIBRARIES),)
InstallAppDefaults(Xkal)
InstallNonExec(xkal.appoints,$(KALLIBDIR))

#
# These definitions are for xkal2xremind
#
OBJS2 = xkal2xremind.o resources.o db.o util.o date-strings.o \
	$(STRCASECMPO) $(DYSIZEO)
SRCS2 = xkal2xremind.c resources.c db.c util.c date-strings.c \
	$(STRCASECMPC) $(DYSIZEC)

ComplexProgramTarget_2(xkal2xremind,$(XTOOLLIB) $(XLIB),)

#
# These definitions are for xkal2pcal
#
OBJS3 = xkal2pcal.o resources.o db.o util.o date-strings.o \
	$(STRCASECMPO) $(DYSIZEO)
SRCS3 = xkal2pcal.c resources.c db.c util.c date-strings.c \
	$(STRCASECMPC) $(DYSIZEC)

ComplexProgramTarget_3(xkal2pcal,$(XTOOLLIB) $(XLIB),)

#
# These install the xkal-mail and xkal-automail scripts. Can't use
# "InstallScript" since it uses INSTPGMFLAGS which might include "-s".
#
install::
	$(INSTALL) -c xkal-mail $(BINDIR)
	$(INSTALL) -c xkal-automail $(BINDIR)
InstallManPage(xkal-mail,$(MANDIR))
InstallManPage(xkal-automail,$(MANDIR))


#
#	Generate C code for fallback resources
#
Xkal.ad.h: Xkal.ad
	$(AD2C) Xkal.ad >Xkal.ad.h

clean::
	$(RM) Xkal.ad.h

#
#	Miscellaneous other rules:
#
ci:
	ci -u *.c *.h Xkal.ad xkal.man xkal.appoints Imakefile

tar:
	tar cvf - \
		README Imakefile Makefile Xkal.ad \
		alert.c alert.h app-resources.h date-strings.c date-strings.h \
		day.c day.h db.c db.h dysize.c edit-defaults.c edit-defaults.h \
		edit.c edit.h month.c month.h patchlevel.h \
		resources.c resources.h \
		strcasecmp.c string-convert.c util.c util.h \
		xkal-automail xkal-automail.man	xkal-mail xkal-mail.man \
		xkal.appoints xkal.c xkal.h xkal.man \
		xkal2pcal.c xkal2pcal.man xkal2xremind.c xkal2xremind.man | \
	    compress >xkal.tar.Z

install:: install.man
