# Copyright (c) 1993 Xerox Corporation.  All rights reserved.
#
#-$Id$
#
#-$Date$
#

#
# VERY IMPORTANT:
#   NO target-config-dependent things go in in Makefile directly.
#   ALL target-config-dependent things go in config.mk, below.
#
#

#
# include config.mk here to define:
#
#   CC - C compiler
#   CONFIG←CPPFLAGS
#   CONFIG←CFLAGS
#
#   ASPP - assembler preprocessor (CPP)
#   CONFIG←ASPPFLAGS
#
#   AS - assembler
#   CONFIG←ASFLAGS
#
#   LDR - loader for reloadable modules
#   CONFIG←LDRFLAGS
#
#   LD - loader
#   CONFIG←LDFLAGS
#
#   INCLUDE -- search path for header files  
#


include ../config/config.mk

#
# locations of object files
#

INSTALL←LIB = ../lib
INSTALL←BIN = ../bin

#
# compilation flags, etc.
#

CPPFLAGS = $(INCLUDE) $(CONFIG←CPPFLAGS) -DPCR←NO←HOSTDEP←ERR \
	-DPCR←NO←RENAME
CFLAGS	=-c $(CONFIG←CFLAGS)

ASPPFLAGS  = $(INCLUDE) $(CONFIG←ASPPFLAGS) -DPCR←NO←HOSTDEP←ERR -DASM

ASFLAGS	= $(CONFIG←ASFLAGS)

LDRFLAGS = $(CONFIG←LDRFLAGS)

LDGFLAGS = $(CONFIG←LDGFLAGS)

LDFLAGS = $(CONFIG←LDFLAGS)

#
# standard commands and default rules
#


INSTALL = cp -p


.s.o:
	$(ASPP) $(ASPPFLAGS) $< > tmp.s ; $(AS) $(ASFLAGS) tmp.s -o $@ ; \
		rm -f tmp.s

.c.o:
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<  -o $@

#
#
#
#
# BEGIN PACKAGE-SPECIFIC PART
#
#
#
#

#
# Default target
#

default: mkxr.o


#
# SOURCE FILE DEFINITION
#
# define CSRC SSRC MISCSRC HDEFS MISCDEFS.
#
# define MAKEDEP←MISCSRC = commands to make MISCSRC dependencies
#   (dependencies for .c and .s files are done automatically).
#

CSRC = XR←GCImpl.c XR←ILImpl.c XR←ThreadsImpl.c \
	XR←ThreadsDynamicEnvironment.c \
	XR←UIOImpl.c XR←UIOCompatImpl.c \
	XR←DummiesImpl.c XR←SpawnImpl.c XR←StackPushTestImpl.c \
	XR←ThreadsTerminationImpl.c XR←UIOEventsImpl.c XR←DummyCirioImpl.c \
	XR←InstallAndRunPackage.c dummy←malloc.c

SSRC = 

MISCSRC =

SRC = $(CSRC) $(SSRC) $(MISCSRC)

MAKEDEP←MISCSRC =


HDEFS = XR←Basics.h XR←GC.h XR←IL.h XR←Threads.h \
	XR←ThreadsDynamicEnvironment.h XR←UIO.h \
	XR←errno.h XR←fcntl.h XR←poll.h XR←stropts.h \
	XR←sys←dirent.h XR←sys←fbio.h XR←sys←file.h XR←sys←filio.h \
	XR←sys←ipc.h XR←sys←kbio.h XR←sys←mman.h XR←sys←shm.h \
	XR←sys←signal.h XR←sys←socket.h XR←sys←sockio.h XR←sys←stat.h \
	XR←sys←time.h XR←sys←types.h

MISCDEFS =

DEFS = $(HDEFS) $(MISCDEFS)

#
#
# INSTALL DEFINITION
#
# define INSTALL←LIBFILES = targets to be copied into INSTALL←LIB
# define INSTALL←BINFILES = targets to be copied into INSTALL←BIN
#

INSTALL←BINFILES = 
INSTALL←LIBFILES = 


#
# package-specific definitions and rules
#

COBJ = XR←GCImpl.o XR←ILImpl.o XR←ThreadsImpl.o \
	XR←ThreadsDynamicEnvironment.o \
	XR←UIOImpl.o XR←UIOCompatImpl.o \
	XR←DummiesImpl.o XR←SpawnImpl.o XR←StackPushTestImpl.o \
	XR←ThreadsTerminationImpl.o XR←UIOEventsImpl.o XR←DummyCirioImpl.o

