# Makefile for dxcalendar
# $Header: [Makefile,v 1.2.1.1 91/07/24 12:02:33 afuller Exp ]$
DESTDIR =
LOAD_DIR =
PWROOT = /usr/lib
 
CDEBUGFLAGS = -O
DEFINES = -DDWTUNIX -DNOT_VMS_V1 -DDwcV2 -DNDEBUG
INCLUDES = -I$(DESTDIR)/usr/include/X11 -I$(DESTDIR)/usr/include
CFLAGS = $(CDEBUGFLAGS) $(DEFINES) $(INCLUDES)
 
HELPDIR=/usr/lib/X11/help
LOADFILE = $(LOAD_DIR)/usr/lib/crt0.o
XLIB = $(DESTDIR)/usr/lib/libX11.a
DWTLIB = $(DESTDIR)/usr/lib/libdwt.a
DDIFLIB = /usr/lib/libddif.a
PRINTLIB = $(PWROOT)/libpw.a
LIBS = $(DWTLIB) $(XLIB) $(PRINTLIB) $(DDIFLIB) -lm -lc
UILOPTS = -I$(DESTDIR)/usr/include/X11/
 
CC = cc
LK = ld
UIL = $(DESTDIR)/usr/bin/dxuil
 
PROGRAM = dxcalendar
 
DATABASE_HEADERS = \
		dwc_db_private_include.h \
		dwc_db_public_include.h \
		dwc_db_public_structures.h \
		dwc_db_record_structures.h \
		dwc_db_work_structures.h \
		dwc_db_public_const.h \
		dwc_messages.h
 
DATABASE_OBJS = \
		dwc_db_calendar_maintenance.o \
		dwc_db_create_calendar.o \
		dwc_db_day_items.o \
		dwc_db_day_management.o \
		dwc_db_day_mapping.o \
		dwc_db_error_handling.o \
		dwc_db_open_close.o \
		dwc_db_physical_records.o \
		dwc_db_profile_management.o \
		dwc_db_repeat_expressions.o \
		dwc_db_virtual_buffers.o \
		dwc_db_alarms.o \
		dwc_db_trading.o
 
HELP_LIBRARY = \
		Aboutframe.hlp \
		CSH.hlp \
		Glossary.hlp \
		Overview.hlp \
		History.hlp \

UI_HEADERS = \
		dwc_ui_basics.h \
		dwc_ui_alarms_public.h \
		dwc_ui_month_public.h \
		dwc_ui_calendar.h \
		dwc_ui_dateformat.h \
		dwc_ui_datestructures.h \
		dwc_ui_errorboxes.h \
		dwc_ui_help.h \
		dwc_ui_monthinfo.h \
		dwc_ui_monthwidgetprivate.h \
		dwc_ui_monthwidgetpublic.h \
		dwc_ui_rendition.h \
		dwc_ui_yeardisplay.h \
		dwc_ui_catchall_public.h \
		dwc_ui_misc_public.h \
		dwc_ui_clipboard_public.h \
		dwc_ui_sloteditor_const.h \
		dwc_ui_calendar_const.h \
		dwc_ui_file_public.h \
		dwc_ui_edit_public.h \
		dwc_ui_view_public.h \
		dwc_ui_custom_public.h \
		dwc_ui_day_public.h \
		dwc_ui_options_public.h \
		dwc_ui_profile_public.h \
		dwc_ui_sloteditor.h \
		dwc_ui_sloteditor_public.h \
		dwc_ui_customize_const.h \
		mbaproto.h \
		mba.h \
		dwc_ui_widgetprog.h \
		dwc_ui_timeslotwidgetp.h \
		dwc_ui_timeslotwidget.h \
		dwc_ui_timebarwidgetp.h \
		dwc_ui_timebarwidget.h \
		dwc_ui_iconboxwidget.h \
		dwc_ui_iconboxwidgetp.h \
		dwc_ui_dayslotswidgetp.h \
		dwc_ui_applprog.h \
		dwc_ui_dayslotswidget.h \
		dwc_ui_help_public.h \
		dwc_ui_help_const.h \
		dwc_ui_uil_values_const.h \
		printwgtdef.h \
		layout.h \
		dwc_cda_util.h
 
UI_OBJS = \
		dwc_ui_calendar.o \
		dwc_ui_alarms.o \
		dwc_ui_customize.o \
		dwc_ui_sloteditor.o \
		dwc_ui_clipboard.o \
		dwc_ui_dateformat.o \
		dwc_ui_datefunctions.o \
		dwc_ui_errorboxes.o \
		dwc_ui_help.o \
		dwc_ui_monthinfo.o \
		dwc_ui_monthwidget.o \
		dwc_ui_print.o \
		dwc_ui_rendition.o \
		dwc_ui_icons.o \
		dwc_ui_catchall.o \
		dwc_ui_day.o \
		dwc_ui_edit.o \
		dwc_ui_file.o \
		dwc_ui_misc.o \
		dwc_ui_month.o \
		dwc_ui_options.o \
		dwc_ui_profile.o \
		dwc_ui_view.o \
		mba.o \
		dwc_ui_widgetprog.o \
		dwc_ui_timeslotwidget.o \
		dwc_ui_timebarwidget.o \
		dwc_ui_iconboxwidget.o \
		dwc_ui_dayslotswidget.o \
		layout.o \
		dwc_cda_util.o

