# 
# Mach Operating System
# Copyright (c) 1992 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-host-bin,v $
# Revision 2.2  92/04/08  23:26:47  rpd
# 	Created.
# 	[92/03/29            jvh]
# 

# Makefile-host-bin is used as Makefile-bin,
# except that it is intended for host-machine binaries.

HOST_IBINTARGET = ${HOST_INSTALLDIR}/${BINDIR}${PROGRAM}

HOST_TBINTARGET = ${HOST_TRELEASEDIR}/${BINDIR}${PROGRAM}

HOST_FBINTARGET = ${HOST_FRELEASEDIR}/${BINDIR}${PROGRAM}

# Top-level targets:
# If the Makefile wants to do more stuff, it can also have its own
# all/install/release/clean rules.

all :: ${PROGRAM}

install :: ${HOST_IBINTARGET}

release :: ${HOST_TBINTARGET}

clean ::
	${RM} ${HOST_IBINTARGET}

# installation rules

${HOST_IBINTARGET} : ${PROGRAM}
	${RM} $@
	${CP} $? $@
	${HOST_STRIP} $@
	${CHMOD_BIN} $@

# release rules

${HOST_TBINTARGET} : ${HOST_FBINTARGET}
	${RM} $@
	${CP} $? $@

# build rules

LIBS = ${LIBRARIES/.*/${LIB&}}
DEPS = ${LIBRARIES/.*/${DEP&}} ${DEPCRT0}

${PROGRAM} : ${OBJECTS}
	${RM} $@ $@.out
	${USE_HOST_PATHS} ${DEPS/%/$@} \
	${HOST_CC} -o $@.out ${HOST_CFLAGS} ${OBJECTS} ${LIBS} && \
	${MV} $@.out $@

.c.o:
	${USE_HOST_PATHS} ${HOST_CC} -c ${HOST_CFLAGS} $*.c
