# Makefile to create mach include files
# Copyright (C) 1992 Free Software Foundation, Inc.
# This file is part of the GNU Hurd.
# 
# The GNU Hurd is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# The GNU Hurd is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with the GNU Hurd; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

INCDIR=/usr1/gnu/DIST/include

MACH_KERNEL=	/usr1/gnu/mach
LIBMACH=	/usr1/gnu/machlibs/libmach
LIBTHREADS=	/usr1/gnu/machlibs/threads

HDRNAMS=exc mach_host mach_port memory_object_default default_pager_object

HDRS=$(addsuffix .defs,$(HDRNAMS))

all:


install:
	-mkdir $(INCDIR)/mach
	cp $(MACH_KERNEL)/mach/*.h $(INCDIR)/mach
	cp $(MACH_KERNEL)/mach/*.defs $(INCDIR)/mach
	-mkdir $(INCDIR)/mach/i386
	-ln -s i386 $(INCDIR)/mach/machine
	cp $(MACH_KERNEL)/i386/mach/*.h $(INCDIR)/mach/i386
	cp $(MACH_KERNEL)/i386/mach/*.defs $(INCDIR)/mach/i386
	-mkdir $(INCDIR)/i386
	-ln -s i386 $(INCDIR)/machine
	cp $(MACH_KERNEL)/i386/i386/*.h $(INCDIR)/i386
	-mkdir $(INCDIR)/device
	cp $(MACH_KERNEL)/device/*.h $(INCDIR)/device
	cp $(MACH_KERNEL)/device/*.defs $(INCDIR)/device
	-mkdir $(INCDIR)/mach_debug
	cp $(MACH_KERNEL)/mach_debug/* $(INCDIR)/mach_debug
	cp $(LIBMACH)/*.h $(INCDIR)
	cp $(LIBTHREADS)/cthreads.h $(INCDIR)
	cp $(LIBTHREADS)/i386/cthreads.h $(INCDIR)/i386
	for file in $(addprefix $(MACH_KERNEL)/mach/,$(HDRS)); do \
		echo -n $$file... ; \
		mig -I$(INCDIR) -server /dev/null -user /dev/null \
			-header $(INCDIR)/mach/`basename $$file .defs`.h \
			$$file ; \
		echo done ; \
	done
	mig -I$(INCDIR) -server /dev/null -user /dev/null \
			-header $(INCDIR)/mach/memory_object_user.h \
			$(MACH_KERNEL)/mach/memory_object.defs
	mig -I$(INCDIR) -server /dev/null -user /dev/null \
			-header $(INCDIR)/mach/mach_interface.h \
			$(MACH_KERNEL)/mach/mach.defs
	for file in $(MACH_KERNEL)/i386/mach/*.defs; do \
		echo -n $$file... ; \
		mig -I$(INCDIR) -server /dev/null -user /dev/null \
			-header $(INCDIR)/mach/i386/`basename $$file .defs`.h \
			$$file ; \
		echo done ; \
	done
	for file in $(MACH_KERNEL)/device/*.defs; do \
		echo -n $$file... ; \
		mig -I$(INCDIR) -server /dev/null -user /dev/null \
			-header $(INCDIR)/device/`basename $$file .defs`.h \
			$$file ; \
		echo done ; \
	done
	mig -I$(INCDIR) -server /dev/null -user /dev/null \
		-header $(INCDIR)/mach_debug/mach_debug.h \
		$(INCDIR)/mach_debug/mach_debug.defs

