# Copyright (C) 1991 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 1, 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.

GCC_EXEC_PREFIX=/usr/local/lib/gcc-
MK_INCLUDES=/usr1/mk/release/i386_mach/latest/include
CC=gcc
MACHSA_LIB=/usr1/mk/release/i386_mach/latest/lib/libmach_sa.a
MIGCOM=/usr1/mk/release/i386_mach/latest/lib/migcom
CTHREAD_LIB=/usr1/mk/release/i386_mach/latest/lib/libthreads.a
CPPFLAGS=-nostdinc -I. -I.. -I${MK_INCLUDES} \
	 -D__USE_GNU -D__GNU_SYSTEM
CFLAGS=-Wall -O -g

PROCESS_MIGOPTS=\
	"-DPROCESS_INTRAN=pstruct_t convert_port_to_pstruct (process_t)" \
	"-DPROCESS_IMPORTS=import \"proc.h\";" \
	"-DPROCSERVER"

OFILES=proc_subr.o proc_req.o processServer.o miscUser.o authUser.o \
	startupUser.o process_replyUser.o

proc: $(OFILES)
	$(CC) -nostdlib -e __start -o proc $(CFLAGS) $(OFILES) \
	../lib/libhurd.a $(MACHSA_LIB)

#$(OFILES) process.h misc.h: force
#force:

$(OFILES): proc.h misc.h process.h auth.h startup.h process_reply.h

process.h processServer.c: ../hurd/process.defs ../hurd/hurd_types.defs
	$(GCC_EXEC_PREFIX)cpp $(CPPFLAGS) $(PROCESS_MIGOPTS) \
		../hurd/process.defs \
	| $(MIGCOM) -sheader process.h -header /dev/null -user /dev/null

process_reply.h process_replyUser.c: ../hurd/process_reply.defs\
		 ../hurd/hurd_types.defs
	$(GCC_EXEC_PREFIX)cpp $(CPPFLAGS) ../hurd/process_reply.defs \
	| $(MIGCOM) -server /dev/null

misc.h miscUser.c: ../hurd/misc.defs ../hurd/hurd_types.defs
	$(GCC_EXEC_PREFIX)cpp $(CPPFLAGS) ../hurd/misc.defs \
	| $(MIGCOM) -header misc.h -server /dev/null

auth.h authUser.c: ../hurd/auth.defs ../hurd/hurd_types.defs
	$(GCC_EXEC_PREFIX)cpp $(CPPFLAGS) ../hurd/auth.defs \
	| $(MIGCOM) -header auth.h -server /dev/null

startup.h startupUser.c: ../hurd/startup.defs ../hurd/hurd_types.defs
	$(GCC_EXEC_PREFIX)cpp $(CPPFLAGS) ../hurd/startup.defs \
	| $(MIGCOM) -header startup.h -server /dev/null

