# 
# $Id: Makefile,v 1.18 1997/05/23 20:51:29 fdh Exp $
#
# Revision History:
#
# $Log: Makefile,v $
# Revision 1.18  1997/05/23  20:51:29  fdh
# Modified to create .obj rather than .o files to
# avoid a problem with the nmake files.
#
# Revision 1.17  1996/06/24  14:58:03  fdh
# Removed obsolete definitions.
#
# Revision 1.16  1996/06/17  16:15:40  fdh
# Modified DEFINES definition used to build the PALcode.
#
# Revision 1.15  1995/12/13  18:37:54  fdh
# Added rcsclean to the clean: target.
#
# Revision 1.14  1995/11/30  21:01:15  fdh
# Added junk files to clean: target
#
# Revision 1.13  1995/02/06  18:01:28  samberg
# Create ISP_EGORE for vice, eliminate config.h
#
# Revision 1.12  1994/09/07  18:08:54  samberg
# No KDEBUG, use Makefile.kdebug
#
# Revision 1.11  1994/09/07  16:50:23  samberg
# Add DISABLE_CRD
#
# Revision 1.10  1994/09/07  15:25:20  samberg
# Modified for use with Makefile.vpp, take out -DOSF
#
# Revision 1.9  1994/07/08  17:06:28  samberg
# Changes for platform specific additions
#
# Revision 1.8  1994/05/20  18:06:56  ericr
# Changed TOOLDIR macro to EB_TOOLBOX
#
# Revision 1.7  1994/01/31  19:13:48  ericr
# Define CPP to use /usr/bin/cpp
#
# Revision 1.6  1994/01/26  15:17:02  ericr
# Regenerate dependencies - logout.h incorporated into impure.h
#
# Revision 1.5  1994/01/18  20:26:44  ericr
# Regenerate dependencies
#
# Revision 1.4  1994/01/17  15:33:53  ericr
# Added impure.h and logout.h header files
#
# Revision 1.3  1993/12/23  16:46:41  ericr
# Removed rcsget dependency on target depend
#
# Revision 1.2  1993/12/20  16:36:06  eric
# Added PVC_CPU environment variable to pvc target
#
# Revision 1.1  1993/12/16  22:42:57  eric
# Initial revision
#
#

include ../../.config
include $(KSRC)/.config

ifdef MINI_BUILD_PALCODE_FROM_SOURCES

AS		= as
LD		= ld
CPP		= /lib/cpp -lang-c++ $(CPPFLAGS)
STRIP		= quickstrip
CSTRIP		= ../../tools/strip/cstrip
ECHO 		= echo


#
# Define KDEBUG if you want a special unprivileged CALL_PAL 
# breakpoint trap handler for remote kernel debugging.
#
# Define CONSOLE_ENTRY to change the sys$enter_console
# transfer address.  Default CONSOLE_ENTRY value is 0x10000.
#
# Define DISABLE_CRD to disable CRD. Note that reset sets MCES so that
# correctable errors are ignored anyway, but this actually stops the
# interrupt.
#

DEFINES 	= -DCONSOLE_ENTRY=0x210000 -DDC21164PC -DSX164
LDFLAGS		= -e Pal_Reset -T ../osfpal.ld -N
ASFLAGS   	= -m21164

# Source files:
#
#   This is the only block in which the list of source files should change.
#
#	SFILES - assembler source files
#	HFILES - header files
#

SFILES	= osfpal.S \
	  platform.S

HFILES	= dc21164.h \
	  osf.h \
	  macros.h \
	  impure.h \
	  platform.h \
	  cserve.h

# Intermediate files:
#
#   This block should not change.
#

IFILES	= $(SFILES:.S=.i)

# Object files:
#
#   This block should not change.
#

.SUFFIXES:
.SUFFIXES: .S .i

.S.i:
	$(CPP) $(DEFINES) $< > $*.i

osfpal.nh: osfpal
	$(CSTRIP) -a osfpal $@

osfpal: osfpal.o
	$(LD) $(LDFLAGS) -o $@ osfpal.o

osfpal.o: osfpal.i platform.i
	$(AS) $(ASFLAGS) -o $@ osfpal.i platform.i

pvc: osfpal.lis osfpal.nh osfpal.ent osfpal.map
	(export PVC_PAL PVC_ENTRY PVC_MAP PVC_CPU;	\
	 PVC_PAL=osfpal.nh;				\
	 PVC_ENTRY=osfpal.ent;				\
	 PVC_MAP=osfpal.map;				\
	 PVC_CPU=ev5;					\
	 $(PVC);)

osfpal.lis: osfpal
	$(DIS) osfpal > $@

osfpal.map: osfpal
	$(DIS) -m osfpal > $@

depend:
	@cat < /dev/null > makedep
	@(for i in $(SFILES); do echo $$i; \
	    $(MAKEDEP) $(MYDEFINES) $$i | 					\
		awk '{ if ($$1 != prev) {if (rec != "") print rec; 		\
		    rec = $$0; prev = $$1; } 					\
		    else { if (length(rec $$2) > 78) { print rec; rec = $$0; } 	\
		    else rec = rec " " $$2 } }		 			\
		    END { print rec }' | sed 's/\.o/\.i/'			\
		    >> makedep; done)
	@echo '/^# DO NOT DELETE THIS LINE/+1,$$d' > eddep
	@echo '$$r makedep' >> eddep
	@echo 'w' >> eddep
	@cp Makefile Makefile.bak
	@ed - Makefile < eddep
	@rm -f eddep makedep
	@echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
	@echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
	@echo '# see make depend above' >> Makefile

clean:
	rm -f core osfpal.o $(IFILES)
	rcsclean

clobber: clean
	rm -f osfpal.lis osfpal.nh osfpal.map osfpal

# DO NOT DELETE THIS LINE
osfpal.i:	osfpal.S ./dc21164.h ./osf.h ./macros.h ./impure.h
platform.i:	platform.S ./dc21164.h ./osf.h ./macros.h ./impure.h ./cserve.h ./platform.h
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above

endif