SOBJ = 

MISCOBJ = 



xr.o: $(COBJ)
	$(LDR) $(LDRFLAGS) -o xr.o $(COBJ)

# FIX THIS LATER so it works in either 4.x or solaris
# for now, this produces lots of error messages and a trashy libxr.so
# in 4.1.  But you won't need the libxr.so on that system so ignore it.

libxr.so: xr.o
	$(LD) $(LDGFLAGS) -o libxr.so xr.o

mkxr.o:
	$(MAKE) xr.o libxr.so XR←InstallAndRunPackage.o dummy←malloc.o

#
#
#
#
# END PACKAGE-SPECIFIC PART
#
#
#
#

#
#
# STANDARD TARGETS
#
#

#
# make install
#

install:  $(INSTALL←LIBFILES) $(INSTALL←BINFILES)
	if [ -n "$(INSTALL←LIBFILES)" ] ; then \
		( cd $(INSTALL←LIB) ; rm -f $(INSTALL←LIBFILES) ) ; \
		$(INSTALL) $(INSTALL←LIBFILES) $(INSTALL←LIB) ; \
	fi
	if [ -n "$(INSTALL←BINFILES)" ] ; then \
		( cd $(INSTALL←BIN) ; rm -f $(INSTALL←BINFILES) ) ; \
		$(INSTALL) $(INSTALL←BINFILES) $(INSTALL←BIN) ; \
	fi


#
# make clean
#

clean:
	rm -f *.o *~ core a.out *.a *.BAK *.bak *.CKP logmsg.txt pcr

#
# make depend
#
# NOTE: the makefile must include "# DO NOT DELETE THIS LINE" 
#   and at least one additional line of text after the last target.
#   "make depend" will replace everything following that line
#   by a newly-constructed list of dependencies.
#
# You can modify the behavior of this target by defining $(MAKEDEP←MISCSRC).
#

makedep: $(CSRC) $(SSRC) $(MISCSRC)
	rm -f makedep
	$(MAKEDEP←MISCSRC)
	for x in $(CSRC) END ; \
		do if [ $$x != END ]; then \
			$(CPP) -M $(CPPFLAGS) $$x \
			| sed -e '/:$$/d' >> makedep ; \
			fi ; \
		done
	for x in $(SSRC) END ; \
		do if [ $$x != END ]; then \
			$(ASPP) -M $(ASPPFLAGS) $$x \
			| sed -e '/:$$/d' \
			| sed -e 's/[.]s[.]o :/.o :/g' >> makedep ; \
			fi ; \
		done

depend: makedep 
	echo '/↑# DO NOT DELETE THIS LINE/,$$c' > eddep
	echo '# DO NOT DELETE THIS LINE' >> eddep
	echo '# Make depend depends on it' >> eddep
	echo '.' >> eddep
	echo '$$r makedep' >> eddep
	echo 'w' >> eddep
	rm -f Makefile.bak
	mv Makefile Makefile.bak
	cp Makefile.bak Makefile
	chmod u+w Makefile
	ex - Makefile < eddep
	if [ ! -w Makefile.bak ] ; then chmod u-w Makefile ; fi
	rm -f eddep makedep

#
#
# END OF HUMAN-EDITABLE PART
#
#

#
#-$Log$
#

#
# DO NOT DELETE THIS LINE
# Make depend depends on it
XR←GCImpl.o : XR←GCImpl.c ../xr/XR←Basics.h ../xr/XR←GC.h ../posix/stddef.h \
  ../posix/host/stddef.h ../xr/XR←Threads.h ../th/PCR←Th.h \
  ../config/PCR←Arch.h ../config/PCR←StdDefs.h ../config/PCR←StdTypes.h \
  ../sig/PCR←Sig.h ../config/PCR←OS.h ../sig/PCR←SigTypes.h \
  ../th/PCR←ThTypes.h ../base/PCR←Base.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../mm/PCR←MM.h \
  /import/gc/src/gc←private.h /import/gc/src/gc.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h /import/gc/src/gc←headers.h ../posix/time.h \
  ../host/time.h 
