#
# Modula-3 Sun RPC
#
# Copyright (c) 1991, 1992 Xerox Corporation.  All rights reserved.
#
# Use and copying of this software and preparation of derivative works
# based upon this software are permitted.  Any distribution of this
# software or derivative works must comply with all applicable United
# States export control laws.  This software is made available AS IS, and
# Xerox Corporation makes no warranty about the software, its performance
# or its conformity to any specification.
#
DESTDIR=/project/m3chest
M3RPCGEN=../m3rpcgen/m3rpcgen

INTERFACES=ExceptionArg.i3 RPC.i3 RPCSun.i3 XDR.i3 XDRMem.i3 XDRRec.i3
LIBSRC=$(INTERFACES) RPCSunPriv.i3 \
	RPCSun.m3 RPCSunUDP.m3 RPCSunTCP.m3 \
	XDR.m3 XDRMem.m3 XDRRec.m3 \
	XDRFloat.i3 XDRFloat.m3 \
	PortMapper.i3 PortMapper_c.m3 PortMapper_s.m3 \
	PortMapper_x.i3 PortMapper_x.m3
LIBOBJS=getaddr.o
M3FLAGS=-g -w1
M3LIBS=
PACKAGE=libm3rpc

all:  $(PACKAGE).a PMClient

PortMapper.i3 PortMapper_c.m3 PortMapper_s.m3 PortMapper_x.i3 PortMapper_x.m3: PortMapper.x
	$(M3RPCGEN) -e PortMapper.x

PMClient: $(PACKAGE).a FORCE
	m3 $(M3FLAGS) -make -why -o PMClient PMClient.m3 $(PACKAGE).a $(M3LIBS)

$(PACKAGE).a: $(LIBSRC) $(LIBOBJS) FORCE
	m3 $(M3FLAGS) -make -why -a $(PACKAGE).a $(LIBSRC) $(LIBOBJS) $(M3LIBS)

install: $(PACKAGE).a $(INTERFACES)
	install -m 644 $(INTERFACES) $(DESTDIR)/interfaces
	install $(PACKAGE).a $(PACKAGE).ax $(DESTDIR)/lib

clean:
	rm -f *.o *.io *.mo *.ix *.mx $(PACKAGE).a $(PACKAGE).ax PMClient
	rm -f PortMapper.i3 PortMapper_x.i3 PortMapper_x.m3
	rm -f PortMapper_c.m3 PortMapper_s.m3

FORCE:
