# $Id: Imakefile,v 2.2 1991/10/30 18:40:12 billr Exp $
#
#include <XView.tmpl>

#define HasInfoFiles YES

#
# Imakefile for calentool
#
#	Symbol Definitions
# (These can all be set in ct.h also)
#-------------------------------
#SUN3_5       Define this if using SunOS 3.5 or earlier
#NEED_CUSERID Define this if your C library does not include cuserid()
#NEED_DYSIZE  Define this if your C library does not include dysize()
#DATELIB_DIR  Directory containing the Date Library
#PRINT_CMD    Command to send postscript to appropriate printer
#NR_WEEKDAYS  Define to number of days in week to display (5-7)
#START_HOUR   What is first hour of day to display
#END_HOUR     What is last hour of day to display
#N_NOTESLOTS  What is the number of note slots to display
#START_YEAR   What is first year of calendar to display
#NR_YEARS     How many years to display.
#UPDATE_RATE  How often to perform updates (second or minute)?
#MAILPROG     Mailer for -m option
#HOUR_24      For 12 or 24 hour time formats
#MON_FIRST    For Sun-Sat or Mon-Sun week formats
#APPT_CHECK_LIMIT What limits to check for appointments (see ct.h)
#
#LANGUAGE     Enable PostScript code for extended character sets
#		See pcaldw.c for more information.
#FRENCH       French language month and day names
#NO_PRINTER   No printing is supported
#RASTER_ONLY  Define if no PostScript printer available.
#NO_HOLIDAYS  No holiday display is supported
#NO_SUN_MOON  No sun and moon phase info is supported
#
#CALENCHECK   Ifdefs out parts of files for calencheck program
#
#LOCATION     Geographic coordinates of this physical location (if known).
#[121-08'-56"W x 44-15'-15"N == Redmond, Oregon, USA]
#[122-15'-12"W x 37-29'-00"N == Golden Gate Park, San Francisco, CA, USA]
#If the longitude is not known, the local time offset is derived
#from the timezone information (tzp.tz_minuteswest). If the
#latitude is not known, the default used is 34-0'-0" - the approximate
#centerline of the U.S.
#
#To find your local coordinates, call the local Flight Service Station
#(in the U.S., look under Transportation, Department of - FSS) and
#ask for the latitude and longitude of your local airport. That
#will probably be close enough.  Other useful sources are a local
#planetarium, science museum, Dept. of Astronomy, or library.
#
#LONG_DEGREES Degrees part of site longitude
#LONG_MINUTES Minutes part of site longitude
#LONG_SECONDS Seconds part of site longitude
#LAT_DEGREES Degrees part of site latitude
#LAT_MINUTES Minutes part of site latitude
#LAT_SECONDS Seconds part of site latitude
#
#
#BINDIR       Where to install binaries
#MANDIR       Where to install man pages
#MANSUFFIX    Suffix letter or number for the man pages
#

BINDIR = /usr/local/bin
MANDIR = /usr/local/man
MANSUFFIX = 1

DATELIB_DIR  = $(USRLIBDIR)/calentool
PRINT_CMD    = "lpr -Plw"
NR_WEEKDAYS  = 5
START_HOUR   = 8
END_HOUR     = 18
N_NOTESLOTS  = 6
START_YEAR   = 90
NR_YEARS     = 5
UPDATE_RATE  = minute
MAILPROG     = /usr/ucb/mail
HOUR_24      = 0
MON_FIRST    = 0
APPT_CHECK_LIMIT = n_slots
#LANGUAGE     = -DLANGUAGE
#FRENCH       = -DFRENCH
#NO_PRINTER   = -DNO_PRINTER
#RASTER_ONLY  = -DRASTER_ONLY 
#NO_HOLIDAYS  = -DNO_HOLIDAYS 
#NO_SUN_MOON  = -DNO_SUN_MOON 
#NEED_CUSERID = -DNEED_CUSERID
NEED_DYSIZE  = -DNEED_DYSIZE
#LOCATION= -DLONG_DEGREES=121. -DLONG_MINUTES=08. -DLONG_SECONDS=56. \
	-DLAT_DEGREES=44. -DLAT_MINUTES=15. -DLAT_SECONDS=15.

