# 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=/usr/local/pc532-mach/DIST/include

MACH_KERNEL=	/usr/local/pc532-mach/mach
LIBMACH=	/usr/local/pc532-mach/machlibs/libmach
LIBTHREADS=	/usr/local/pc532-mach/machlibs/threads

PATH := /usr/local/pc532-mach/DIST/bin:$(PATH)

HDRNAMS=exc mach_host mach_port memory_object_default default_pager_object

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

all:


install:
	-mkdir $(INCDIR)/mach
	cp -f $(MACH_KERNEL)/mach/*.h $(INCDIR)/mach
	cp -f $(MACH_KERNEL)/mach/*.defs $(INCDIR)/mach
	-mkdir $(INCDIR)/mach/ns532
	-ln -s ns532 $(INCDIR)/mach/machine
	cp -f $(MACH_KERNEL)/mach/ns532/*.h $(INCDIR)/mach/ns532
	-mkdir $(INCDIR)/ns532
	-ln -s ns532 $(INCDIR)/machine
	cp -f $(MACH_KERNEL)/ns532/*.h $(INCDIR)/ns532
	cp -f $(MACH_KERNEL)/ns532/PC532/*.h $(INCDIR)/ns532
	-mkdir $(INCDIR)/device
	cp -f $(MACH_KERNEL)/device/*.h $(INCDIR)/device
	cp -f $(MACH_KERNEL)/device/*.defs $(INCDIR)/device
	-mkdir $(INCDIR)/kern
	cp -f $(MACH_KERNEL)/kern/*.h $(INCDIR)/kern
	-mkdir $(INCDIR)/mach_debug
	cp -f $(MACH_KERNEL)/mach_debug/* $(INCDIR)/mach_debug
	cp -f $(LIBMACH)/*.h $(INCDIR)
	cp -f $(LIBMACH)/ns532/*.h $(INCDIR)/ns532
	cp -f $(LIBTHREADS)/cthreads.h $(INCDIR)
	cp -f $(MACH_KERNEL)/sys/*.h $(INCDIR)
	cp -f $(LIBTHREADS)/ns532/cthreads.h $(INCDIR)/ns532
	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

	mig -I$(INCDIR) -server /dev/null -user /dev/null \
		-header $(INCDIR)/mach/default_pager.h \
		$(INCDIR)/mach/default_pager.defs