#
# Mach Operating System
# Copyright (c) 1990 Carnegie-Mellon University
# All rights reserved.  The CMU software License Agreement specifies
# the terms and conditions for use and redistribution.
#
#
# HISTORY
# $Log:	Makefile,v $
# Revision 2.2  90/06/02  15:04:16  rpd
# 	Don't use /usr/cs/etc/install; 386 doesn't have it.
# 	[90/06/01            rpd]
# 
# 	Created for new IPC.
# 	[90/03/26  21:09:47  rpd]
# 
#

INSTALL	=	/usr/cs/etc/install -q -c

all:		mig.sh migcom.x

install:	mig.install

mig.install:	$(DDIR)/mig

$(DDIR)/mig:	mig.sh
	cp -p mig.sh $(DDIR)/mig
	chmod 755 $(DDIR)/mig

migcom.install:	$(DDIR)/migcom

$(DDIR)/migcom:	migcom.x
	cp -p migcom.x $(DDIR)/migcom
	strip $(DDIR)/migcom
	chmod 755 $(DDIR)/migcom


OBJS	 =	mig.o parser.o lexxer.o error.o string.o type.o routine.o \
		statement.o global.o header.o user.o server.o utils.o

# Base of source tree.  Look here for include files.
IDIR = ../..

PMAXCFLAGS = -Dvoid=int
SUNCFLAGS = -Dvoid=int
CFLAGS= $(CDEBUGFLAGS) $($(MACHINE)CFLAGS) -I$(IDIR)

migcom.x:	$(OBJS)
	$(CC) -o migcom.x $(CFLAGS) $(OBJS) -ll

.c.o:
	$(CC) -c -MD $(CFLAGS) $*.c
	md -u Makedep -d $*.d

parser.c parser.h:	parser.y
	yacc -d parser.y &&		\
	mv y.tab.c parser.c &&		\
	mv y.tab.h parser.h

lexxer.c:	lexxer.l
	lex lexxer.l &&			\
	mv lex.yy.c lexxer.c

LIBBASE = $(MAKECONF:h)/../../../release/@sys/${BCSBBASE?$(BCSBBASE:t):latest}/lib
BINBASE = $(MAKECONF:h)/../../../release/@sys/${BCSBBASE?$(BCSBBASE:t):latest}/bin
OBJBASE = $(MAKECONF:h)/../../../obj/@sys/${BCSBBASE?$(BCSBBASE:t):latest}/kernel

release:
	-if [ -f $(LIBBASE)/migcom ]; then true ; else ln -s $(OBJBASE)/lib/migcom $(LIBBASE) ; fi
	-if [ -f $(BINBASE)/mig ]; then true ; else ln -s $(OBJBASE)/bin/mig $(BINBASE) ; fi

-include Makedep