XR←ILImpl.o : XR←ILImpl.c ../config/PCR←OS.h ../xr/XR←Basics.h \
  ../xr/XR←Threads.h ../th/PCR←Th.h ../config/PCR←Arch.h \
  ../config/PCR←StdDefs.h ../config/PCR←StdTypes.h ../sig/PCR←Sig.h \
  ../sig/PCR←SigTypes.h ../th/PCR←ThTypes.h ../xr/XR←IL.h \
  ../xr/XR←sys←types.h ../xr/XR←errno.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h ../base/PCR←Base.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../mm/PCR←MM.h ../posix/stddef.h \
  ../posix/host/stddef.h ../il/PCR←IL.h ../il/PCR←DataSource.h \
  ../il/PCR←ILPvt.h ../il/PCR←ILSym.h ../il/PCR←ILRdr.h ../il/PCR←ILZone.h \
  ../io/PCR←IO.h ../posix/sys/types.h ../posix/host/sys/types.h \
  /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h ../posix/dirent.h \
  ../posix/host/dirent.h /usr/include/sys/dirent.h ../posix/sys/stat.h \
  ../host/sys/stat.h ../posix/fcntl.h ../host/fcntl.h \
  /usr/include/sys/fcntlcom.h ../posix/utime.h ../host/utime.h \
  ../cmd/PCR←Cmd.h 
XR←ThreadsImpl.o : XR←ThreadsImpl.c ../xr/XR←Basics.h ../xr/XR←Threads.h \
  ../th/PCR←Th.h ../config/PCR←Arch.h ../config/PCR←StdDefs.h \
  ../config/PCR←StdTypes.h ../sig/PCR←Sig.h ../config/PCR←OS.h \
  ../sig/PCR←SigTypes.h ../th/PCR←ThTypes.h ../th/PCR←ThData.h \
  ../base/PCR←Base.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../mm/PCR←MM.h ../posix/stddef.h \
  ../posix/host/stddef.h ../posix/signal.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/setjmp.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h 
XR←ThreadsDynamicEnvironment.o : XR←ThreadsDynamicEnvironment.c \
  ../th/PCR←ThData.h ../config/PCR←Arch.h ../config/PCR←StdTypes.h \
  ../sig/PCR←SigTypes.h ../config/PCR←OS.h ../th/PCR←ThDynEnv.h \
  ../base/PCR←Base.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../xr/XR←Basics.h \
  ../xr/XR←ThreadsDynamicEnvironment.h 
XR←SpawnImpl.o : XR←SpawnImpl.c ../xr/XR←UIO.h ../xr/XR←Threads.h \
  ../xr/XR←Basics.h ../th/PCR←Th.h ../config/PCR←Arch.h \
  ../config/PCR←StdDefs.h ../config/PCR←StdTypes.h ../sig/PCR←Sig.h \
  ../config/PCR←OS.h ../sig/PCR←SigTypes.h ../th/PCR←ThTypes.h \
  ../xr/XR←sys←types.h ../xr/XR←errno.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h ../xr/XR←fcntl.h ../posix/fcntl.h ../host/fcntl.h \
  /usr/include/sys/fcntlcom.h /usr/include/sys/stdtypes.h ../posix/sys/stat.h \
  ../host/sys/stat.h ../posix/sys/types.h ../posix/host/sys/types.h \
  /usr/include/sys/sysmacros.h ../xr/XR←poll.h ../xr/XR←stropts.h \
  /import/gnu/lib/gcc-include/stropts.h \
  /import/gnu/lib/gcc-include/sys/ioccom.h ../xr/XR←sys←dirent.h \
  /usr/include/sys/dirent.h ../xr/XR←sys←fbio.h \
  /import/gnu/lib/gcc-include/sun/fbio.h ../xr/XR←sys←file.h \
  ../xr/XR←sys←filio.h /import/gnu/lib/gcc-include/sys/filio.h \
  ../xr/XR←sys←ipc.h /usr/include/sys/ipc.h ../xr/XR←sys←kbio.h \
  /import/gnu/lib/gcc-include/sundev/kbio.h ../xr/XR←sys←mman.h \
  ../shm/PCR←ShmBSD.h ../host/sys/mman.h ../xr/XR←sys←shm.h \
  /usr/include/sys/shm.h /usr/include/sys/param.h \
  /usr/include/machine/param.h /usr/include/sys/signal.h \
  /usr/include/vm/faultcode.h /usr/include/machine/mmu.h \
  /usr/include/debug/debug.h /usr/include/mon/sunromvec.h \
  /usr/include/mon/openprom.h /usr/include/mon/obpdefs.h \
  ../xr/XR←sys←signal.h ../xr/XR←sys←socket.h ../posix/sys/socket.h \
  ../io/PCR←IOSocket.h ../host/sys/socket.h ../posix/host/sys/sockio.h \
  ../posix/host/netinet/in.h ../posix/host/netinet/tcp.h \
  ../xr/XR←sys←sockio.h ../posix/sys/sockio.h ../xr/XR←sys←stat.h \
  ../xr/XR←sys←time.h /usr/include/sys/time.h ../posix/time.h ../host/time.h 