#
#	Library and optimization flags
SYS_LIBRARIES = -lm
LOCAL_LIBRARIES = $(XVIEWLIB) $(OLGXLIB) $(XLIB)
OPTIMIZE = -O 
# NO_OPTIMIZE is used to turn off optimization for wpaint.c and pcal.c.
# Optimization may work on non-Sun platforms. If so, change NO_OPTIMIZE
# to match OPTIMIZE.
NO_OPTIMIZE = #-g
#
#	Define the compile symbols
#	Many of these can also be set from the .Xdefaults file
DEFINES =	-DDATELIB_DIR=\"$(DATELIB_DIR)\" \
		-DPRINT_CMD=\"$(PRINT_CMD)\" \
		-DNR_WEEKDAYS=$(NR_WEEKDAYS) \
		-DSTART_HOUR=$(START_HOUR) \
		-DEND_HOUR=$(END_HOUR) \
		-DN_NOTESLOTS=$(N_NOTESLOTS) \
		-DSTART_YEAR=$(START_YEAR) \
		-DNR_YEARS=$(NR_YEARS) \
		-DUPDATE_RATE=\"$(UPDATE_RATE)\" \
		-DMAILPROG=\"$(MAILPROG)\" \
		-DHOUR_24=$(HOUR_24) \
		-DMON_FIRST=$(MON_FIRST) \
		-DAPPT_CHECK_LIMIT=$(APPT_CHECK_LIMIT) \
		$(LANGUAGE) \
		$(FRENCH) \
		$(NO_PRINTER) \
		$(RASTER_ONLY) \
		$(NO_HOLIDAYS) \
		$(NO_SUN_MOON) \
		$(NEED_CUSERID) \
		$(NEED_DYSIZE)
CDEBUGFLAGS =	$(OPTIMIZE)
CCFLAGS =	$(CFLAGS) -DCALENCHECK=1
NOCFLAGS =	$(NO_OPTIMIZE) $(CCOPTIONS) $(ALLDEFINES)
#
#	All sources
SRCS =	calentool.c common.c datelib.c devent.c dpaint.c event.c \
	expire.c holidays.c init.c moon.c mpaint.c notify.c pcal.c \
	pcaldw.c printer.c riseset.c tool.c utils.c \
	version.c wevent.c wpaint.c ypaint.c \
	calencheck.c \
	mt2ct.c \
	month2ct.c put_aentry.c read_sched.c \
	cal2ct.c
#
#	The info file
INFOFILES = calentool.info
#
#	The date data files
DATEFILES= dates/CREDITS dates/README dates/ancient dates/can_holiday\
	dates/celtic dates/computing dates/events1 dates/events2\
	dates/events3 dates/events4 dates/events5 dates/events6\
	dates/gdead dates/hawaii dates/literature dates/lives1 dates/lives2\
	dates/lives3 dates/lives4 dates/lives5 dates/lives6 dates/lotr\
	dates/movies dates/music dates/radio dates/sfo dates/space\
	dates/sports dates/television dates/usa_holiday dates/usa_other\
	dates/usa_states dates/witchcraft dates/world\
	dates/events dates/lives
#
#	Objects that make up calentool
CT_OBJS = calentool.o ct_common.o ct_datelib.o devent.o dpaint.o event.o \
	expire.o holidays.o init.o moon.o mpaint.o notify.o pcal.o \
	pcaldw.o printer.o riseset.o tool.o ct_utils.o \
	version.o wevent.o wpaint.o ypaint.o