SPECIAL_OBJS = \
		dwc_ui_yeardisplay.o

UID_FILES = \
		DXcalendar.uid

all: $(PROGRAM) uids 

uids: $(UID_FILES)

DXcalendar.uid : dwc_ui_sloteditor.uil \
			dwc_ui_sloteditor_const.uil \
			dwc_ui_sloteditor_text.uil \
			dwc_ui_sloteditor_values.uil \
			dwc_ui_sloteditor_objects.uil \
			dwc_ui_iconboxwidget.uil \
			dwc_ui_print.uil \
			dwc_ui_print_text.uil \
			dwc_ui_print_values.uil \
			dwc_ui_print_objects.uil \
			dwc_ui_calendar.uil \
			dwc_ui_calendar_const.uil \
			dwc_ui_calendar_text.uil \
			dwc_ui_calendar_values.uil \
			dwc_ui_calendar_objects.uil \
			dwc_ui_bitmaps.uil \
			dwc_ui_custom.uil \
			dwc_ui_customize_const.uil \
			dwc_ui_custom_text.uil \
			dwc_ui_custom_values.uil \
			dwc_ui_custom_objects.uil \
			dwc_db_public_const.uil
	$(UIL) dxcalendar.uil $(UILOPTS) -o DXcalendar.uid

dwc_ui_yeardisplay.o: dwc_ui_yeardisplay.c
	${CC} -c -g $(DEFINES) $(INCLUDES) dwc_ui_yeardisplay.c

dwc_ui_calendar.o: dwc_ui_calendar.c
	$(CC) -c $(CFLAGS) dwc_ui_calendar.c
	mv dwc_ui_calendar.o main_dwc_ui_calendar.o
	$(CC) -c $(CFLAGS) -DCOMBINE dwc_ui_calendar.c

libcalendar.a: $(DATABASE_OBJS) $(SPECIAL_OBJS) $(UI_OBJS)
	rm -rf libcalendar.a
	ar cr libcalendar.a \
		$(DATABASE_OBJS) \
		$(SPECIAL_OBJS) \
		$(UI_OBJS)
	ranlib libcalendar.a
 
$(PROGRAM): libcalendar.a
	$(LK) -o $(PROGRAM) \
		$(LOADFILE) \
		main_dwc_ui_calendar.o \
		libcalendar.a \
		$(LIBS)
 
dbx_cal:
	make "CDEBUGFLAGS = -g" DESTDIR=$(DESTDIR) $(PROGRAM)
 
v1_cal:
	make "DEFINES = -DDWTUNIX -DNOT_VMS_V1" \
		"CDEBUGFLAGS = -O" DESTDIR=$(DESTDIR) $(PROGRAM)

v1_dbx:
	make "DEFINES = -DDWTUNIX -DNOT_VMS_V1" \
		"CDEBUGFLAGS = -g" DESTDIR=$(DESTDIR) $(PROGRAM)

install: all
	install -c -s -m 755 $(PROGRAM) $(DESTDIR)/usr/bin
	install -c -m 644 Calendar $(DESTDIR)/usr/lib/X11/app-defaults/DXcalendar
	install -c -m 644 DXcalendar.uid $(DESTDIR)/usr/lib/X11/uid/DXcalendar
	install -c -m 644 dxcalendar_prolog.ps $(DESTDIR)/usr/lib/X11/app-defaults/dxcalendar_prolog.ps
	-mkdir $(DESTDIR)$(HELPDIR)
	-mkdir $(DESTDIR)$(HELPDIR)/dxcalendar
	install -c -m 644 Aboutframe.hlp $(DESTDIR)$(HELPDIR)/dxcalendar/Aboutframe
	install -c -m 644 CSH.hlp $(DESTDIR)$(HELPDIR)/dxcalendar/CSH
	install -c -m 644 Glossary.hlp $(DESTDIR)$(HELPDIR)/dxcalendar/Glossary
	install -c -m 644 Overview.hlp $(DESTDIR)$(HELPDIR)/dxcalendar/Overview
	install -c -m 644 History.hlp $(DESTDIR)$(HELPDIR)/dxcalendar/History
 
clean:
	rm -f $(DATABASE_OBJS) $(SPECIAL_OBJS) $(UI_OBJS) core *.a $(PROGRAM) main_dwc_ui_calendar.o $(UID_FILES)
