# Copyright (c) 1993 Xerox Corporation.  All rights reserved.
#

include ../config/config.mk

#
# locations of object files
#

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

#
# compilation flags, etc.
#


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

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

ASFLAGS	= $(CONFIG←ASFLAGS)

LDRFLAGS = $(CONFIG←LDRFLAGS)

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
#



# Fix to point to local pcr installation directory.
# PCRDIR= /project/ppcr/dev
PCRDIR= ..
CFLAGS= -DPCR $(CONFIG←CFLAGS)

# We assume that mach←dep.o has already been built by top level makefile.  It doesn't
# care about pcr vs UNIX, and we don't want to repeat that cruft.

# all: gc.o test.o gcpcr
all: gc.o

OBJS= alloc.o reclaim.o allochblk.o misc.o mach←dep.o os←dep.o mark←roots.o headers.o mark.o obj←map.o pcr←interface.o black←list.o finalize.o new←hblk.o real←malloc.o dynamic←load.o debug←malloc.o malloc.o stubborn.o 

CSRCS= reclaim.c allochblk.c misc.c alloc.c mach←dep.c os←dep.c mark←roots.c headers.c mark.c obj←map.c pcr←interface.c black←list.c finalize.c new←hblk.c real←malloc.c dynamic←load.c debug←malloc.c malloc.c stubborn.c

SHELL= /bin/sh

gcpcr: gc.o test.o $(PCRDIR)/base/pcr.o $(PCRDIR)/base/PCR←BaseMain.o
	$(CC) -o gcpcr $(PCRDIR)/base/pcr.o $(PCRDIR)/base/PCR←BaseMain.o gc.o test.o -ldl

gc.o: $(OBJS)
	-ld -r -o gc.o $(OBJS)

#
# Dependency construction
#
# NOTE: the makefile must include "# DO NOT DELETE THIS LINE" after the
#   last target.  "make depend" will replace everything following that line
#   by a newly-constructed list of dependencies.
#
old-depend: $(CSRCS)
	rm -f makedep eddep ; \
    gcc -M $(CFLAGS) $(CSRCS) \
			| sed -e '/:$$/d' > makedep ; \
    echo '/↑# DO NOT DELETE THIS LINE/+1,$$d' >eddep ; \
	echo '$$r makedep' >>eddep ; \
	echo 'w' >>eddep ; \
	cp PCR-Makefile PCR-Makefile.bak ; \
	ex - PCR-Makefile < eddep ; \
	rm -f eddep makedep
	touch depend
	
makedep: $(CSRCS) 
	rm -f makedep
	-for x in $(CSRCS) END ; \
		do if [ $$x != END ]; then \
			$(CPP) -M $(CPPFLAGS) $$x \
			| sed -e '/:$$/d' >> 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 PCR-Makefile.bak
	mv PCR-Makefile PCR-Makefile.bak
	cp PCR-Makefile.bak PCR-Makefile
	chmod u+w PCR-Makefile
	ex - PCR-Makefile < eddep
	-if [ ! -w PCR-Makefile.bak ] ; then chmod u-w PCR-Makefile ; fi
	rm -f eddep makedep
	



	
# DO NOT DELETE THIS LINE
# Make depend depends on it
reclaim.o : reclaim.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
allochblk.o : allochblk.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
misc.o : misc.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h ../posix/signal.h ../sig/PCR←Sig.h \
  ../config/PCR←OS.h ../sig/PCR←SigTypes.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/time.h \
  ../host/time.h 
alloc.o : alloc.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h ../posix/signal.h ../sig/PCR←Sig.h \
  ../config/PCR←OS.h ../sig/PCR←SigTypes.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/time.h \
  ../host/time.h 
mach←dep.o : mach←dep.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h ../ansi/stdio.h \
  ../config/PCR←StdTypes.h /import/gnu/lib/gcc-include/stdarg.h \
  ../posix/setjmp.h ../config/PCR←Arch.h 
os←dep.o : os←dep.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h ../ansi/stdio.h \
  ../config/PCR←StdTypes.h /import/gnu/lib/gcc-include/stdarg.h \
  ../posix/signal.h ../sig/PCR←Sig.h ../config/PCR←OS.h ../sig/PCR←SigTypes.h \
  /usr/include/sys/mman.h /usr/include/sys/syscall.h 
mark←roots.o : mark←roots.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
headers.o : headers.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
mark.o : mark.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
obj←map.o : obj←map.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
pcr←interface.o : pcr←interface.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
black←list.o : black←list.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
finalize.o : finalize.c gc.h ../posix/stddef.h ../posix/host/stddef.h \
  gc←private.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
new←hblk.o : new←hblk.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
real←malloc.o : real←malloc.c 
dynamic←load.o : dynamic←load.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h ../ansi/stdio.h \
  ../config/PCR←StdTypes.h /import/gnu/lib/gcc-include/stdarg.h \
  /usr/include/dlfcn.h /usr/include/link.h /usr/include/a.out.h \
  /usr/include/machine/a.out.h /usr/include/sys/exec.h 
debug←malloc.o : debug←malloc.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
malloc.o : malloc.c ../ansi/stdio.h ../config/PCR←StdTypes.h \
  /import/gnu/lib/gcc-include/stdarg.h ../posix/stddef.h \
  ../posix/host/stddef.h gc←private.h gc.h config.h ../posix/errno.h \
  ../host/errno.h /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h 
stubborn.o : stubborn.c gc←private.h gc.h ../posix/stddef.h \
  ../posix/host/stddef.h config.h ../posix/errno.h ../host/errno.h \
  /usr/include/sys/errno.h gc←headers.h ../posix/sys/types.h \
  ../posix/host/sys/types.h /usr/include/sys/stdtypes.h \
  /usr/include/sys/sysmacros.h ../posix/time.h ../host/time.h