#
# 	objects that make up calencheck
CC_OBJS = calencheck.o cc_common.o cc_datelib.o cc_utils.o
#
#	objects that make up mt2ct
MT_OBJS	= mt2ct.o put_aentry.o
#
#	objects that make up month2ct
MONTH_OBJS = month2ct.o put_aentry.o read_sched.o
#
#	objects that make up cal2ct
CAL_OBJS = cal2ct.o put_aentry.o
#
#	default: compile everything
all:: calentool calencheck mt2ct month2ct cal2ct
#
#	the basic targets
NormalProgramTarget(calentool,$(CT_OBJS),,$(LOCAL_LIBRARIES),$(SYS_LIBRARIES))
/*
 * If you get two instances of "-lm" on the link for 'calentool' you
 * can use the commented out line below instead of the the spec above
 * NormalProgramTarget(calentool,$(CT_OBJS),,$(LOCAL_LIBRARIES),)
 */
NormalProgramTarget(calencheck,$(CC_OBJS),,$(LOCAL_LIBRARIES),)
NormalProgramTarget(mt2ct,$(MT_OBJS),,,)
NormalProgramTarget(month2ct,$(MONTH_OBJS),,,)
NormalProgramTarget(cal2ct,$(CAL_OBJS),,,)
#
#	define dependencies
DependTarget()
#
#	define installation rules
InstallProgram(calentool,$(BINDIR))
InstallManPage(calentool,$(MANDIR))
InstallProgram(calencheck,$(BINDIR))
InstallManPage(calencheck,$(MANDIR))
InstallProgram(mt2ct,$(BINDIR))
InstallManPage(mt2ct,$(MANDIR))
InstallProgram(month2ct,$(BINDIR))
InstallProgram(cal2ct,$(BINDIR))
#
#	special man page rules for duplicate man pages
install.man::
	$(RM) $(MANDIR)/month2ct.$(MANSUFFIX)
	ln -s $(MANDIR)/mt2ct.$(MANSUFFIX) $(MANDIR)/month2ct.$(MANSUFFIX)
	$(RM) $(MANDIR)/cal2ct.$(MANSUFFIX)
	ln -s $(MANDIR)/mt2ct.$(MANSUFFIX) $(MANDIR)/cal2ct.$(MANSUFFIX)
#
#	special rules for date file installation
install::
	$(MKDIRHIER) $(DATELIB_DIR)
	for i in $(DATEFILES); do \
		($(INSTALL) -c $(INSTDATFLAGS) $$i $(DATELIB_DIR)); \
	done
#
#	special rules for files that compile differently for different programs
# wpaint.c and pcal.c usually have to be compiled with optimization
# turned off (at least on Sun platforms).
wpaint.o: wpaint.c ct.h
	$(CC) $(NOCFLAGS) -c wpaint.c

pcal.o: pcal.c ct.h
	$(CC) $(NOCFLAGS) -c pcal.c

riseset.o: riseset.c riseset.h
	$(CC) $(CFLAGS) $(LOCATION) -c riseset.c

ct_common.o: common.c ct.h
	$(CC) $(CFLAGS) -c common.c
	$(MV) common.o ct_common.o

ct_datelib.o: datelib.c ct.h
	$(CC) $(CFLAGS) -c datelib.c
	$(MV) datelib.o ct_datelib.o

ct_utils.o: utils.c ct.h
	$(CC) $(CFLAGS) -c utils.c
	$(MV) utils.o ct_utils.o

cc_common.o: common.c ct.h
	$(CC) $(CCFLAGS) -c common.c
	$(MV) common.o cc_common.o

cc_datelib.o: datelib.c ct.h
	$(CC) $(CCFLAGS) -c datelib.c
	$(MV) datelib.o cc_datelib.o

cc_utils.o: utils.c ct.h
	$(CC) $(CCFLAGS) -c utils.c
	$(MV) utils.o cc_utils.o

#include <XView.prog>

