#
# 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 
# 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 the
# rights to redistribute these changes.
#
#
# HISTORY
# $Log:	Makefile,v $
# Revision 2.10  92/04/08  23:19:33  rpd
# 	Added cross-compilation support.
# 	[92/03/18            jvh]
# 
# Revision 2.9  92/03/05  22:46:07  rpd
# 	Changed to use double-colon rules for top-level targets.
# 	[92/02/28            rpd]
# 
# Revision 2.8  92/02/20  12:05:02  elf
# 	Changed LIBCS and DEPCS to LIBCMUCS and DEPCMUCS.
# 	[92/02/20            elf]
# 
# Revision 2.7  92/01/24  18:15:42  rpd
# 	Removed mkswapconf.o.
# 	[92/01/24            rpd]
# 
# Revision 2.6  92/01/23  15:21:02  rpd
# 	Created.
# 	[92/01/23            rpd]
# 

include ${MAKETOP}Makefile-common

all :: config

install :: ${HOST_INSTALLDIR}/bin/config

release :: ${HOST_TRELEASEDIR}/bin/config

clean ::
	${RM} ${HOST_INSTALLDIR}/bin/config

# installation rules

${HOST_INSTALLDIR}/bin/config : config
	${RM} $@
	${CP} $? $@
	${HOST_STRIP} $@
	${CHMOD_BIN} $@

# release rules

${HOST_TRELEASEDIR}/bin/config : ${HOST_FRELEASEDIR}/bin/config
	${RM} $@
	${CP} $? $@

# build rules

DEFS = -DCMU

OBJS = y.tab.o main.o lex.yy.o mkioconf.o mkmakefile.o \
	mkglue.o mkheaders.o

# config uses fopenp from libcmucs.a

LIBS = ${LIBL} ${LIBCMUCS}
DEPS = ${DEPL} ${DEPCMUCS} ${DEPCRT0}

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

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

lex.yy.c : config.l
	lex config.l

y.tab.h y.tab.c : config.y
	yacc -d config.y

lex.yy.o main.o mkioconf.o mkmakefile.o mkglue.o mkheaders.o : y.tab.h

-include Makedep
