# 
# (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.
# 

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

IDLFLAGS      = -cepv -client none -server none -I$(INCDIR)
CFLAGS	      = -I$(INCDIR) -D_BSD -DLINUX -D_REENTRANT
INCDIR	      = ../../../inc

DEST	      = .

EXTHDRS	      = $(INCDIR)/dce/idlbase.h \
		$(INCDIR)/dce/lbase.h \
		$(INCDIR)/dce/nbase.h \
		$(INCDIR)/dce/ndrtypes.h \
		$(INCDIR)/dce/uuid.h

IDLFILES      = uidsts.idl

HDRS	      =

INSTALL	      = /usr/bin/install

LD	      = $(CC)

LDFLAGS	      =

LIBS	      = ../../runtime/libnck.a ../lib/libidl.a ../../../threads/libpthreads-ext.a

MAKEFILE      = Makefile

OBJS	      = uuidgen.o

PRINT	      = pr

PROGRAM       = uuidgen

SHELL	      = /bin/sh

SRCS	      = uuidgen.c

SYSHDRS	      =

all:		$(PROGRAM) dceuid.cat optinstall

$(PROGRAM):     $(OBJS) $(LIBS)
		@echo "Linking $(PROGRAM) ..."
		$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) \
		-lpthread
		@echo "done"

optinstall:	$(PROGRAM)
		@echo "Copying $(PROGRAM) to /opt/dcelocal/bin"
		cp $(PROGRAM) /opt/dcelocal/bin
		@echo "Copying dceuid.caat /opt/dcelocal/NLS/C"
		cp dceuid.cat /opt/dcelocal/NLS/C

clean:;		@rm -f $(OBJS) uidsts.h core

clobber:;	@rm -f $(OBJS) $(PROGRAM) uidsts.h dceuid.cat core tags

depend:;	@mkmf -f $(MAKEFILE) ROOT=$(ROOT)

echo:;		@echo $(HDRS) $(SRCS)

index:;		@ctags -wx $(HDRS) $(SRCS)

install:	$(PROGRAM)
		@echo Installing $(PROGRAM) in $(DEST)
		@-strip $(PROGRAM)
		@if [ $(DEST) != . ]; then \
		(rm -f $(DEST)/$(PROGRAM); $(INSTALL) -f $(DEST) $(PROGRAM)); fi

print:;		@$(PRINT) $(HDRS) $(SRCS)

tags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)

#update:		$(DEST)/$(PROGRAM)
#
#$(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) $(EXTHDRS)
#		@$(MAKE) -f $(MAKEFILE) ROOT=$(ROOT) DEST=$(DEST) install

#
# dependencies and rules
#
uidsts.h: uidsts.idl
	$(IDL) $(IDLFLAGS) uidsts.idl

#
# Generate the message catalog
dceuid.cat: dceuid.msg
	$(GENCAT) $@ $?

#
# following dependencies are incomplete
#
###
uuidgen.o: uidsts.h \
	../../../inc/dce/uuid.h ../../../inc/dce/idlbase.h \
	../../../inc/dce/ndrtypes.h ../../../inc/dce/nbase.h \
	../../../inc/dce/lbase.h
