# 
# Mach Operating System
# Copyright (c) 1991 Carnegie Mellon University
# All Rights Reserved.
# 
# Permission to use, copy, modify and distribute this software and its
# documentation is hereby granted, provided that both the copyright
# notice and this permission notice appear in all copies of the
# software, derivative works or modified versions, and any portions
# thereof, and that both notices appear in supporting documentation.
# 
# CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
# CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
# ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
# 
# Carnegie Mellon requests users of this software to return to
# 
#  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
#  School of Computer Science
#  Carnegie Mellon University
#  Pittsburgh PA 15213-3890
# 
# any improvements or extensions that they make and grant Carnegie Mellon
# the rights to redistribute these changes.
#
#
# HISTORY
# $Log:	Makefile,v $
# Revision 2.10  92/04/08  23:19:03  rpd
# 	Changed to use LDLIBS.
# 	[92/03/24            rpd]
# 
# Revision 2.9  92/03/05  22:45:46  rpd
# 	Changed to use double-colon rules for top-level targets.
# 	[92/02/28            rpd]
# 
# Revision 2.8  92/02/20  11:59:53  elf
# 	Moved LUNA88K_LIBS definition to Makefile-common.
# 	[92/02/20            danner]
# 
# Revision 2.7  92/02/19  15:05:54  elf
# 	Replaced *.internal stuff with Makefile-version.
# 	Moved printf to libmach_sa.
# 	[92/02/10            rpd]
# 
# Revision 2.6  92/02/18  17:59:16  elf
# 	Added pickup of libgcc.a for luna.
# 	[92/01/22  18:16:32  danner]
# 
# Revision 2.5  92/01/24  00:49:24  rpd
# 	Removed uses of MAKEPSD, to fix shadowing.
# 	[92/01/23            rpd]
# 
# Revision 2.4  92/01/23  15:19:37  rpd
# 	Revised for new Makefile organization.
# 	[92/01/16            rpd]
# 

include ${MAKETOP}Makefile-common
# more definitions, for using xstrip
include ${MAKETOP}Makefile-xstrip

# find machine-dependent files in machine subdirectory

VPATH = .:${cpu}

# We want the MK version to be part of the bootstrap name.
# Makefile-version defines VERSION for us.

include ${MAKETOP}Makefile-version
BOOTSTRAP = bootstrap.${VERSION}

all bootstrap :: ${BOOTSTRAP}

install :: ${INSTALLDIR}/special/${BOOTSTRAP}

release :: ${TRELEASEDIR}/special/${BOOTSTRAP}

clean ::
	${RM} ${INSTALLDIR}/special/${BOOTSTRAP}

# installation rules

${INSTALLDIR}/special/${BOOTSTRAP} : ${BOOTSTRAP}
	${RM} $@
	${CP} $? $@
	${XSTRIP} $@
	${CHMOD_BIN} $@

# release rules

${TRELEASEDIR}/special/${BOOTSTRAP} : ${FRELEASEDIR}/special/${BOOTSTRAP}
	${RM} $@
	${CP} $? $@

# build rules

OBJS =	bootstrap.o def_pager_setup.o default_pager.o \
	exec.o file_io.o kalloc.o load.o strfcns.o wiring.o

LIBS = ${LIBTHREADS} ${LIBMACH_SA}
DEPS = ${DEPTHREADS} ${DEPMACH_SA} ${DEPCRT0}

${BOOTSTRAP} : ${OBJS}
	${RM} $@ $@.out
	${DEPS/%/$@} \
	${LD} -z -o $@.out ${LDFLAGS} ${CRT0} ${OBJS} ${LIBS} ${LDLIBS} && \
	${MV} $@.out $@

-include Makedep
