# 
# (c) Copyright 1994 OPEN SOFTWARE FOUNDATION, INC.
# (c) Copyright 1994 HEWLETT-PACKARD COMPANY
# (c) Copyright 1994 DIGITAL EQUIPMENT CORPORATION
# To anyone who acknowledges that this file is provided "AS IS"
# without any express or implied warranty:
#                 permission to use, copy, modify, and distribute this
# file for any purpose is hereby granted without fee, provided that
# the above copyright notices and this notice appears in all source
# code copies, and that none of the names of Open Software
# Foundation, Inc., Hewlett-Packard Company, or Digital Equipment
# Corporation be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.  Neither Open Software Foundation, Inc., Hewlett-
# Packard Company, nor Digital Equipment Corporation makes any
# representations about the suitability of this software for any
# purpose.
# 

CC	      = gcc
IDL	      = ../idl/idl_compiler/idl

CFLAGS	      = -D_BSD -DNCK $(PROT_DEFS) $(AUTH_DEFS) $(NAF_DEFS) \
		  $(DEBUG_DEFS) $(INCFLAGS) -DLINUX -D_REENTRANT -DLINUX_SKIP_LOOPBACK
INCFLAGS      = -I. -I$(INCDIR) -I$(TARGET)
IDLFLAGS      = -keep object -no_cpp -v -no_mepv \
		-I. -I$(INCDIR) -I$(TARGET) \
		-cc_cmd "gcc -D_BSD -DLINUX -D_REENTRANT -c" 
INCDIR	      = ../../inc

TARGET	      = AT386
IDLDIR	      = ../sys_idl
AT386_OBJS    =	comsoc_bsd.o ipnaf_bsd.o dce_802_addr.o #cs_s_conv.o

#
# A logical division of the OFILES, by runtime subcomponent.
#
# Note that the variables are set up to allow sensible exclusion of
# subcomponents by doing things like "make OBJS_CN=".  Candidates for
# such exclusion are noted below.  Note that excluding subcomponents
# will sometimes also require modifications to one or more of the
# definitions of PROT_DEFS, AUTH_DEFS, or NAF_DEFS further below.
#

#
# Runtime common services.
#
OBJS_COMMON	= rpctimer.o rpcclock.o rpcdbg.o rpcmutex.o rpclist.o \
                  rpcmem.o rpclog.o rpcrand.o dce_error.o

#
# Common communication services.
#
OBJS_COM	= comauth.o combind.o comcall.o comcthd.o \
                  comif.o cominit.o cominit_ux.o comnaf.o comnet.o comobj.o \
		  comep.o comnlsn.o comtwr.o comtwrflr.o comtwrref.o \
                  comp.o comutil.o uuid.o uuidsys.o ep_cstub.o 
#
# Implementation of RPC protocol for connection-oriented transports.
# Excludable if the PROT_NCACN cpp symbol is not defined (e.g., in the
# definition of PROT_DEFS below).
#
OBJS_CN		= cnassoc.o cnbind.o cncall.o cncasgsm.o cncassm.o cncclsm.o \
		  cncthd.o cnfbuf.o cnid.o cninit.o cnmgmt.o cnnet.o cnp.o \
		  cnpkt.o cnrcvr.o cnsasgsm.o cnsassm.o cnsclsm.o cnsm.o \
		  cnxfer.o
#
# Implementation of RPC protocol for connectionless transports.  Excludable
# if the PROT_NCADG cpp symbol is not defined (e.g., in the definition
# of PROT_DEFS below).
#
OBJS_DG		= conv.o dg.o dgcall.o dgccall.o dgccallt.o dgcct.o \
                  dgclive.o dgclsn.o dgexec.o dgfwd.o dgglob.o dghnd.o \
                  dginit.o dglossy.o dglsn.o dgpkt.o dgrq.o dgscall.o \
                  dgsct.o dgslive.o dgslsn.o dgsoc.o dgutl.o dgxq.o \
		  conv_cstub.o convc_cstub.o convc_sstub.o
#
# Implementation of IP (Internet Protocol) network address family support
# routines.  Excludable if the NAF_IP cpp symbol is not defined (e.g.,
# in the definition of NAF_DEFS below).
#
OBJS_IP		= ipnaf.o twr_ip.o 
#
# Implementation of RPC management functions.
#
OBJS_MGMT	= mgmt.o mgmt_cstub.o mgmt_sstub.o
#
# Implementation of NDR support needed by runtime.
#
OBJS_NDR	= ndrglob.o
#
# Implementation of the rpc_cs_... routines.
#
#OBJS_CS		= cs_s_eval.o cs_s_stub.o cs_s_reg.o

