#sccs	"@(#)pcal:Makefile	1.12"


include $(MAKEINC)/Makepre.h

PROGS = \
	pcal

FILES = \
	FANCY.I.E.12.A \
	PLAIN.R.E.11.A \
	PLAIN.R.E.12.A \
	PLAIN.R.E.18.A

ID = id.o
DEBUG=
DEBLIB= -ldev
LCFLAGS = -DS4 -DSYS5 $(DEBUG)


DEPENDLIST = main.c calr.c disr.c dbad.c minput.c wdis.c ddis.c edit.c \
filer.c thebell.c thekey.c hdis.c print.c font.c alarm.c pref.c todo.c 

ROOT_PRODUCTS = \
	PCAL

all:    inst_tree Makeincludes pcal
	decode _FANCY.I.E.12. FANCY.I.E.12.A
	decode _PLAIN.R.E.11. PLAIN.R.E.11.A
	decode _PLAIN.R.E.12. PLAIN.R.E.12.A
	decode _PLAIN.R.E.18. PLAIN.R.E.18.A

inst_tree:
	( \
	if [ -d $(INST_TREE) -a "`uname -n`" != "zeus" ]; \
	then \
		echo "Assuming latest mstr.proto is installed on build machine";\
		cd $(INST_TREE); \
		rm -rf $(ROOT_PRODUCTS); \
		$(MAKE) -i SETS="$(ROOT_PRODUCTS)" all; \
	fi; \
	)

Makeincludes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes
	$(MAKE)

includes: $(DEPENDLIST)
	$(INCCMD) $(DEPENDLIST) | $(SORT) | $(FILTER) > Makeincludes

OBJS = main.o calr.o disr.o dbad.o minput.o wdis.o ddis.o edit.o \
filer.o thebell.o thekey.o hdis.o print.o font.o alarm.o pref.o todo.o 

pcal:	$(OBJS) $(ID)
	$(LD)  -o pcal $(SHAREDLIB) $(OBJS) $(DEBLIB) $(ID)

install:
	for I in $(FILES); do echo installing $$I...; \
		$(INSTALL) -i$(EXITFLAG) $$I $(INSDIR) $(PROTOFILE); done
	$(INSTALL) -i$(EXITFLAG) pcal%/usr/bin $(INSDIR) $(PROTOFILE)
	$(INSTALL) -i$(EXITFLAG) pcal%/etc/fixes $(INSDIR) $(PROTOFILE)
	$(INSTALL) -i$(EXITFLAG) pcal.hlp%/usr/lib/ua $(INSDIR) $(PROTOFILE)
	$(INSTALL) -i$(EXITFLAG) pcal.hlp%/etc/fixes $(INSDIR) $(PROTOFILE)

clobber:
	rm -f *.o pcal

clean:
	rm -f *.o

id.c: pcal.sl
	mkslid > id.c

populate:
	getunit; rm -f _*; aget -k -M

include Makeincludes
include $(MAKEINC)/Makepost.h