XR←UIOImpl.o : XR←UIOImpl.c ../xr/XR←Basics.h ../xr/XR←UIO.h \
  ../xr/XR←Threads.h ../th/PCR←Th.h ../config/PCR←Arch.h \
  ../config/PCR←StdDefs.h ../config/PCR←StdTypes.h ../sig/PCR←Sig.h \
  ../config/PCR←OS.h ../sig/PCR←SigTypes.h ../th/PCR←ThTypes.h \
  ../xr/XR←sys←types.h ../xr/XR←errno.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h ../xr/XR←fcntl.h ../posix/fcntl.h ../host/fcntl.h \
  /usr/include/sys/fcntlcom.h /usr/include/sys/stdtypes.h ../posix/sys/stat.h \
  ../host/sys/stat.h ../posix/sys/types.h ../posix/host/sys/types.h \
  /usr/include/sys/sysmacros.h ../xr/XR←poll.h ../xr/XR←stropts.h \
  /import/gnu/lib/gcc-include/stropts.h \
  /import/gnu/lib/gcc-include/sys/ioccom.h ../xr/XR←sys←dirent.h \
  /usr/include/sys/dirent.h ../xr/XR←sys←fbio.h \
  /import/gnu/lib/gcc-include/sun/fbio.h ../xr/XR←sys←file.h \
  ../xr/XR←sys←filio.h /import/gnu/lib/gcc-include/sys/filio.h \
  ../xr/XR←sys←ipc.h /usr/include/sys/ipc.h ../xr/XR←sys←kbio.h \
  /import/gnu/lib/gcc-include/sundev/kbio.h ../xr/XR←sys←mman.h \
  ../shm/PCR←ShmBSD.h ../host/sys/mman.h ../xr/XR←sys←shm.h \
  /usr/include/sys/shm.h /usr/include/sys/param.h \
  /usr/include/machine/param.h /usr/include/sys/signal.h \
  /usr/include/vm/faultcode.h /usr/include/machine/mmu.h \
  /usr/include/debug/debug.h /usr/include/mon/sunromvec.h \
  /usr/include/mon/openprom.h /usr/include/mon/obpdefs.h \
  ../xr/XR←sys←signal.h ../xr/XR←sys←socket.h ../posix/sys/socket.h \
  ../io/PCR←IOSocket.h ../host/sys/socket.h ../posix/host/sys/sockio.h \
  ../posix/host/netinet/in.h ../posix/host/netinet/tcp.h \
  ../xr/XR←sys←sockio.h ../posix/sys/sockio.h ../xr/XR←sys←stat.h \
  ../xr/XR←sys←time.h /usr/include/sys/time.h ../posix/time.h ../host/time.h \
  ../th/PCR←ThCrSec.h ../th/PCR←ThCrSecInlines.h ../th/PCR←ThCurr.h \
  ../th/PCR←ThPvt.h ../th/PCR←ThData.h ../th/PCR←ThCtl.h \
  ../th/PCR←ThCtlTypes.h ../posix/limits.h ../posix/host/limits.h \
  ../posix/setjmp.h ../base/PCR←Base.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../vd/PCR←VD.h ../mm/PCR←MM.h \
  ../posix/stddef.h ../posix/host/stddef.h ../io/PCR←IO.h ../posix/dirent.h \
  ../posix/host/dirent.h ../posix/utime.h ../host/utime.h ../io/PCR←IOGbl.h \
  ../io/PCR←IOGblUFS.h ../host/poll.h ../posix/sys/utsname.h \
  ../host/sys/utsname.h ../ansi/string.h /usr/include/net/if.h 
XR←UIOCompatImpl.o : XR←UIOCompatImpl.c ../config/PCR←OS.h \
  ../xr/XR←Basics.h ../xr/XR←UIO.h ../xr/XR←Threads.h ../th/PCR←Th.h \
  ../config/PCR←Arch.h ../config/PCR←StdDefs.h ../config/PCR←StdTypes.h \
  ../sig/PCR←Sig.h ../sig/PCR←SigTypes.h ../th/PCR←ThTypes.h \
  ../xr/XR←sys←types.h ../xr/XR←errno.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h ../xr/XR←fcntl.h ../posix/fcntl.h ../host/fcntl.h \
  /usr/include/sys/fcntlcom.h /usr/include/sys/stdtypes.h ../posix/sys/stat.h \
  ../host/sys/stat.h ../posix/sys/types.h ../posix/host/sys/types.h \
  /usr/include/sys/sysmacros.h ../xr/XR←poll.h ../xr/XR←stropts.h \
  /import/gnu/lib/gcc-include/stropts.h \
  /import/gnu/lib/gcc-include/sys/ioccom.h ../xr/XR←sys←dirent.h \
  /usr/include/sys/dirent.h ../xr/XR←sys←fbio.h \
  /import/gnu/lib/gcc-include/sun/fbio.h ../xr/XR←sys←file.h \
  ../xr/XR←sys←filio.h /import/gnu/lib/gcc-include/sys/filio.h \
  ../xr/XR←sys←ipc.h /usr/include/sys/ipc.h ../xr/XR←sys←kbio.h \
  /import/gnu/lib/gcc-include/sundev/kbio.h ../xr/XR←sys←mman.h \
  ../shm/PCR←ShmBSD.h ../host/sys/mman.h ../xr/XR←sys←shm.h \
  /usr/include/sys/shm.h /usr/include/sys/param.h \
  /usr/include/machine/param.h /usr/include/sys/signal.h \
  /usr/include/vm/faultcode.h /usr/include/machine/mmu.h \
  /usr/include/debug/debug.h /usr/include/mon/sunromvec.h \
  /usr/include/mon/openprom.h /usr/include/mon/obpdefs.h \
  ../xr/XR←sys←signal.h ../xr/XR←sys←socket.h ../posix/sys/socket.h \
  ../io/PCR←IOSocket.h ../host/sys/socket.h ../posix/host/sys/sockio.h \
  ../posix/host/netinet/in.h ../posix/host/netinet/tcp.h \
  ../xr/XR←sys←sockio.h ../posix/sys/sockio.h ../xr/XR←sys←stat.h \
  ../xr/XR←sys←time.h /usr/include/sys/time.h ../posix/time.h ../host/time.h \
  ../ansi/string.h 
XR←DummiesImpl.o : XR←DummiesImpl.c ../config/PCR←OS.h ../ansi/string.h \
  ../posix/sys/types.h ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h 
XR←StackPushTestImpl.o : XR←StackPushTestImpl.c ../th/PCR←Th.h \
  ../config/PCR←Arch.h ../config/PCR←StdDefs.h ../config/PCR←StdTypes.h \
  ../sig/PCR←Sig.h ../config/PCR←OS.h ../sig/PCR←SigTypes.h \
  ../th/PCR←ThTypes.h 
XR←ThreadsTerminationImpl.o : XR←ThreadsTerminationImpl.c \
  ../base/PCR←Base.h ../config/PCR←StdTypes.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../mm/PCR←MM.h ../posix/stddef.h \
  ../posix/host/stddef.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h 
XR←UIOEventsImpl.o : XR←UIOEventsImpl.c ../base/PCR←Base.h \
  ../config/PCR←StdTypes.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h ../mm/PCR←MM.h ../posix/stddef.h \
  ../posix/host/stddef.h ../sig/PCR←Sig.h ../config/PCR←OS.h \
  ../sig/PCR←SigTypes.h ../sig/PCR←SigPvt.h ../th/PCR←ThData.h \
  ../config/PCR←Arch.h ../th/PCR←ThTypes.h ../th/PCR←ThPvt.h \
  ../th/PCR←ThCtl.h ../th/PCR←ThCtlTypes.h ../posix/limits.h \
  ../posix/host/limits.h ../posix/setjmp.h ../host/signal.h \
  /usr/include/sys/signal.h /usr/include/vm/faultcode.h \
  /usr/include/sys/stdtypes.h ../th/PCR←Th.h ../config/PCR←StdDefs.h \
  ../posix/errno.h ../host/errno.h /usr/include/sys/errno.h 
XR←DummyCirioImpl.o : XR←DummyCirioImpl.c 
XR←InstallAndRunPackage.o : XR←InstallAndRunPackage.c ../base/PCR←Base.h \
  ../config/PCR←StdTypes.h ../base/PCR←BaseArgs.h \
  /import/gnu/lib/gcc-include/stdarg.h 
dummy←malloc.o : dummy←malloc.c ../mm/PCR←MM.h ../config/PCR←StdTypes.h \
  ../posix/stddef.h ../posix/host/stddef.h