#
# Implementation of the "DCE dummy" authentication service.  Excludable
# if the AUTH_DUMMY cpp symbol is not defined (e.g., in the definition
# of AUTH_DEFS below).  Currently commented out because of bugs.
#
#OBJS_NOAUTH	= noauth.o noauthdg.o noauthcn.o
#

#
# The cpp symbols defined below must match the OBJ_... defined above.
# See comments above.  Note that in general these cpp symbols should
# NOT be #define'd in source code since that makes it harder to override
# things (i.e., source files need to be edited rather than "make" command
# line options changed).  This rule is not followed universally,
# unfortunately so beware of stray #define's.
#
PROT_DEFS	= -DPROT_NCADG -DPROT_NCACN 
NAF_DEFS	= -DNAF_IP
#AUTH_DEFS	= -DAUTH_DUMMY

#
# Defining the DEBUG cpp symbol causes the runtime to be built with the
# ability to produce large amounts of debug output.  (See
# "src/rpc/runtime/rpcdbg.[ch]".) It is recommended that one define DEBUG
# during debugging.
DEBUG_DEFS	= -DDEBUG

OBJS	      = \
	$(OBJS_COMMON) $(OBJS_COM) \
	$(OBJS_CN) $(OBJS_DG) \
	$(OBJS_IP) \
	$(OBJS_MGMT) \
	$(OBJS_NDR) \
	$(OBJS_NOAUTH) \
	$(OBJS_CS) \
	$(AT386_OBJS)

LIBRARY	      = libnck.a

all:		$(LIBRARY) install

$(LIBRARY):	$(OBJS)
		@echo "Loading $(LIBRARY) ..."
		ar cru $(LIBRARY) $(OBJS)
		ranlib $(LIBRARY)
		@echo "done"

install:	$(LIBRARY)
		@echo "Copying $(LIBRARY) to /opt/dcelocal/lib"
		cp $(LIBRARY) /opt/dcelocal/lib

clean:;		@rm -f $(OBJS) core \
		conv_cstub.c \
		convc_cstub.c convc_sstub.c \
		mgmt_cstub.c mgmt_sstub.c \
		ep_cstub.c codesets_cstub.c \
		conv.h convc.h mgmt.h ep.h codesets.h

clobber:;	@rm -f $(OBJS) $(LIBRARY) core tags \
		conv_cstub.c \
		convc_cstub.c convc_sstub.c \
		mgmt_cstub.c mgmt_sstub.c \
		ep_cstub.c codesets_cstub.c \
		conv.h convc.h mgmt.h ep.h codesets.h

conv_cstub.o: $(IDLDIR)/conv.idl
	$(IDL) $(IDLFLAGS) -cepv -server none \
		$(IDLDIR)/conv.idl
	@rm -f conv.h

convc_cstub.o convc_sstub.o: $(IDLDIR)/convc.idl
	$(IDL) $(IDLFLAGS) -cepv \
		$(IDLDIR)/convc.idl
	@rm -f convc.h

mgmt_cstub.o mgmt_sstub.o: $(IDLDIR)/mgmt.idl
	$(IDL) $(IDLFLAGS) -cepv \
		$(IDLDIR)/mgmt.idl
	@rm -f mgmt.h

ep_cstub.o: $(IDLDIR)/ep.idl
	$(IDL) $(IDLFLAGS) -cepv -server none \
		$(IDLDIR)/ep.idl
	@rm -f ep.h

codesets_cstub.o: $(IDLDIR)/codesets.idl
	$(IDL) $(IDLFLAGS) -server none \
		$(IDLDIR)/codesets.idl
	@rm -f codesets.h

ipnaf_sys.o: $(TARGET)/ipnaf_sys.c
	$(CC) $(CFLAGS) -c $(TARGET)/ipnaf_sys.c

cs_s_conv.o: $(TARGET)/cs_s_conv.c
	$(CC) $(CFLAGS) -c $(TARGET)/cs_s_conv.c

dce_802_addr.o: $(TARGET)/dce_802_addr.c
	$(CC) $(CFLAGS) -c $(TARGET)/dce_802_addr.c
