######################################################################
# $Header: GNUmakefile,v 78.16 96/05/10 16:15:04 ssa Exp $
#
#      This Makefile is derived from Alan McGowen's makefile.
#      The makefile has legends that speparate it from original
#      IBM makefile. This makefile has same dependency names as that of IBM.
#
#       Legend   Remark
#       ------   ------
#       hpux     OS specifier,gets set in mk file.
#       HP       HP specific blocks exist
#       HPUX_AIX HPUX_AIX specfic blocks exist
#       AIX      Distict AIX blocks
#       LIBNS    sl for HP, does not exist for AIX
#       LIB      = a for AIX, = sl for HP
#
#       By : Sunil Sabat Date July 19, 1995 , 447-7220
#            If you have questions, please call me. Sunil Sabat
#       The makefile depends on following files and executables
#
#        tools/mk   : the driver for the makefile.
#        CC         : HP C++ compiler and library builder
#        odbgen     : Oid specific file generator gets built by makefile
#                     and makefile makes reference to the odbgen
#        makedepend : Makefile uses this command to generate the
#                     dependencies automatically and writes to .u files.
#        idl        : idl compiler for DCE RPC interface specification
#        gmake      : GNU make file
#
######################################################################
#
# Table of Contents
#
######################################################################
#
# 0: useful targets and variables used throughout makefile
#
# 1: compiling and linking variables which control the compiling and
#    linking of executables and libraries.
#    YOU add special variables for compiles and links of libraries
#    and executables, etc here.
#    _libs, _sys_libs, _defs, _incls, ...
#    (e.g. spooler_sys_libs, ...)
#
# 2: makefile variables (CC, etc)
#
# 3: specific rules and special (non-generic) rules:
#    (tricky stuff like oids and asn1 special cases)
#    YOU add _specific rules here.
#    (e.g. oid_specific: ...)
#
# 4: generic rules
#    4a: generic rule to build a .o
#    4b: generic rule to build library
#    4c: generic rule to build an executable
#    4d: generic rule to build dependency makefile for a source file
#    4e: generic rules to perform clean on a directory
#
# 5: documentation and explanations
#
######################################################################
#
# 0: useful targets
#
######################################################################

# here is the default target

all:	prod ut gui

gui:	pdgui GSrvWnd GSpvrWnd GSplWnd GPrtWnd GJobWnd GNVAppl

ifeq ($(strip $(OS)),hpux)

prod:	dpo\
	odbgen\
	oid\
	basicds\
	basicdsd\
	spooler\
	supervisor\
	pdclientd\
	pdgenatt\
	pdmsghlp\
	pdcommand\
	dspmsg\
	pddmsg\
	pdlp\
	pdverdce
system:	spooler\
	supervisor\
	pdclientd\
	pdlp\
	pdcommand

        #HP,jbralley,13Oct95,shlibs added here and to target prod above.
shlibs:=libordered.sl\
	libordersuv.sl\
	libpd.sl\
	libserv.sl\
	libsock.sl

shlibs:	$(shlibs)

else

prod:	spooler\
	supervisor\
	pdclientd\
	pddmsg\
	pdgenatt\
	pdmsghlp\
	pdcommand\
	extras\
	pdverdce
system:	spooler\
	supervisor\
	pdclientd\
	pdcommand

endif

util:	dbglogd

basicdsd:	basicds 

# here are some other useful targets

client:		pdclientd pdcommand
server servers:	spooler supervisor
main:		spooler supervisor pdclientd
depend:		depends


# here are some targets defined below
# ut: unit tests
# spooler:
# supervisor:
# asn1 or dpa_all: makes the dpa_all.c and dpa_all.h file (run on leo)
# oid: there is a special rule to build the oid stuff which includes
#      odbgen and then liboid.$(LIB)
# dpo: there is a special rule to build the dpo stuff which includes
#      the .h and .c files generated by the idl compiler
# depends: creates a .u (dependency) file for each source file
#          in each directory
# lib_eh_depends: will update dependencies for build/lib/eh
# exe_spooler_depends : will update dependencies for build/exe/spooler
# here_depends: will update dependencies for current directory
#                 (assumes you are in something like build/lib/eh)
# clean: Same targets as depends, e.g. here_clean, etc
# scratch: Removes all .o, .$(LIB), .u files
# libs: will build all libraries
# libeh.$(LIB): will build libeh.a
# dir.o: will build dir.o (assumes you have copy of dir.cpp in current
#        directory)
#        warning:  if invoked in current directory, then the -DDIRNAME
#                  will not be used.

suv:	supervisor
spl:	spooler
cli:	pdclientd

# makefile can be run from the directory above build and any directory
# in build tree.  since it can be run from anywhere, the variable
# top is calculated.  if running makefile in build/lib/tools, then
# top is ../../..

ifeq ($(strip $(OS)),os2)
    # The cwdrexx script is a little rexx tool.  I tried using
    # pwd, and seds, like the AIX case below, but because pwd
    # returns file names with \ in them, there were all kinds of
    # problems since the unix like sed ate the \ (it took it as an
    # escape) and returned files names like buildliboid, rather
    # than build\lib\oid.
    top         := $(shell cwdrexx -t)
    topFullPath := $(shell cwdrexx -f)
    dirName     := $(shell cwdrexx)
else
    #HPUX_AIX  the directory initialization is common
    ifeq ($(strip $(LOGNAME)),build)
      cwd := $(shell pwd | sed 's,.*bld.*,bld,')
      ifeq ($(strip $(cwd)),bld)
        top     := $(shell pwd|sed 's,.*/bld,bld,'|sed 's,[^/][^/]*,..,g')
        topFullPath := $(shell pwd|sed 's,/bld.*,,')
      else
        top         := .
        topFullPath := $(shell pwd)
      endif
    else
      cwd := $(shell pwd | sed 's,.*build.*,build,')
      ifeq ($(strip $(cwd)),build)
        top     := $(shell pwd|sed 's,.*/build,build,'|sed 's,[^/][^/]*,..,g')
        topFullPath := $(shell pwd|sed 's,/build.*,,')
      else
        top         := .
        topFullPath := $(shell pwd)
      endif
    endif
    dirName := $(shell pwd | sed 's,.*/,,')
endif

# define some variables for system dependencies
# FS:  the file separator, / on unix, \ on os2
# OBJ: the object file suffix, .o on unix, .obj on os2
# LIB: the library file suffix, .a on unix, .lib on os2
# OPT: the option flag, - for unix, / for os2

ifeq ($(strip $(OS)),hpux)
    #HPUX notations
    FS    := /
    OBJ   := o
    LIB   := sl
    LIBNS := a
    OPT   := -
else
    #AIX other unix notation notations
    FS  := /
    OBJ := o
    LIB := a
    OPT := -
endif
ifeq ($(strip $(OS)),os2)
    FS  := \\
    OBJ := obj
    LIB := lib
    OPT := /
endif

# variables which define where we will put, objects, libraries,
# executables, includes

# use full path rather than relative path for LIBDIR and BINDIR because
# we check targets like $(LIBDIR)/libas.$(LIB).  Since we do recursive make
# operations and we are changing directory, the target names need to
# static.

OBJDIR          = $(top)$(FS)obj
LIBDIR          = $(topFullPath)$(FS)lib
BINDIR          = $(topFullPath)$(FS)bin
INCDIR          = $(top)$(FS)inc
SRCDIR          = $(top)$(FS)src
UTILDIR         = $(top)$(FS)utils
TOOLDIR		= $(topFullPath)$(FS)tools
SNMPDIR		= $(topFullPath)$(FS)snmp
fullPathBinDir := $(topFullPath)$(FS)bin
fullPathIncDir := $(topFullPath)$(FS)inc

# timestamp, dependency, and odb directories

tsDir  := $(topFullPath)$(FS)ts_dir
depDir := $(top)$(FS)dep_dir
odbDir := $(topFullPath)$(FS)oids

# libs: list of all library names, e.g. tools pd pdenv ....

ifeq ($(strip $(LOGNAME)),build)
libs := $(shell ls $(top)$(FS)bld$(FS)lib )
else
libs := $(shell ls $(top)$(FS)build$(FS)lib )
endif
libs := $(filter-out asn1 makefile cwd.cmd pdgui vmsplus, $(libs) )

# exes: list of executable names, e.g. spooler supervisor ....

ifeq ($(strip $(LOGNAME)),build)
exes := $(shell ls $(top)$(FS)bld$(FS)exe )
else
exes := $(shell ls $(top)$(FS)build$(FS)exe )
endif
exes := $(filter-out makefile cwd.cmd, $(exes) )

utNames := $(filter %_u, $(exes))
utNames := $(utNames) showsplr showspvr interprob psumtrc
ut: $(utNames)

# lib: directory which contains links to source for each library

ifeq ($(strip $(LOGNAME)),build)
lib := $(top)$(FS)bld$(FS)lib
else
lib := $(top)$(FS)build$(FS)lib
endif

# exe: directory which contains links to source for each executable

ifeq ($(strip $(LOGNAME)),build)
exe := $(top)$(FS)bld$(FS)exe
else
exe := $(top)$(FS)build$(FS)exe
endif

debugLibs :=
debugObj  :=
DEBUGDEFS :=
DEBUGOPT  :=

ifeq ($(strip $(HEAPVIEW)),y)
# To compile for HEAPVIEW:
# rm obj/newdebug.o
#
# In addition, to compile for pdclientd
# rm obj/clientd.o obj/sockthr.o
#
# To run:
# export PD_NO_DAEMON=
# export HD_ATEND=
# export HD_STACK=4
# export HD_CLI= HD_AUTOSHOW=
# (optional) export HD_ERROR=./hd.err
# run spooler
# (hd:1) quit
# ..
# At termination:
# (hd:2)
# compact
# rrview

DEBUGOPT  :=
DEBUGDEFS := -DHEAPVIEW
debugLibs := -lhd -lCns
debugObj  :=	strcat.o\
		strcpy.o\
		strcmp.o\
		strncat.o\
		strncpy.o\
		strncmp.o\
		strlen.o\
		memcpy.o\
		memset.o
$(debugObj):
        ar xv /usr/lib/libc.$(LIBNS) strcat.o  strcpy.o  strcmp.o\
                                     strncat.o strncpy.o
        @echo "int strncmp(const char *s1,const char *s2,unsigned long l) { while (l && *s1 && *s2 && (*s1 == *s2)) s1++, s2++, l--; return l == 0 ? 0 : *s1 > *s2 ? 1 : *s1 < *s2 ? -1 : 0; }" > strncmp.c
        xlc -c strncmp.c
        rm strncmp.c
        @echo "unsigned long strlen(const char *s) { int i; for (i = 0; *s++; i++); return i;} " > strlen.c
        xlc -c strlen.c
        rm strlen.c
        @echo "void* memset(void *t, int c, unsigned long n ) { int i; char *t1=t; for (i = 0; i<n; i++) *t1++ = c; return t;} " > memset.c
        xlc -c memset.c
        rm memset.c
        @echo "void* memcpy(void *t, const void *s, unsigned long n) { int i; char *t1=t; char *s1=s; for (i = 0; i<n; i++) *t1++ = *s1++; return t;} " > memcpy.c
        xlc -c memcpy.c
        rm memcpy.c
#       @echo "kutc_adjtime() {_exit(); } kutc_gettime() {_exit(); } kafs_syscall() {_exit(); }" > dcestuff.c
#       xlc -c dcestuff.c
#       xlc -r -o dce.o /lib/libdce.$(LIB) dcestuff.o -bnso
#       rm dcestuff.c dcestuff.o
endif

ifeq ($(strip $(SENTINEL)),y)
# To compile for SENTINEL:
#
# To run:
# run spooler
# ..

DEBUGOPT  := -L/net/home/nrjbehrs/src/sentinel  -L/net/home/nrjbehrs/tmp
DEBUGDEFS := -I/net/home/nrjbehrs/src/sentinel
debugLibs := -lCns -ldbmalloc -lafssys -ldacl2acl -ldfsjunct -ldce -lc_r -lbsd -bimport:/net/home/nrjbehrs/tmp/import_file
debugObj  :=
endif

# potential targets and dependencies.  based on files found
# in current directory using wildcards, and then a series of
# pattern substitutions.

# .cpp and .C are C++ src
# .c are c source files
# .h are include files.  currently in $(INCDIR)
# .o are object files. currently in $(OBJDIR)
# .u are include file dependency files: x.o: y.h z.h ...
#    one for each source file. currently put in $(depDir).

allCppSrc   := $(wildcard *.cpp)
allCppObj   := $(patsubst %.cpp, %.$(OBJ), $(allCppSrc))
cppSrcDep   := $(patsubst %.cpp, %.u, $(allCppSrc))
allCSrc     := $(wildcard *.C)
c++TmpFiles := $(wildcard xlc*.C)
allCSrc     := $(filter-out $(c++TmpFiles), $(allCSrc))
allCObj     := $(patsubst %.C, %.$(OBJ), $(allCSrc))
CSrcDep     := $(patsubst %.C, %.u, $(allCSrc))
allcSrc     := $(wildcard *.c)
allcObj     := $(patsubst %.c, %.$(OBJ), $(allcSrc))
cSrcDep     := $(patsubst %.c, %.u, $(allcSrc))
allSrc      := $(allCppSrc) $(allcSrc) $(allCSrc)
allObj      := $(allCppObj) $(allcObj) $(allCObj)
libObj      := $(filter-out $(unitObj), $(allObj))

# by default, the makefile does not echo commands.  by setting VERBOSE=1
# the $echo variable is set to NULL and the makefile starts echoing commands.
# otherwise, it precedes the command with '@' which prevents echo.

ifneq ($(strip $(VERBOSE)),)
    echo :=
else
    echo := @
endif

# using vpath allow us (the user of make) to say mk x.o and the makefile
# will look for a target x.o in the current directory and then in the
# vpath directory.
# HPUX_AIX vpath initialization is common

vpath %.$(OBJ)   $(OBJDIR)
vpath %.h        $(INCDIR)
vpath %_specific $(tsDir)
vpath %.u        $(depDir)
vpath %.db       $(odbDir)

######################################################################
#
# 1: variables which control the compiling and linking of executables
#    and objects in libraries
#
######################################################################

# documentation on this section is at the bottom of this file.
# look for section on "special variables"

# (Cns is the non-shared libC to eliminate the C++ compiler runtime
# prereq.  However, this adds 100K to text size.).
#
# variables which define common groups of libraries
#
    libC := C
ifeq ($(strip $(STATIC_C)),y)
    libC := Cns
else
    libC :=
endif

ifeq ($(strip $(OS)),hpux)
    serverLibs := serv dposerv pdparse
else
    serverLibs := serv dposerv
endif
commonShLibs   := pd serv sock
shLibs         := pd serv sock spl suv pdparse dposerv pdclient ordered ordersuv

#---------------------------------------------------------------------
# -qlanglvl=compat and -qtwolink make static init work
# we don't know why

ifeq ($(strip $(OS)),AIX)
    $(dirName)_ldopts := -qlanglvl=compat -qnotwolink
endif

#---------------------------------------------------------------------
# special compile setup for "pdcommand", "pdlp"  and the class libraries
#
# !!!! READ THE FOLLOWING BEFORE YOU MAKE ANY CHANGES TO THE BUILD OF
# ------->  nwtools pdcommand pdlp   <-------
#
# "nwtools" means tools with no wrappers - (not thread safe IO)
#    (Palladium defined)
#  - this includes the socket objects
#  - this lib is intended to be used only by the "client" side of
#    pdcliend process.  It is not intended to be used
#    by the PDCLIENTD process.
#    The nwtools library must be used for pdcommand and pdlp
#    _CMA_NOWRAPPERS must be defined or we get compile error for str.cpp

nwtools_compiler := CC
nwtools_defs     :=	$(OPT)DNO_STREAM_WRAPPERS\
			$(OPT)DDG_NO_TRACE \
			$(OPT)D_CMA_NOWRAPPERS_

#----------------------------------
#
pdcommand_compiler := CC
ifeq ($(strip $(OS)),hpux)
    pdcommand_libs := nwtools pd pdparse pd ordered pd
else
    pdcommand_libs := nwtools pd pdclient
endif
pdcommand_objs     := catmsg.o
pdcommand_defs     := $(OPT)DDG_NO_TRACE $(OPT)DLPR_GATEWAY $(OPT)D_CMA_NOWRAPPERS_ $(OPT)DNO_STREAM_WRAPPERS
pdcommand_usr_libs := dce $(libC)
pdcommand_ldopts   := -qtwolink
#----------------------------------
#
pdverdce_compiler := xlc
pdcommand_ldopts  :=
pdverdce_usr_libs := dce
pdverdce_defs     :=

#----------------------------------
#
# note - the gateway - "pdenq" must be compiled and linked very carefully!
#        the gateway CANNOT be linked with DCE!!!!
#
#        If it is linked with DCE, remote print commands entering the
#        system via the socket 515 will fail.
#
#  There is #define DEBUG in the gateway to allow debugging.  This
#  #define causes the gateway code to write a file - /tmp/pdenq.log
#  for each enq request.
#
pdlp_compiler := CC
pdlp_defs     := $(OPT)DNO_STREAM_WRAPPERS
pdlp_libs     := pdobj nwtools
pdlp_usr_libs := $(libC)

#----------------------------------
#
# the pdobj library is used only for the pdlp function
# DG_NO_TRACE eliminates trace code
# LPR_GATEWAY eliminates all dce code in the PD class libraries
#
pdobj_compiler := CC
pdobj_defs     := $(OPT)DDG_NO_TRACE $(OPT)DLPR_GATEWAY
#
#---------------------------------------------------------------------



#---------------------------------------------------------------------
#
# special compile options for specific files
#

dpoServerDefs        := $(OPT)Dtransfer_request=s_transfer_request\
                        $(OPT)Ddce_pipe_pull=s_dce_pipe_pull\
                        $(OPT)Ddelete_file=s_delete_file
dpo_if_sstub.c_defs  := $(dpoServerDefs)
dpo_sbase.cpp_defs   := $(dpoServerDefs)
dpo_cbsrvr.cpp_defs  := $(dpoServerDefs)
tslist.cpp_defs      := $(OPT)DHP_DBG_VER
alarmclo_pd.cpp_defs := $(OPT)DHP_DBG_VER

ifeq ($(strip $(OS)),aix)
    # this did not appear to make any difference.  still had to load
    # dsfsinit.o during link
    dsfsinit.cpp_defs := -qpriority=-50
    # library priorities
    $(dirName)_priority := 0
    #pd_priority := -100
endif

#---------------------------------------------------------------------
# The following are the instructions for building
# the Palladium AIX SMIT interface
#---------------------------------------------------------------------
ifeq ($(strip $(OS)),aix)
    SMITDIR = $(SRCDIR)/smit
    smit:       $(SMITDIR)/sm_cmd_hdr\
                $(SMITDIR)/fpasmit.cat\
                $(SMITDIR)/fpasmithelp.cat
    $(SMITDIR)/sm_cmd_hdr: $(SMITDIR)/pd_stanzas
                cd $(SMITDIR); BuildPdSMIT
    $(SMITDIR)/fpasmit.cat: $(SMITDIR)/fpasmitmsg.msg
                gencat $@ $(SMITDIR)/fpasmitmsg.msg
    $(SMITDIR)/fpasmithelp.cat: $(SMITDIR)/fpasmithelp.msg
                gencat $@ $(SMITDIR)/fpasmithelp.msg
    $(SMITDIR)/fpasmitmsg.msg $(SMITDIR)/fpasmithelp.msg:\
                        $(SMITDIR)/fpasmit.msg
                genmsg $(SMITDIR)/fpasmit.msg $(SRCDIR)/common/subword.fpamsg
endif

#---------------------------------------------------------------------
# The following are the instructions for building the
# PSF/6000 special Palladium user exit programs
#---------------------------------------------------------------------

extras: $(BINDIR)/pduxblkh $(BINDIR)/pduxblks $(BINDIR)/pduxblkt

allcObj := $(filter-out pduxblkh.o, $(allcObj))
allcObj := $(filter-out pduxblks.o, $(allcObj))
allcObj := $(filter-out pduxblkt.o, $(allcObj))

ifeq ($(strip $(OS)), aix)
    UXCC        = -xlc
    UXDEFINES   = -D_POSIX_SOURCE \
                  -D_XOPEN_SOURCE \
                  -D_ALL_SOURCE \
                  -D__STR31__
    UXCOMPFLAGS = -Dcdecl= \
                  -Dfar= \
                  -Dhuge= \
                  -Dnear= \
                  -Dpascal= \
                  -D_cdecl= \
                  -D_far= \
                  -D_huge= \
                  -D_interrupt= \
                  -D_loadds= \
                  -D_near= \
                  -D_saveregs=
UXLOADFLAGS     = -lc -H512 -T512
UXINC           = -I/usr/lpp/psf/exits -I$(INCDIR)
UXCFLAGS        = $(UXDEFINES) $(UXCOMPFLAGS) $(UXLOADFLAGS) $(UXINC)

$(BINDIR)/pduxblkh: $(SRCDIR)/suv/pduxblkh.c \
                    /usr/lpp/psf/exits/ainuexit.h \
                    $(INCDIR)/pduxblk.h
        rm -f $@
        $(UXCC) $(UXCFLAGS) -o $@ $(SRCDIR)/suv/pduxblkh.c -eHEADER

$(BINDIR)/pduxblks: $(SRCDIR)/suv/pduxblks.c \
                    /usr/lpp/psf/exits/ainuexit.h \
                    $(INCDIR)/pduxblk.h
        rm -f $@
        $(UXCC) $(UXCFLAGS) -o $@ $(SRCDIR)/suv/pduxblks.c -eSEPARATOR

$(BINDIR)/pduxblkt: $(SRCDIR)/suv/pduxblkt.c \
                    /usr/lpp/psf/exits/ainuexit.h \
                    $(INCDIR)/pduxblk.h
        rm -f $@
        $(UXCC) $(UXCFLAGS) -o $@ $(SRCDIR)/suv/pduxblkt.c -eTRAILER

# }
endif
#
# special defines for libraries
#
suv_defs         := $(OPT)DSUV
spl_defs         := $(OPT)DSPL
pdclient_defs    := $(OPT)DCLIENT
serv_defs        := $(OPT)DSERV
dposerv_defs     := $(dpoServerDefs)
ordersuv_defs    := $(OPT)DSUV
#
# executable defines and link dependencies
#
dbglogd_libs     := pd
dbglogd_usr_libs := dce $(libC)

basicdsd_defs    := -DHP_BASIC_ENV
basicdsd_libs    :=  ordered pd pdparse ordered
basicds_defs     := -DHP_BASIC_ENV

#####   #####    ####   #          #    ######  #    #   #####  #####
#    #  #    #  #    #  #          #    #       ##   #     #    #    #
#    #  #    #  #       #          #    #####   # #  #     #    #    #
#####   #    #  #       #          #    #       #  # #     #    #    #
#       #    #  #    #  #          #    #       #   ##     #    #    #
#       #####    ####   ######     #    ######  #    #     #    #####

pdclientd        := pdclient pdparse pd sock
pdclientd_libs   := ordered pdclient pd sock pdclient pdparse pd
ifeq ($(strip $(NOSHARED)),1)
pdclientd_objs   :=	dpa_s.$(OBJ)\
			attset.$(OBJ)\
			eventdis.$(OBJ)\
			oid_init.$(OBJ)\
			valstr.$(OBJ)\
			valoth.$(OBJ)\
			valnum.$(OBJ)\
			oid_con.$(OBJ)\
			oidpiobe.$(OBJ)\
			oidpsf6K.$(OBJ)\
			oidsbsd.$(OBJ)\
			boid.$(OBJ)
else
pdclientd_objs   :=	
endif
pdclientd_usr_libs := dce $(libC)

 ####   #####    ####    ####   #       ######  #####
#       #    #  #    #  #    #  #       #       #    #
 ####   #    #  #    #  #    #  #       #####   #    #
     #  #####   #    #  #    #  #       #       #####
#    #  #       #    #  #    #  #       #       #   #
 ####   #        ####    ####   ######  ######  #    #

spooler_defs := $(OPT)DSPL
spooler_libs := ordered $(serverLibs) pd spl sock pd serv dposerv 

ifeq ($(strip $(NOSHARED)),1)
spooler_objs := dpa_s.o\
		syslogpd_serv.o\
                oidpiobe.o\
                oidpsf6K.o\
                oidsbsd.o\
                valstr.o\
                valoth.o\
                attset.o\
                valnum.o\
                oid_init.o\
                oid_con.o\
                boid.o
else # SHARED
spooler_objs :=
endif
spooler_usr_libs := dce $(libC)

 ####   #    #  #####   ######  #####   #    #     #     ####    ####   #####
#       #    #  #    #  #       #    #  #    #     #    #       #    #  #    #
 ####   #    #  #    #  #####   #    #  #    #     #     ####   #    #  #    #
     #  #    #  #####   #       #####   #    #     #         #  #    #  #####
#    #  #    #  #       #       #   #    #  #      #    #    #  #    #  #   #
 ####    ####   #       ######  #    #    ##       #     ####    ####   #    #

supervisor:	libfcrm0.sl
supervisor_defs := $(OPT)DSUV
ifeq ($(strip $(NOSHARED)),1)
supervisor_objs :=      dpa_s.$(OBJ)\
			dsfsinit.$(OBJ)\
			dsfsbsd.$(OBJ)\
			dsfprt0.$(OBJ)\
                        attset.$(OBJ)\
                        syslogpd_serv.$(OBJ)\
                        oid_init.$(OBJ)\
                        valstr.$(OBJ)\
                        valoth.$(OBJ)\
                        valnum.$(OBJ)\
                        oid_con.$(OBJ)\
                        oidpiobe.$(OBJ)\
                        oidpsf6K.$(OBJ)\
                        oidsbsd.$(OBJ)\
                        boid.$(OBJ)
else
supervisor_objs :=
endif
supervisor_libs := ordered ordersuv suv $(serverLibs) pd suv pd serv pd

ifeq ($(strip $(OS)),hpux)
    supervisor_usr_libs := dce  $(libC)
else
    #AIX
    supervisor_sys_libs := s
    supervisor_usr_libs := dce qb $(libC)
endif

odbgen_defs         :=	-DNO_STREAM_WRAPPERS\
			-DNEW_MAKEFILE\
			-D_CMA_NOWRAPPERS_ \
			-DDG_NO_TRACE\
			-DODBGEN

pddmsg_libs         := nwtools
pddmsg_objs         := catmsg.o
pddmsg_usr_libs     := $(libC)
pddmsg_ldopts       := -qtwolink

pdmsghlp_libs       := nwtools
pdmsghlp_objs       := catmsg.o
pdmsghlp_usr_libs   := $(libC)

pdgenatt_usr_libs   := $(libC)

# GUI build
GSrvWnd_libs        := pdgui clntinf vsmplus
GSrvWnd_usr_libs    := dce sock
GSrvWnd_other_libs  := -L/pd_gui/vsmlib -lvsm
GSrvWnd_sys_libs    := Xt Xpm Xm
GSrvWnd_incls       := -I/pd_gui/vsminc

GSplWnd_libs        := pdgui clntinf vsmplus
GSplWnd_usr_libs    := dce sock
GSplWnd_other_libs  := -L/pd_gui/vsmlib -lvsm
GSplWnd_sys_libs    := Xt Xpm Xm
GSplWnd_incls       := -I/pd_gui/vsminc

GNVAppl_libs        := clntinf
GNVAppl_usr_libs    := dce sock
GNVAppl_sys_libs    := ovw ov ntl
GNVAppl_incls       := -I/pd_gui/vsminc

GSpvrWnd_libs       := pdgui clntinf vsmplus
GSpvrWnd_usr_libs   := dce sock
GSpvrWnd_other_libs := -L/pd_gui/vsmlib -lvsm
GSpvrWnd_sys_libs   := Xt Xpm Xm
GSpvrWnd_incls      := -I/pd_gui/vsminc

GPrtWnd_libs        := pdgui clntinf vsmplus
GPrtWnd_usr_libs    := dce sock
GPrtWnd_other_libs  := -L/pd_gui/vsmlib -lvsm
GPrtWnd_sys_libs    := Xt Xpm Xm
GPrtWnd_incls       := -I/pd_gui/vsminc

GJobWnd_libs        := pdgui clntinf vsmplus
GJobWnd_usr_libs    := dce sock
GJobWnd_other_libs  := -L/pd_gui/vsmlib -lvsm
GJobWnd_sys_libs    := Xt Xpm Xm
GJobWnd_incls       := -I/pd_gui/vsminc

pdgui_incls         := -I/pd_gui/vsminc
pdgui_defs          := -DNO_STREAM_WRAPPERS
pdgui_specific      := GMsg_msg.h GMsg_cat.h
vsmplus_incls       := -I/pd_gui/vsminc

clntinf_defs        := -DNO_STREAM_WRAPPERS
clntinf_incls       := -I/pd_gui/vsminc

#---------------------------------------------------------------------
# Build unit test case executables
#---------------------------------------------------------------------

pdobj_u_usr_libs   :=   dce
pdobj_u_libs       :=   pd pdparse pdobj sock
pdobj_u_defs       :=   $(OPT)DNO_STREAM_WRAPPERS
pdobj_u_objs       :=   catmsg.o

event_u_usr_libs   :=   dce
event_u_libs       :=   pd pdparse pdclient pdobj sock nwtools pdclient
event_u_defs       :=   $(OPT)DNO_STREAM_WRAPPERS

ocont_u_usr_libs   :=   dce
ocont_u_libs       :=   spl $(serverLibs) pd

alarm_u_usr_libs   :=   dce
alarm_u_libs       :=   spl $(serverLibs) pd spl pd serv
alarm_u_objs       :=   serdefob_spl.o  syslogpd_serv.$(OBJ) oid_init.$(OBJ)\
                        valoth.$(OBJ)   oid_con.$(OBJ)       oidpiobe.$(OBJ)\
                        oidpsf6K.$(OBJ) oidsbsd.$(OBJ)       boid.$(OBJ)

pb_u_usr_libs      :=   dce
pb_u_libs          :=   spl $(serverLibs) pd pdparse dposerv
pb_u_defs          :=   $(OPT)DPDB_SPOOLER $(OPT)DSERV
pb_u_objs          :=   pdnotify.$(OBJ)
pb_u_objs          :=   dpo_server.o

ifeq ($(strip $(OS)),hpux)
  pbsuv_u_usr_libs :=   dce
else
  pbsuv_u_sys_libs :=   s
  pbsuv_u_usr_libs :=   dce qb
endif
pbsuv_u_libs       :=   suv $(serverLibs) pd pdparse dposerv pd dposerv
pbsuv_u_defs       :=   $(OPT)DPDB_SUPERVISOR $(OPT)DSERV
pbsuv_u_objs       :=   pdnotify.$(OBJ)
pbsuv_u_objs       :=   dpo_server.o

showsplr_usr_libs  :=   dce
showsplr_defs      :=   $(OPT)DPDB_SPOOLER
showsplr_libs      :=   spl $(serverLibs) pd

ifeq ($(strip $(OS)),hpux)
 showspvr_usr_libs :=   dce
else
 showspvr_usr_libs :=   dce qb
endif
showspvr_libs      :=   suv $(serverLibs) pd
showspvr_defs      :=   $(OPT)DPDB_SUPERVISOR
showspvr_objs      :=   pdnotify.$(OBJ)

psumtrc_usr_libs   :=   dce
psumtrc_libs       :=   pd

as_u_usr_libs      :=   dce
as_u_libs          :=   pd pdclient pdparse pd pdclient sock dposerv
as_u_defs          :=   $(OPT)DCLIENT
as_u_objs          :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asas_u_usr_libs    :=   dce
asas_u_libs        :=   pd pdclient pdparse pd pdclient sock
asas_u_defs        :=   $(OPT)DCLIENT
asas_u_objs        :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asatt_u_usr_libs   :=   dce
asatt_u_libs       :=   pd pdclient pdparse pd pdclient sock
asatt_u_defs       :=   $(OPT)DCLIENT
asatt_u_objs       :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

svbjs_u_usr_libs   :=   dce
asvbjs_u_libs      :=   pd pdclient pdparse pd pdclient sock
asvbjs_u_defs      :=   $(OPT)DCLIENT
asvbjs_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asvdpa_u_usr_libs  :=   dce
asvdpa_u_libs      :=   pd pdclient pdparse pd pdclient sock
asvdpa_u_defs      :=   $(OPT)DCLIENT
asvdpa_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asvoid_u_usr_libs  :=   dce
asvoid_u_defs      :=   $(OPT)DCLIENT
asvoid_u_libs      :=   pd pdclient pdparse pd pdclient sock
asvoid_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asvnum_u_usr_libs  :=   dce
asvnum_u_defs      :=   $(OPT)DCLIENT
asvnum_u_libs      :=   pd pdclient pdparse pd pdclient sock
asvnum_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asvstr_u_usr_libs  :=   dce
asvstr_u_defs      :=   $(OPT)DCLIENT
asvstr_u_libs      :=   pd pdclient pdparse pd pdclient sock
asvstr_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asvoth_u_usr_libs  :=   dce
asvoth_u_defs      :=   $(OPT)DCLIENT
asvoth_u_libs      :=   pd pdclient pdparse pd pdclient sock
asvoth_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

asmars_usr_libs    :=   dce
asmars_u_defs      :=   $(OPT)DCLIENT
asmars_u_libs      :=   pd pdclient pdparse pd pdclient sock
asmars_u_objs      :=   oid_init.$(OBJ) valoth.$(OBJ)   oid_con.$(OBJ)\
                        oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ)\
                        boid.$(OBJ)

dir_u_usr_libs     :=   dce
dir_u_defs         :=   $(OPT)DCLIENT
dir_u_libs         :=   pd pdclient pdparse pd pdclient sock dposerv
dir_u_objs         :=   syslogpd_pdclient.$(OBJ)

basicds_u_usr_libs :=   dce dc
basicds_u_defs     :=   $(OPT)DNO_STREAM_WRAPPERS $(OPT)DHP_BASIC_ENV
basicds_u_libs     :=   ordered pd pdparse pd dposerv ordered
basicds_u_objs     :=   basicds_client.o basicds_cstub.o dpo_sbase.o\
                        dpo_if_sstub.o   dir.o

oidprf_u_usr_libs  :=   dce
oidprf_u_defs      :=   $(OPT)DCLIENT
oidprf_u_libs      :=   pd pdclient pd pdparse sock

oid_u_usr_libs     :=   dce
oid_u_defs         :=   $(OPT)DCLIENT
oid_u_libs         :=   pd pdclient pd pdparse sock

ifeq ($(strip $(OS)),hpux)
 notifv_u_usr_libs :=   dce
else
 notifv_u_usr_libs :=   dce qb
 notifv_u_sys_libs :=   s
endif
notifv_u_defs      :=   $(OPT)DSUV
notifv_u_libs      :=   pd suv pdparse dposerv serv sock pd
notifv_u_objs      :=   dpo_server.o

notifs_u_usr_libs  :=   dce
notifs_u_defs      :=   $(OPT)DSPL
notifs_u_libs      :=   pd spl pdparse dposerv serv sock pd
notifs_u_objs      :=   dpo_server.o

syslog_u_usr_libs  :=   dce
syslog_u_libs      :=   pd spl serv dposerv pdparse pdclient dposerv pd
syslog_u_objs      :=   serdefob_spl.o  syslogpd_serv.$(OBJ) oid_init.$(OBJ)\
                        valoth.$(OBJ)   oid_con.$(OBJ)       oidpiobe.$(OBJ)\
                        oidpsf6K.$(OBJ) oidsbsd.$(OBJ)       boid.$(OBJ)\
                        dpo_server.o

msg_u_usr_libs     :=   dce
msg_u_libs         :=   pd pdclient pdparse pd pdclient sock
msg_u_defs         :=   $(OPT)DCLIENT

pdloc_u_usr_libs   :=   dce
pdloc_u_libs       :=   pd pdparse

thread_u_usr_libs  :=   dce
thread_u_libs      :=   pd pdparse
thread_u_defs      :=   $(OPT)DCLIENT

process_u_usr_libs :=   dce
process_u_libs     :=   pd

throco_u_usr_libs  :=   dce
throco_u_libs      :=   pd pdparse

pdnot_u_usr_libs   :=   dce
pdnot_u_libs       :=   pd pdapi spl serv dposerv pdparse pdclient dposerv pd
pdnot_u_objs       :=   serdefob_spl.o  syslogpd_serv.$(OBJ) oid_init.$(OBJ)\
                        valoth.$(OBJ)   oid_con.$(OBJ)       oidpiobe.$(OBJ)\
                        oidpsf6K.$(OBJ) oidsbsd.$(OBJ)       boid.$(OBJ)\
                        dpo_server.o

msigc_u_usr_libs   :=   dce
msigc_u_libs       :=   pd pdparse

iterprob_usr_libs  :=   dce
iterprob_libs      :=   pd

islist_u_usr_libs  :=   dce
islist_u_libs      :=   pd pdparse

iostr_u_usr_libs   :=   dce
iostr_u_libs       :=   pd pdparse

gettim_u_usr_libs  :=   dce
gettim_u_libs      :=   pd pdparse

time_u_usr_libs    :=   dce
time_u_libs        :=   pd pdparse

str_u_usr_libs     :=   dce
str_u_libs         :=   pd pd pdparse

trc_u_usr_libs     :=   dce
trc_u_libs         :=   pd pdparse

trc2_u_usr_libs    :=   dce
trc2_u_libs        :=   pd pdparse

trcprf_u_usr_libs  :=   dce
trcprf_u_libs      :=   pd pdparse

trcthr_u_usr_libs  :=   dce
trcthr_u_libs      :=   ordered pd pdparse

trcmul_u_usr_libs  :=   dce
trcmul_u_libs      :=   ordered pd pdparse

trcsev_u_usr_libs  :=   dce
trcsev_u_libs      :=   ordered pd pdparse

sc_u_usr_libs      :=   dce
sc_u_libs          :=   ordered pd pdparse dposerv pd serv pd spl
sc_u_objs          :=   delivobj.o

client_u_libs := ordered pd dposerv pdparse
client_u_objs := attset.$(OBJ) syslogpd_pdclient.$(OBJ) oid_init.$(OBJ) valstr.$(OBJ) valoth.$(OBJ) valnum.$(OBJ) oid_con.$(OBJ) oidpiobe.$(OBJ) oidpsf6K.$(OBJ) oidsbsd.$(OBJ) boid.$(OBJ)
client_u_usr_libs := dce

server_u_libs := ordered $(serverLibs) pd spl sock pd serv dposerv 
#server_u_libs := ordered pd pdparse dposerv pd serv pd spl dposerv
server_u_objs := server_spooler.o\
		dpa_s.o\
                syslogpd_serv.o\
                oidpiobe.o\
                oidpsf6K.o\
                oidsbsd.o\
                valstr.o\
                valoth.o\
                attset.o\
                valnum.o\
                oid_init.o\
                oid_con.o\
                boid.o
server_u_usr_libs := dce

dpo_u_usr_libs     :=   dce
dpo_u_libs         :=   pd dposerv serv spl

######################################################################
#
# 2: makefile variables
#
######################################################################
# Turns out that several source files cannot be compiled or linked
# with the xlC_r compiler

ifeq ($(strip $($(dirName)_compiler)),)
    compiler = CC
else
    compiler := $($(dirName)_compiler)
endif

ifeq ($(strip $(OS)),os2)
    compiler := icc.exe
endif

#HP specfic compiler names

ifeq ($(strip $(OS)),hpux)
    compiler   := CC
    c_compiler := cc
endif

#---------------------------------------------------------------------
# os2 compile and link options
#
#
ifeq ($(strip $(OS)),os2)

OBJFLAG = /c

# /Q+: suppress logo
# /Su4: make all enum variables 4 bytes
# /Gm: link with multi threads
# /Ti: control preloading compiler compnants (looks like /Ti is default)
#      we probably do not need.
OPT =   $($(dirName)_opts) \
        /Q+ \
        /Xi \
        /Su4 \
        /Ti \
        /N100 \
        /Gm \
        $(UOPT)

C_OPT = $($(dirName)_opts) \
        /Xi \
        /Su4 \
        /Ti \
        /N100 \
        /Gm \
        /Ms \
        $(UOPT)

# /Tdp: ensure that template functions resolve correctly
LDOPT = Tdp\
        $(ULDOPT)

DEF =   $($(dirName)_defs) \
        /DIALL_CHECKS \
        /DIBMOS2 \
        /DINTEL80x86 \
        /DSO32 \
        /DPS2 \
        /D__STDC__ \
        $(UDEF)

# .c -D defaults
C_DEF = $($(dirName)_defs) \
        /D__STDC__ \
        /DPS2 \
        /DIBMOS2 \
        /DINTEL80x86 \
        /DIDL_PROTOTYPES \
        $(UDEF)

# .cpp -I defaults
INCL =  /I. \
        $($(dirName)_incls) \
        /I $(INCDIR) \
        /I e:\\pd_int\\cpp\\include \
        /I d:\\opt\\dcelocal\\include \
        /I d:\\opt\\dcelocal\\include\\dce \
        /I d:\\toolkt21\\cplus\\os2h \
        /I d:\\ibmcpp\\include \
        $(UINCL)

# .c defaults -I
C_INCL =        -I. \
        $($(dirName)_incls) \
        /I $(INCDIR) \
        /I e:\\pd_int\\cpp\\include \
        /I d:\\opt\\dcelocal\\include \
        /I d:\\opt\\dcelocal\\include\\dce \
        /I d:\\ibmcpp\\include \
        /I \\usr\\include \
        $(UINCL)

endif

#     # ######
#     # #     #
#     # #     #
####### ######
#     # #
#     # #
#     # # Compiler Options

ifeq ($(strip $(OS)),hpux)

#HP specific compile options
#HP add your options via mk file or here after +a1 line. For example, you
#can add +T option after a1 option line

OBJFLAG = -c
#
# Added +Z   for relocatable sharable objects.       HP,jbralley,13Oct95.
# Added -pth for short template instantiation names. HP,jbralley,16Oct95.
#
ifeq ($(strip $(NOSHARED)),1)
	OPT = $($(dirName)_opts) -pth +a1 -w +DA1.1 +DS1.1  -Wl,-E $(UOPT)
	C_OPT   = $($(dirName)_opts) -pth -w +DA1.1 +DS1.1 -D_INCLUDE_XOPEN_SOURCE_EXTENDED $(UOPT)
else
	OPT = $($(dirName)_opts) -pth +a1 +Z -w  +DA1.1 +DS1.1 -Wl,-E $(UOPT)
	C_OPT   = $($(dirName)_opts) -pth +Z -w +DA1.1 +DS1.1 -D_INCLUDE_XOPEN_SOURCE_EXTENDED $(UOPT)
endif

LDOPT   = $($(dirName)_ldopts) $(DEBUGOPT) $(ULDOPT)

# I found the following -D flags in the old makefiles, but could
# find no current use of them in the code.
# -DIALL_CHECKS  -D_CMA_NOWRAPPERS_ -D_CMA_PROTO__

DEF =   $($(dirName)_defs) \
        -DHPUX \
        -DHPCC \
        -DHP_FIX \
        -DHP_BASIC_ENV \
        -DHP_FULCRUM \
        -DTRUE=1 \
        -DFALSE=0 \
        -Dsigned= \
        -D_UNIX_ \
        -D_REENTRANT \
        -D_CMA_REENTRANT_CLIB_ \
        -D_PROTOTYPES \
        -D_X11_ \
        -DIALL_CHECKS \
        -DPSYS=4 \
        -DHPUX \
        $(UDEF) \
        $(DEBUGDEFS)

#        -D_CMA_NOWRAPPERS_ 
#        -DNO_STREAM_WRAPPERS 

# .c -D defaults
C_DEF = $($(dirName)_defs) \
        -D_BSD \
        -D__STR31__ \
        -D_POSIX_SOURCE \
        -D_XOPEN_SOURCE \
        -D_INCLUDE_HPUX_SOURCE \
        -D_ALL_SOURCE \
        -DIDL_PROTOTYPES \
        $(UDEF)

# .cpp -I defaults
INCL =  -I. \
        $($(dirName)_incls) \
        -I $(INCDIR) \
        -I /opt/CC/include/CC      \
        -I /usr/include \
        -I /opt/dce/include  \
        -I /usr/local/ossasn1   \
        $(UINCL)

# .c defaults -I
C_INCL= -I.\
        $($(dirName)_incls)\
        -I $(INCDIR)\
        -I /usr/include\
        $(UINCL)

LDOPT = $($(dirName)_ldopts)\
        -I $(INCDIR)\
        $(DEBUGOPT)\
        $(ULDOPT)

#----------------------------------
# the aix compile and link options
#  AIX specific compile options. HP C++ should never touch this section.

else

OBJFLAG = -c

OPT =   $($(dirName)_opts) \
        -M \
        -+ \
        -qinfo=enu:lan:rea:ret:und \
        -qhalt=w \
        $(UOPT)

C_OPT = $($(dirName)_opts) \
        $(UOPT)

LDOPT = $($(dirName)_ldopts) \
        $(DEBUGOPT) \
        $(ULDOPT)

# i found the following -D flags in the old makefiles, but could
# find no current use of them in the code
# -DIALL_CHECKS  -D_CMA_NOWRAPPERS_ -D_CMA_PROTO__

DEF =   $($(dirName)_defs) \
        -DAIX \
        -DIALL_CHECKS \
        -DPSYS=4 \
        $(UDEF) \
        $(DEBUGDEFS)

# .c -D defaults
C_DEF = $($(dirName)_defs) \
        -DAIXV3 \
        -D_BSD \
        -D__STR31__ \
        -DAIX_RS6000 \
        -D_POSIX_SOURCE \
        -D_XOPEN_SOURCE \
        -D_ALL_SOURCE \
        -DIDL_PROTOTYPES \
 .cpp -I defaults
INCL =          -I.\
                $($(dirName)_incls)\
                -I $(INCDIR)\
                -I /usr/lpp/xlC/include\
                -I /usr/include\
                $(UINCL)

# .c defaults -I
C_INCL =        -I.\
                $($(dirName)_incls)\
                -I $(INCDIR)\
                -I /usr/include\
                $(UINCL)
endif
#
#---------------------------------------------------------------------

# .cpp c preprocessor flags
CPPFLAGS =  $(DEF) $(INCL)

# c. c preprocessor flags
C_CPPFLAGS =  $(C_DEF) $(C_INCL)

# .cpp compile flags
CFLAGS = $(OPT)

# .c compile flags
C_CFLAGS = $(C_OPT)


######################################################################
#
# 3: specific rules and special (non-generic) rules:
#
######################################################################
# you may add special types of rules here.  these rules will get
# invoked by generic rules below which invoke rules for the variables:
# 1) _specific - invoked as dependency for library.
# 2) clean_    - invoked by generic clean rule
# 3) _objs     - linked into library
#
# 1) we have some files which are generated by special compilers, e.g.
#    all the oid .cat and associated files.  in order to create those
#    kinds of things, any directory can have special rules which are
#    set with the _specific target.
#    e.g. the special things required before building the oid library
#         are:
#    oid_specific: odbgen external.db $(oidHdrFiles) ... etc
#        @rm $(tsDir)/oid_specific; touch $(tsDir)/oid_specific
#
#    note: you do need to create some kind of timestamp in order to keep
#          track of whether your special target is up to date. (note the
#          touch command in the rule above.)
#
# 2) for any special clean up needed you can make a clean_ rule
#    e.g. when cleaning the lib/dpo directory, we can also delete
#         the dpo_if.h file:
#    clean_dpo:
#               rm -f $(INCDIR)/dpo_if.h
#    when the dpo directory has clean rule run, it also runs this
#    special rule.
#
# 3) we have some cases where we throw some objects which we did not
#    compile (in fact we copy them from /usr/lib) and we archive them
#    in one our libraries.  the _obj allows you to create a list
#    of objects (for which there is no source) which is to be put
#    in a library.

#---------------------------------------------------------------------
# rules for basic environment
#---------------------------------------------------------------------

# these source files are generated from idl compiler

basicDSCSrcs := basicds_cstub.c basicds_sstub.c
basicDSObjs  := basicds_cstub.o basicds_sstub.o
basicDSDir   := $(SRCDIR)$(FS)ns
idlCompiler  := /opt/dce/bin/idl
        #
        # The following target accomodates the `mkbuild'
        # convention of assigning `_<libName>' to the end of file
        # names, hence the `_pd' filename suffix in build/lib/pd.
        # HP,jbralley,1Oct95
        #
basicds.h $(basicDSCSrcs): $(basicDSDir)$(FS)basicds.idl
	@echo Running the idl compiler to generate BasicDS source/includes ...
	$(echo) rm -f $(basicDSDir)/basicds_cstub.c
	$(echo) rm -f $(basicDSDir)/basicds_sstub.c
	$(echo) rm -f $(INCDIR)$(FS)basicds.h
	$(echo) rm -f $(basicDSCSrcs)
	$(echo) $(idlCompiler) $(basicDSDir)$(FS)basicds.idl -keep c_source
	$(echo) mv basicds.h ../../../inc/basicds.h
	$(echo) mv basicds_cstub.c $(basicDSDir)
	$(echo) mv basicds_sstub.c $(basicDSDir)
	$(echo) ln -fs $(basicDSDir)/basicds_cstub.c .
	$(echo) ln -fs $(basicDSDir)/basicds_sstub.c .

basicds_specific := basicds_specific
basicds_specific: basicds.h $(basicDSCSrcs)
	@rm -f $(tsDir)$(FS)basicds_specific
	@touch $(tsDir)$(FS)basicds_specific

basicds:
	$(echo)$(MAKE) -C $(lib)$(FS)pd basicds_specific

clean_basicds:
	rm -f $(INCDIR)$(FS)basicds.h
	rm -f $(OBJDIR)$(FS)basicds_[cs]stub.o
	cd    $(basicDSDir); rm -f $(basicDSCSrcs) $(basicDSObjs)

#---------------------------------------------------------------------
# rules for dpo
#---------------------------------------------------------------------
#
# these object files get copied into the dpo library
#
ifeq ($(strip $(OS)),aix)
    pd_objs := $(wildcard $(top)/src/dpo/asn1code_objs/*.o)
endif
#
# these source files are generated from idl compiler
#
dpoCSrcs := dpo_if_sstub.c dpo_if_cstub.c
dpoDir   := $(SRCDIR)$(FS)dpo

ifeq ($(strip $(OS)),hpux)
    idlCompiler := /opt/dce/bin/idl
else
    idlCompiler := /opt/dcelocal/bin/idl
endif

ifeq ($(strip $(OS)),os2)
    idlCompiler := d:\\opt\\dcelocal\\bin\\idl
endif

# this header file and several .c files are generated
dpo_if.h $(dpoCSrcs): dpo_if.idl
	@echo Running the idl compiler to generate dpo source and includes ...
	$(echo)rm -f $(dpoDir)/dpo_if_cstub.c
	$(echo)rm -f $(dpoDir)/dpo_if_sstub.c
	$(echo)rm -f $(INCDIR)$(FS)dpo_if.h
	$(echo)rm -f $(dpoCSrcs)
	$(echo)$(idlCompiler) dpo_if.idl -keep c_source
	$(echo)mv dpo_if.h $(INCDIR)
ifeq ($(strip $(OS)),hpux)                      #HP,jbralley,added 01Sep95.
	$(echo)mv $(dpoCSrcs) $(dpoDir)
	$(echo)ln -fs $(dpoDir)/dpo_if_sstub.c .
	$(echo)ln -fs $(dpoDir)/dpo_if_cstub.c .
endif
ifeq ($(strip $(OS)),aix)
	$(echo)mv $(dpoCSrcs) $(dpoDir)
	$(echo)ln -fs $(dpoDir)/dpo_if_sstub.c .
	$(echo)ln -fs $(dpoDir)/dpo_if_cstub.c .
endif

dpo_specific := dpo_specific
dpo_specific: dpo_if.h $(dpoCSrcs)
	@rm -f $(tsDir)$(FS)dpo_specific; touch $(tsDir)$(FS)dpo_specific

dpo:
	$(echo)$(MAKE) -C $(lib)$(FS)pd dpo_specific

# dpa_all can't use the /usr/include directories (different than other
# files in this directory)

allcObj := $(filter-out dpa_all.o, $(allcObj))
dpa_all.o: dpa_all.c
	@echo Compiling $< ...
	@rm -f $(OBJDIR)$(FS)dpa_all.o
ifeq ($(strip $(OS)),os2)
	$(echo)$(compiler) /c $(UOPT) /DOS2 -I $(INCDIR)\
	        /o $(OBJDIR)/$(notdir $@) $<
else
	#HPUX_AIX common compiler option

	$(echo)$(compiler) -c $(OPT) $(DEF) $(UOPT) -I $(INCDIR)\
		-o $(OBJDIR)/$(notdir $@) $<
endif

# make a clean rule we can run from anywhere

dpo_clean:
	$(echo)$(MAKE) -C $(lib)$(FS)dpo clean_dpo

clean_dpo:
	@echo Removing header files created by dpo ...
	$(echo)rm -f $(INCDIR)$(FS)dpo_if.h
	@echo Removing C source files create by dpo ...
	$(echo)rm -f $(dpoDir)/dpo_if_cstub.c
	$(echo)rm -f $(dpoDir)/dpo_if_sstub.c
	$(echo)rm -f $(dpoCSrcs)

#--------------------------------------------------------------------
# rules for pdcommand
#---------------------------------------------------------------------

# create links for all commands to pdcommand

ifeq ($(strip $(OS)),os2)
pdCommands :=	pdls pdpr pdq
else
#HPUX_AIX common section to define pdCommands
pdCommands :=	pdclean pdcreate pddelete pddisable pdenable pdgate\
		pdls pdmod pdpause pdpr pdpromote pdq pdresubmit\
		pdresume pdrm pdset pdshutdown pdstopd
endif

ifeq ($(strip $(OS)),os2)
  pdCommands := $(patsubst %,%.cmd, $(pdCommands))
  pdCommands := $(patsubst %,$(BINDIR)\\\\%, $(pdCommands))
else
  #HPUX_AIX common section to define pdCommand paths command by command
  pdCommands := $(patsubst %, $(BINDIR)/%, $(pdCommands))
endif

clean_pdcommand:
	@echo Removing links from commands to pdcommand ...
	@rm -f $(pdCommands)

$(pdCommands):
ifeq ($(strip $(OS)),os2)
	@echo Creating rexx file $(notdir $@) ...
	@echo /*                                                            */  > tmp.cmd
	@echo /* COPYRIGHT:                                                 */ >> tmp.cmd
	@echo /*   5765-273 (C) COPYRIGHT IBM CORPORATION 1995.             */ >> tmp.cmd
	@echo /*   OCO SOURCE MATERIALS - IBM CONFIDENTIAL                  */ >> tmp.cmd
	@echo /*   (IBM CONFIDENTIAL RESTRICTED WHEN AGGREGATED             */ >> tmp.cmd
	@echo /*   WITH ALL OCO SOURCE MODULES OF THIS PRODUCT)             */ >> tmp.cmd
	@echo /*   THE SOURCE CODE FOR THIS PROGRAM IS NOT PUBLISHED OR     */ >> tmp.cmd
	@echo /*   OTHERWISE DIVESTED OF ITS TRADE SECRETS, IRRESPECTIVE OF */ >> tmp.cmd
	@echo /*   WHAT HAS BEEN DEPOSITED WITH THE U.S. COPYRIGHT OFFICE.  */ >> tmp.cmd
	@echo /*                                                            */ >> tmp.cmd
	@echo /* $(notdir $(subst \\,/,$@))                                 */ >> tmp.cmd
	@echo parse arg arglist >> tmp.cmd
	@echo \'pdcommand $(notdir $(patsubst %.cmd,%,$(subst \\,/,$@)))\' arglist >> tmp.cmd
	$(echo)mv tmp.cmd $@
else
	@echo Creating link $(notdir $@) to pdcommand ...
	$(echo)cd $(BINDIR); ln -fs pdcommand $(notdir $@)
endif

ifeq ($(strip $(OS)),os2)
pdcommands:
	$(echo)$(MAKE) -C $(exe)$(FS)pdcommand pdcommand_specific
else
#HPUX_AIX common make build for pd command specific continues
pdcommand_specific := pdcommand_specific
endif

pdcommand_specific: $(pdCommands)
	$(echo)rm -f $(tsDir)$(FS)pdcommand_specific
	$(echo)touch $(tsDir)$(FS)pdcommand_specific

# ifeq ($(strip $(OS)),aix)
# {

#---------------------------------------------------------------------
# rules for asn1
#---------------------------------------------------------------------

# order of files appears to be important.  can't use wildcard to get asns.

asnFiles :=	dpa_all.asn\
	        iso_rose.asn\
	        iso_abs.asn\
	        iso_dor.asn\
	        iso_font.asn\
	        iso_info.asn\
	        iso_mts.asn\
	        iso_sel.asn\
	        iso_use.asn\
	        dpa_0d.asn\
	        dpa_0a.asn\
	        dpa_0b.asn\
	        dpa_0c.asn\
	        dpa_0f.asn\
	        pd_0b.asn
asn1:
	@echo 'Building asn1 (WARNING: Must be performed on Leo) ...'
	$(echo)$(MAKE) -C $(lib)/asn1 dpa_all.h

# this rule generates both a dpa_all.c and dpa_all.h.  must be run on
# leo.
dpa_all.h: $(asnFiles)
	@echo Creating dpa_all.c dpa_all.h from asn files ...
	$(echo)/usr/local/ossasn1/asn1 -SORT -SUPPRESS 79I\
	        -SUPPRESS 256W -V -L -NOUNIQUEPDU -SHORTENNAMES\
	        -C++ -PREFIX PD -cont dpa_all.c -h dpa_all.h\
	        -l dpa_all.lst -externalname dpa_all $^
	@echo Filtering dpa_all.c and dpa_all.h ...
	$(echo)filter_dpa_all dpa_all.c dpa_all.h
	@echo Installing dpa_all.c and dpa_all.h ...
	@rm -f $(SRCDIR)/asn1/dpa_all.c
	$(echo)mv dpa_all.c dpa_all.lst $(SRCDIR)/asn1
	@rm -f $(INCDIR)/dpa_all.h
	$(echo)mv dpa_all.h $(INCDIR)

# I don't know if we really want to do this since only leo can rebuild
# these things. clean_asn1 would be called by the generic clean rule
#clean_asn1:

# instead make a clean rule which we can run manually
asn1_clean:
	@echo Removing dpa_all.c, dpa_all.o and dpa_all.h ...
	@rm -f  $(SRCDIR)/dpa_all.c\
                $(INCDIR)/dpa_all.h\
                dpa_all.lst\
                $(OBJDIR)/dpa_all.o

#---------------------------------------------------------------------
# rules for pdapi
#---------------------------------------------------------------------

allcObj := $(filter-out pdnotify.o, $(allcObj))
pdnotify.o: pdnotify.c
	@echo Compiling $< ...
	$(echo)$(compiler) -c $(UOPT) $(UDEF) $(DEF) -DIALL_CHECKS\
                -DTHREAD_DCE -I $(INCDIR) -I /usr/include\
                -o $(OBJDIR)/$(notdir $@) $<

#---------------------------------------------------------------------
# rules for gui
#---------------------------------------------------------------------


helpDir := $(SRCDIR)/help

GMsg_msg.h: $(helpDir)/GMsg.msg
	@echo Creating GMsg_msg.h ...
	$(echo)rm -f $(helpDir)/GMsg.cat
	$(echo)mkcatdefs GMsg $^ | gencat $(helpDir)/GMsg.cat
	$(echo)rm -f $(INCDIR)/GMsg_msg.h
	$(echo)mv $(notdir $@) $(INCDIR)

GMsg_cat.h: $(helpDir)/GLabels.msg
	@echo Creating GMsg_cat.h ...
	$(echo)rm -f $(INCDIR)/$(notdir $@)
	$(echo)cat $^ | /usr/local/tools/rs6/msg2define\
                >$(INCDIR)/$(notdir $@)

pdgui_specific := pdgui_specific
pdgui_specific: GMsg_msg.h GMsg_cat.h
	@rm -f $(tsDir)/pdgui_specific; touch $(tsDir)/pdgui_specific

pdgui:
	$(echo)$(MAKE) -C $(lib)/pdgui pdgui_specific

clean_pdgui:
	@echo Removing GMsg_msg.h GMsg_cat.h ...
	$(echo)rm -f $(INCDIR)/GMsg_msg.h $(INCDIR)/GMsg_cat.h
#---------------------------------------------------------------------
# rules for oid
#---------------------------------------------------------------------

oidDir := $(SRCDIR)/oid

oidDbToBuildFrom := oidpsf6K.db oidsbsd.db oidpiobe.db
oidDbToBuild     := $(patsubst oid%, ibm%, $(oidDbToBuildFrom))
oidSrcToBuild    := $(patsubst %.db, %.cpp, $(oidDbToBuildFrom))
oidIncToBuild    := $(patsubst %.cpp, %.h, $(oidSrcToBuild))
oidCatToBuild    := $(patsubst %.db, %.cat, $(oidDbToBuild))
oidSrcFiles      := oid_con.cpp $(oidSrcToBuild)
oidHdrFiles      := $(patsubst %.cpp, %.h, $(oidSrcFiles))
oidDbFiles       := pd.db $(oidDbToBuild)
oidCatFiles      := ibmoid.cat $(oidCatToBuild) oid_ut.cat

oid:
	$(echo)$(MAKE) -C $(lib)/ordered oid_specific

oid_specific := oid_specific
oid_specific:   external.db\
                $(oidHdrFiles)\
                $(oidSrcFiles)\
                $(oidDbFiles)\
                $(oidCatFiles)\
                fpa.cat\
                fpahelp.cat\
                oid_def.h
	@rm -f $(tsDir)/oid_specific; touch $(tsDir)/oid_specific

$(oidIncToBuild): %.h: %.db
	@echo Creating oid include files ...
	$(echo)rm -f $(INCDIR)/$(notdir $@);\
                $(BINDIR)/odbgen -h $(INCDIR)/$(notdir $@) $<

$(oidSrcToBuild): %.cpp: %.db
	@echo Creating oid cpp files ...
	$(echo)rm -f $(oidDir)/$@; $(BINDIR)/odbgen -s $(oidDir)/$@ $<
	$(echo)ln -fs $(oidDir)/$@ $@

$(oidDbToBuild): ibm%.db: oid%.db
	@echo Creating oid db files ...
	$(echo)rm -f $(odbDir)/$@; $(BINDIR)/odbgen -d $(odbDir)/$@ $<
	$(echo)ln -fs $(odbDir)/$@ $@

$(oidCatToBuild): ibm%.cat: oid%.db
	@echo Creating oid cat files ...
	$(echo)rm -f $(oidDir)/$@; $(BINDIR)/odbgen -t $(oidDir)/$@ $<
	$(echo)ln -fs $(oidDir)/$@ $@

odbMainDeps :=  $(oidDir)/oid_vc.db\
                $(oidDir)/oid_oc.db\
                $(oidDir)/oid_att.db\
                $(oidDir)/oid_pd.db\
                $(oidDir)/oid_val.db\
                $(oidDir)/oid_syn.db

oid_con.h: $(odbMainDeps)
	@echo Creating oid_con.h ...
	$(echo)rm -f $(INCDIR)/$(notdir $@);\
                $(BINDIR)/odbgen -h $(INCDIR)/$(notdir $@) odbmain.db

oid_def.h: $(odbMainDeps)
	@echo Creating oid_def.h ...
	$(echo)rm -f $(INCDIR)/$(notdir $@);\
                $(BINDIR)/odbgen -P $(INCDIR)/$(notdir $@) odbmain.db

oid_con.cpp: $(odbMainDeps)
	@echo Creating oid_con.cpp ...
	$(echo)rm -f $(oidDir)/$@; $(BINDIR)/odbgen -s $(oidDir)/$@ odbmain.db
	$(echo)ln -fs $(oidDir)/$@ $@

external.db: $(odbMainDeps)
	@echo Creating external.db ...
	$(echo)rm -f $(oidDir)/$@; $(BINDIR)/odbgen -e $(oidDir)/$@ odbmain.db
	$(echo)ln -fs $(oidDir)/$@ $@

pd.db: $(odbMainDeps)
	@echo Creating pd.db ...
	$(echo)rm -f $(odbDir)/pd.db;\
	        $(BINDIR)/odbgen -d $(odbDir)/pd.db odbmain.db
	$(echo)ln -fs $(oidDir)/pd.db pd.db

ibmoid.cat: $(odbMainDeps)
	@echo Creating ibmoid.cat ...
	$(echo)rm -f $(oidDir)/$@; $(BINDIR)/odbgen -t $(oidDir)/$@ odbmain.db
	$(echo)ln -fs $(oidDir)/$@ $@

oid_ut.cat: oid_ut.db
	@echo Creating oid_ut.cat ...
	$(echo)rm -f $(oidDir)/$@; $(BINDIR)/odbgen -t $(oidDir)/$@ $<
	$(echo)ln -fs $(oidDir)/$@ $@

commonDir := $(SRCDIR)/common

$(commonDir)/fpamsg.msg $(commonDir)/fpahelp.msg: \
                $(commonDir)/fpa.msg\
                $(commonDir)/subword.fpamsg

ifneq ($(strip $(OS)),hpux)
        #HP, jbralley, The msg file in the $(commonDir) area.
        @echo Creating $@ files ...
        $(echo)rm -f $@
        $(echo)genmsg $(commonDir)/fpa.msg $(commonDir)/subword.fpamsg
endif

fpa.cat: $(commonDir)/fpamsg.msg
	@echo Creating fpa.cat file ...
	$(echo)rm -f $(commonDir)/$@
	$(echo)gencat $(commonDir)/$@ $(commonDir)/fpamsg.msg
	$(echo)ln -fs $(commonDir)/$@ $@

fpahelp.cat: $(commonDir)/fpahelp.msg
	@echo Creating fpahelp.cat file ...
	$(echo)rm -f $(commonDir)/$@
	$(echo)gencat $(commonDir)/$@ $(commonDir)/fpahelp.msg
	$(echo)ln -fs $(commonDir)/$@ $@

clean_oid:
	@echo Removing oid generated cpp, db, cat, and .h files ...
	$(echo)rm -f $(patsubst %, $(oidDir)/%, external.db oid_con.cpp)
	$(echo)rm -f $(patsubst %, $(oidDir)/%, $(oidCatFiles))
	$(echo)rm -f $(patsubst %, $(oidDir)/%, $(oidSrcFiles))
	$(echo)rm -f $(patsubst %, $(INCDIR)/%, $(oidHdrFiles))
	$(echo)rm -f $(patsubst %, $(odbDir)/%, $(oidDbFiles))
	$(echo)rm -f $(INCDIR)/oid_def.h
	$(echo)rm -f $(commonDir)/fpa.cat
	$(echo)rm -f $(commonDir)/fpahelp.cat

ifeq ($(strip $(OS)),os2)
# {

commonDir := $(SRCDIR)\\common
fpa: fpa.cat fpahelp.cat

fpa.cat: $(commonDir)\\fpamsg.msg
	@echo Creating fpa.cat file ...
	$(echo)rm -f $(commonDir)\\$@
	$(echo)gencat $(commonDir)\\$@ $(commonDir)\\fpamsg.msg
	$(echo)cp $(commonDir)\\$@ \\pdbase\\nls\ENUS850\\$@

fpahelp.cat: $(commonDir)\\fpahelp.msg
	@echo Creating fpahelp.cat file ...
	$(echo)rm -f $(commonDir)\\$@
	$(echo)gencat $(commonDir)\\$@ $(commonDir)\\fpamsg.msg
	$(echo)cp $(commonDir)\\$@ \\pdbase\\nls\ENUS850\\$@

# }
endif

######################################################################
#
# 4: generic rules
#
######################################################################

#---------------------------------------------------------------------
# 4a: generic rule to build a .o
#---------------------------------------------------------------------

# for compiling, we compile the file in the local dir, then mv it
# because it creates the format of .u file (generated from the -M)
# that we want

ifeq ($(strip $(OS)),hpux)
    define compileMacro
        @echo Compiling $< ...
        @rm -f $(OBJDIR)$(FS)$(notdir $@)
        $(echo)$(compiler) $(OBJFLAG) $($(patsubst %,%_defs, $<))\
                $(CFLAGS) $(CPPFLAGS) $< -o $(OBJDIR)$(FS)$(notdir $@)
    endef
else
    # AIX case
    define compileMacro
        @echo Compiling $< ...
        @rm -f $(OBJDIR)$(FS)$(notdir $@)
        $(echo)$(compiler) $(OBJFLAG) $($(patsubst %,%_defs, $<))\
                $(CFLAGS) $(CPPFLAGS) $<
        $(echo)rm -f  $(OBJDIR)$(FS)$(notdir $@)
        $(echo)mv $(notdir $@) $(OBJDIR)
        $(echo)rm -f $(depDir)$(FS)$(patsubst %.$(OBJ),%.u, $(notdir $@))
        $(echo)mv $(patsubst %.$(OBJ),%.u, $(notdir $@)) $(depDir)
    endef
endif

ifeq ($(strip $(OS)),os2)
    define compileMacro
        @echo Compiling $< ...
        @rm -f $(OBJDIR)$(FS)$(notdir $@)
        $(echo)$(compiler) $(OBJFLAG) $($(patsubst %,%_defs, $<))\
                $(CFLAGS) $(CPPFLAGS) $<
        $(echo)rm -f  $(OBJDIR)$(FS)$(notdir $@)
        $(echo)mv $(notdir $@) $(OBJDIR)
    endef
endif

here_obj: $(allObj)

$(allCppObj): %.$(OBJ): %.cpp
	$(compileMacro)

$(allCObj): %.$(OBJ): %.C
	$(compileMacro)

$(allcObj): %.$(OBJ): %.c
	@echo Compiling $< ...
	$(echo)$(compiler) $(OBJFLAG) $($(patsubst %,%_defs, $<))\
	        $(C_CFLAGS) $(C_CPPFLAGS) $<
	$(echo)rm -f $(OBJDIR)$(FS)$(notdir $@)
	$(echo)mv    $(notdir $@) $(OBJDIR)

#---------------------------------------------------------------------
# 4b: generic rule to build library
#
# A library is built for each directory in the build/lib sub-directory
# $(libNames).
#
# Shared libraries
#
# Building shared libraries is a three step process.  First, we build
# the non-shared library, in order to allow for single file updates
# ( a shared library cannot be updated like an archive).  Second,
# we create an equivalent shared library to the non-shared library,
# with unresolved external references.  This shared library
# can be used for linking purposes, but it cannot be executed
# until the external references are resolved.  Third, the
# shared library is recreated, linking against the other shared library
# to resolve external references.
#
# lib dependencies:
#
# libns.$(LIB) : objects
#       also build lib.$(LIB)
# ts_name : all libns.$(LIB)
#---------------------------------------------------------------------

# for any library, you can create a special target which gets checked
# before the library is created.  e.g. there is an $(oid_specific) which
# exists above which runs the oid compiler top generate all the .cpp,
# .h, .cat, and .db files which are part of the oid library.

# just in case there is no target for $(dirName)_specific, make a default

specific   := $($(dirName)_specific)

libnsNames := $(patsubst %, lib%.$(LIBNS), $(libs))
libnsName  := $(LIBDIR)$(FS)lib$(dirName).$(LIBNS)

$(libnsNames):
	@echo Checking library $@ ...
	$(echo)$(MAKE) --no-print-directory\
                -C $(lib)$(FS)$(patsubst lib%.$(LIBNS),%, $@)\
                $(LIBDIR)$(FS)$@

# e.g. $(LIBDIR)/liboid.$(LIB): oid_specific oid_con.o ... (have to echo
# it for os2 to create proper target name, also, in patsubst, I have to put
# to get the command to work correctly).

$(shell echo $(libnsName)): $(specific) $(libObj)

    ifeq ($(strip $(NOSHARED)),1)
	@echo Creating archive $(notdir $(libnsName)) ...
    endif

ifeq    ($(strip $(OS)),os2)
	$(echo)rm -f $(libnsName)
	$(echo)lib /P:512 /NOE /NOI $(libnsName)\
                $(patsubst %, +$(OBJDIR)\\\\%,  $(notdir $(libObj)))\
                $($(dirName)_objs);
else
    ifeq ($(strip $(NOSHARED)),1)
	$(echo)rm -f $(libnsName)
	$(echo)ar r $(libnsName) $(patsubst %, $(OBJDIR)$(FS)%,\
                $(notdir $(libObj))) $($(dirName)_objs)
    endif
endif

libNames := $(patsubst %, lib%.$(LIB), $(libs))
libName  := $(shell echo $(LIBDIR)$(FS)lib$(dirName).$(LIB))
finalName := $(shell echo /opt/pd/lib/lib$(dirName).$(LIB))

#HPUX_AIX common shared library build. HP uses CC -b to build.

# e.g. liboid.$(LIB):

$(libNames):
	@echo Checking shared library $@ ...
	$(echo)$(MAKE) --no-print-directory\
		-C $(lib)$(FS)$(patsubst lib%.$(LIB),%, $@)\
		$(LIBDIR)$(FS)$@
$(shell echo $(libName)): $(specific) $(libObj)
#	@echo Creating shared library $(notdir $(libName)) ...

ifeq    ($(strip $(OS)),hpux)

ifeq    ($(strip $(dirName)),ordered)
	$(echo)CC $(LDOPT) $(ULDOPT) $(UOPT) -b $($(dirName)_priority) \
		-Wl,+h$(finalName)\
	        -L$(LIBDIR) -o $(libName) \
		$(OBJDIR)/dpa_s.o \
		$(OBJDIR)/oid_prof.o \
		$(OBJDIR)/attset.o \
		$(OBJDIR)/oid_init.o \
		$(OBJDIR)/valstr.o \
		$(OBJDIR)/valoth.o \
		$(OBJDIR)/valnum.o \
		$(OBJDIR)/oid_con.o \
		$(OBJDIR)/oidsbsd.o \
		$(OBJDIR)/oidpsf6K.o \
		$(OBJDIR)/oidpiobe.o \
		$(OBJDIR)/boid.o \
		$(OBJDIR)/libordered_rev.o
else
ifeq    ($(strip $(dirName)),fcrm0)
	   	$(echo)CC $(UOPT) -b -o $@ $(OBJDIR)/dsfdrv.o
endif
ifeq   ($(strip $(dirName)),suv)
		$(echo)CC $(LDOPT) $(ULDOPT) $(UOPT) -b $($(dirName)_priority)\
		-Wl,+h$(finalName)\
	        -L$(LIBDIR) -o $(libName)\
	        $(patsubst %, $(OBJDIR)$(FS)%, $(notdir $(libObj)))\
	        $($(dirName)_objs) -L/usr/lib/ -lC.ansi -L/usr/lib -lm\
		-L$(SNMPDIR) -lsnmp -Wl,+b$(TOOLDIR):/opt/pd/lib
else
		$(echo)CC $(LDOPT) $(ULDOPT) $(UOPT) -b $($(dirName)_priority)\
		-Wl,+h$(finalName)\
	        -L$(LIBDIR) -o $(libName)\
	        $(patsubst %, $(OBJDIR)$(FS)%, $(notdir $(libObj)))\
	        $($(dirName)_objs) -L/usr/lib/ -lC.ansi -L/usr/lib -lm
endif
endif
else
	$(echo)CC -b -o $(libName) $(libnsName)
	$(echo)CC $(ULDOPT) -b $($(dirName)_priority)\
                -L/usr/lpp/pd/lib -L$(LIBDIR) -o $(libName)\
                $(patsubst %, $(OBJDIR)$(FS)%, $(notdir $(libObj)))\
                $($(dirName)_objs)
endif

libTsNames := $(patsubst %, %_ts, $(libs))
libTsName  := $(shell echo $(tsDir)$(FS)$(dirName)_ts)

# e.g. oid_ts:

$(libTsNames):
	@echo Checking if shared library\
	        $(patsubst %_ts,lib%.$(LIB),$@) is resolved ...
	$(echo)$(MAKE) --no-print-directory\
	        -C $(lib)$(FS)$(patsubst %_ts,%, $@) $(tsDir)$(FS)$@

libFullNames := $(patsubst %, $(LIBDIR)$(FS)lib%.$(LIBNS), $(shLibs))
$(libFullNames):

pdLibs := $(commonShLibs) dce pthreads c_r
pdLibs := $(patsubst %, -l%, $(pdLibs))

# e.g. $(tsDir)/oid_ts: $(LIBDIR)/liboid.$(LIB) ...

$(libTsName): $(libFullNames)

	@echo Resolving shared library $(notdir $(libName)) ...

#       $(echo)CC $(ULDOPT) -b $($(dirName)_priority)\
#               -L/usr/lpp/pd/lib -L$(LIBDIR) $(pdLibs)\
#               -o $(libName)\
#               $(patsubst %, $(OBJDIR)$(FS)%, $(notdir $(libObj)))\
#               $($(dirName)_objs)
#       @rm -f $@; touch $@

nslibs: $(libnsNames)

# list of all our shared libraries
ourShLibs := $(patsubst %, lib%.$(LIB), $(shLibs))

libs: dpo oid $(libnsNames) $(ourShLibs) resolve_all_s_libs

#---------------------------------------------------------------------
# 4c: generic rule to build an executable
#---------------------------------------------------------------------

ifeq ($(strip $(OS)),os2)
    exeNames := $(patsubst %, %.exe, $(exes))
    exeName  := $(BINDIR)\\$(dirName).exe
else
    #HPUX_AIX common
    exeNames := $(exes)
    exeNames := $(patsubst odbgen, , $(exeNames))
    exeName  := $(BINDIR)/$(dirName)

odbgen:
	@echo Direct build of $@ ...
	$(MAKE) --no-print-directory\
		-C $(exe)/$@\
		$(BINDIR)/$@
endif

# HP specfic dspmsg program

ifeq ($(strip $(OS)),hpux)

dspmsg: $(top)$(FS)src/common/dspmsg.cpp
	@echo Direct build of $@ ...
	CC -o $(BINDIR)/$@ -s -Wl,-Fw +DA1.1 +DS1.1 $(top)$(FS)src/common/dspmsg.cpp
	@echo Done building of $@
endif

# e.g. spooler supervisor ... :

$(exeNames):
	@echo Checking executable $@ ...
ifeq    ($(strip $(OS)),os2)
	$(echo)$(MAKE) --no-print-directory\
	        -C $(exe)\\$(patsubst %.exe,%, $@)\
	        update_libraries\
	        $(BINDIR)\\$@
else
#HP:Remove binary file if `x' permission bit is not set.  jbralley,13Oct95.
	$(echo)if [ ! -x $(BINDIR)/$@ ]; then rm -f $(BINDIR)/$@; fi
	$(echo)$(MAKE) --no-print-directory\
                -C $(exe)/$@\
                update_libraries\
                $(BINDIR)/$@
endif

# for NOLIBCK, update_libraries does nothing

ifneq   ($(strip $(NOLIBCK)),)

update_libraries:
	@echo No library checking being performed ...
else

# for NOSHARED not set, perform all steps to create shared

ifneq ($(strip $(NOSHARED)),1)
update_libraries: create_dummy_s_libs  
else
update_libraries: check_ns_libs 
endif

endif

# all dependent libraries for this exe

allDepLibs := $($(dirName)_libs)
ifeq ($(strip $(NOSHARED)),1)
	allDepLibs := $(patsubst  %, lib%.$(LIBNS), $(allDepLibs))
else
	allDepLibs := $(patsubst  %, lib%.$(LIB), $(allDepLibs))
endif

# non shared libraries we must build for this exe

nsDepLibs  := $(patsubst %.$(LIBNS), %.$(LIBNS), $(allDepLibs))
nsDepLibs  := $(patsubst %.$(LIBNS), %.$(LIBNS), $(nsDepLibs))

# e.g. check_ns_libs: liboid.$(LIB) libspl.a ....

check_ns_libs: $(nsDepLibs)
	@echo "Done checking non shared libraries ..."
	@echo

# e.g. create_dummy_s_libs: liboid.sl ...

#create_dummy_s_libs: $(ourShLibs)
create_dummy_s_libs: $(allDepLibs)
	@echo "Done creating shared libraries ..."
	@echo

# shared libraries we must build for this exe

allDepLibs := $(filter-out %.$(LIBNS), $(allDepLibs))
sDepLibs   := $(filter-out %.$(LIBNS), $(allDepLibs))
sDepLibs   := $(filter-out %.$(LIBNS), $(sDepLibs))

# time stamps for resolved shared libraries

tsDepLibs  := $(patsubst lib%.$(LIB), %_ts, $(sDepLibs))

# e.g. resolve_s_libs: oid_ts ...

resolve_s_libs: $(tsDepLibs)
	@echo "Done resolving shared libraries ..."
	@echo

tsAllShLibs := $(patsubst %, %_ts, $(shLibs))
resolve_all_s_libs: $(tsAllShLibs)
	@echo Done resolving all shared libraries ..."
	@echo

# e.g. $(BINDIR)/spooler: a.o b.o ... $(LIBDIR)/liboid.$(LIB) ....
# Note: We depend on the explicit libraries (e.g. $(LIBDIR)/liboid.$(LIB),
# rather than liboid.$(LIB)). We are already guaranteed that the libraries
# are up to date from the execution of the $(exeLibDeps) rule.  but if this
# rule did update a library, we will need to relink our executable.  we
# recognize whether a library was rebuilt by adding it as a dependency.

ifeq ($(strip $(OS)),os2)

exeLibs := $(patsubst %, $(LIBDIR)\\\\%, $($(dirName)_libs))

ifneq   ($(strip $(NOSHARED)),)
        exeLibs = $(patsubst %, $(LIBDIR)\\\\%, $(nsDepLibs))
        allDepLibs := $(nsDepLibs)
endif

sysLibs := \
        e:\\templib\\so32dll.lib \
        e:\\templib\\tcp32dll.lib \
        e:\\xpg5\\i18n\\lib\\setloci.lib \
        d:\\opt\\dcelocal\\lib\\ibmccpp.lib \
        d:\\opt\\dcelocal\\lib\\ibmcpprt.lib \
        d:\\opt\\dcelocal\\lib\\dceos2.lib \
        d:\\toolkt21\\os2lib\\os2386.lib \
        d:\\ibmcpp\\lib\\dde4mbso.lib \
        e:\\oss\\asn1\\asn1code.lib
else
    #HPUX_AIX common


ifneq   ($(strip $(NOSHARED)),)
        allDepLibs := $($(dirName)_libs)
	allDepLibs := $(patsubst  %, lib%.$(LIBNS), $(allDepLibs))
	exeLibs = $(patsubst %, $(LIBDIR)/%, $(allDepLibs))
else
    exeLibs := $(patsubst %, -l%, $($(dirName)_libs))
endif

#HP specific exeLibs

#exeLibs :=  -l$(LIBDIR) $(exeLibs)
exeLibs :=  -L$(LIBDIR) $(exeLibs)
sysLibs :=  $(patsubst %, -l%, $($(dirName)_sys_libs))
usrLibs :=  $(patsubst %, -l%, $($(dirName)_usr_libs))
usrLibs := -L/usr/lib $(usrLibs)
lppLibs :=  $(patsubst %, -l%, $($(dirName)_lpp_libs))

ifeq ($(strip $(OS)),AIX)
    lppLibs := -L/usr/lpp/xlC/lib $(lppLibs)
endif

endif

# in some cases objects need to be force loaded.  e.g., the
# supervisor required that several oid constant objects be loaded
# explicitly.  thus, if an executable needs objects explicitly
# defined on the link line, you can create a variable '_objs'.
# (e.g. supervisor_objs := oid_cons.o ... ).   these are linked
# in before the objs for the source in the directory (which should
# include main).  it turns out that for some of our unit test cases,
# the oid stuff must be initialized before the stuff in main is
# initialized.
#
# this may be null.

forcedObjects := $($(dirName)_objs)
ifneq   ($(strip $(forcedObjects)),)
ifeq    ($(strip $(OS)),os2)
    forcedObjects := $(patsubst %, $(OBJDIR)\\\\%, $(forcedObjects))
else
    forcedObjects := $(patsubst %, $(OBJDIR)$(FS)%, $(forcedObjects))
endif
endif

ifeq ($(strip $(OS)),os2)
    allDepLibFullPaths := $(shell echo $(patsubst %, $(LIBDIR)\\\\%,\
                                $(allDepLibs)))
else
    allDepLibFullPaths := $(patsubst %, $(LIBDIR)/%, $(allDepLibs))
endif

rf  := response.rsp
def := def.def

$(shell echo $(exeName)):       $($(dirName)_specific)\
                                $(allObj)\
                                $(allDepLibFullPaths)\
                                $(debugObj)
	@echo Creating executable $(notdir $(exeName)) ...
	@rm -f $@
ifeq    ($(strip $(OS)),os2)
	@echo $(OPT) /B "/NOD /NOE /NOI /De"\
	        $(patsubst %, $(OBJDIR)\\\\%, $(notdir $(allObj))) > $(rf)
	@echo /Fe $(exeName) >> $(rf)
	@echo $(exeLibs) >> $(rf)
	@echo $($(dirName)_other_libs) >> $(rf)
	@echo $(def) >> $(rf)
	@echo NAME $(exeName) WINDOWCOMPAT > $(def)
	@echo DESCRIPTION >> $(def)
	@echo '    \'$(exeName)\'' >> $(def)
	$(echo)icc @$(rf)

else

#       $(echo)$(compiler) $(UOPT) $(LDOPT) -o $@ $(forcedObjects)\
#                $(patsubst %, $(OBJDIR)/%, $(notdir $(allObj)))\
#                $(debugObj) $(exeLibs) $($(dirName)_other_libs)\
#                $(lppLibs) $(usrLibs) $(sysLibs) $(debugLibs)

#       $(echo)$(compiler) $(OPT) $(DEF) $(LDOPT) -D_UNIX_\
#                -DNO_STREAM_WRAPPERS -I $(INCDIR) -I /usr/include\
#                -I /opt/CC/include/CC  -o $@ $(forcedObjects)\
#                $(patsubst %, $(OBJDIR)/%, $(notdir $(allObj)))\
#                $(debugObj) $(exeLibs) $($(dirName)_other_libs)\
#                $(usrLibs) $(sysLibs) $(debugLibs)\
#                -lpd -L/opt/CC/lib -lC.ansi\
#                -L /usr/lib -lm -L/opt/dce/lib -ldce\
#                -L/usr/local/ossasn1 -lasn1code
#
# Build non-shared or shared objects. HP,jbralley,13Oct95.
#
ifeq ($(strip $(NOSHARED)),1)
#	$(echo)$(compiler) $(OPT) -Wl,+n $(UOPT) $(DEF) -DNO_STREAM_WRAPPERS
	$(echo)$(compiler) $(OPT) -Wl,+n $(UOPT) $(DEF) \
                -I $(INCDIR) -I /usr/include -I /opt/CC/include/CC\
                -o $@ \
                $(patsubst %, $(OBJDIR)/%, $(notdir $(allObj)))\
		$(forcedObjects)\
		$(exeLibs)\
                -L/opt/dce/lib -ldc -ldce -L/usr/local/ossasn1 -lasn1code -lm
else
#	$(echo)$(compiler) $(OPT) $(UOPT) $(DEF) -DNO_STREAM_WRAPPERS
	$(echo)$(compiler) $(OPT) $(UOPT) $(DEF) \
                -I $(INCDIR) -I /usr/include -I /opt/CC/include/CC\
		-Wl,+h$(dirName)\
		-Wl,+b$(LIBDIR)\
                -o $@ $(forcedObjects)\
                $(patsubst %, $(OBJDIR)/%, $(notdir $(allObj)))\
		$(exeLibs)\
		-lm /usr/lib/libdc.a  -ldce\
                -L/usr/local/ossasn1 -lasn1code
endif


endif
	@echo Done creating executable $(notdir $(exeName)) ...
	@echo

#---------------------------------------------------------------------
# 4d: generic rule to build dependency makefile for a source file
#---------------------------------------------------------------------

#
# I left this stuff here, but it should no longer be necessary.
# Now have -M option on compile line which gerenates this stuff.

libDepends   := $(patsubst %, lib_%_depends, $(libs))
exeDepends   := $(patsubst %, exe_%_depends, $(exes))
ifeq ($(strip $(OS)),os2)
    depFiles := $(patsubst %, $(depDir)\\\\%, $(cppSrcDep) $(cSrcDep))
else
    depFiles := $(patsubst %, $(depDir)/%, $(cppSrcDep) $(cSrcDep))
endif

depends: $(libDepends) $(exeDepends)

lib_depends: $(libDepends)

$(libDepends):
	$(echo)$(MAKE) --no-print-directory\
                -C $(lib)/$(patsubst lib_%_depends,%, $@)\
                here_depends

$(exeDepends):
	$(echo)$(MAKE) --no-print-directory\
                -C $(exe)/$(patsubst exe_%_depends,%, $@)\
                here_depends

here_depends: $(cppSrcDep) $(cSrcDep)

define makeDepMacro
@echo Makedepend for $< ...
@touch $(depDir)/$(notdir $@)
$(echo)makedepend -f $(depDir)/$(notdir $@) $(DEF) $(CPPFLAGS)\
        $< 2> $(depDir)/$<.err
endef

$(cppSrcDep): %.u: %.cpp
	$(makeDepMacro)

$(cSrcDep): %.u: %.c
	$(makeDepMacro)

$(CSrcDep): %.u: %.C
	$(makeDepMacro)

# inclusion of header file dependencies
ifneq ($(strip $(DEPCK)),)
ifneq ($(strip $(depFiles)),)
-include $(depFiles)
endif
endif

#---------------------------------------------------------------------
# 4e: generic rules to perform clean on a directory
#---------------------------------------------------------------------
libClean := $(patsubst %, lib_%_clean, $(libs))
exeClean := $(patsubst %, exe_%_clean, $(exes))

# generic rule to clean all objects and misc files for this directory
# any other special files which need to be cleaned will require
# a target clean_oid.  (e.g. see clean_oid: above)

.PHONY: clean
clean: $(libClean) $(exeClean)
	@echo 'WARNING: asn1 must be cleaned manually (target: asn1_clean)'
	@echo '  This is not part of automatic clean because asn1 must'
	@echo '  be built specially on leo using the target: asn1.'

lib_clean: $(libClean)

$(libClean):
	$(echo)$(MAKE) --no-print-directory\
                -C $(lib)/$(patsubst lib_%_clean,%,$@) here_clean

$(exeClean):
	$(echo)$(MAKE) --no-print-directory\
                -C $(exe)/$(patsubst exe_%_clean,%,     $@) here_clean

# just in case there is no target for clean_$(dirName), make a default
clean_$(dirName):

depFilesBak := $(patsubst %, %.bak, $(depFiles))
depErrFiles := $(patsubst %, %.err, $(allSrc))

here_clean: clean_$(dirName) here_obj_clean here_dep_clean

here_dep_clean:
	@echo Removing dependency files $(dirName) ...
	$(echo)rm -f $(depFiles) $(depFilesBak) $(depErrFiles)

here_obj_clean:
	@echo Removing objects for $(dirName) ...
	$(echo)rm -f $(patsubst %, $(OBJDIR)/%, $(allObj))

almost_scratch:
	@echo Removing all files in obj, bin, lib ...
	@rm -f $(OBJDIR)/*
	@rm -fr $(BINDIR)/*
	@rm -f $(LIBDIR)/*

scratch: almost_scratch
	@echo Removing all files ts_dir dep_dir ...
	@rm -f $(tsDir)/*
	@rm -f $(depDir)/*

######################################################################
# 5: documentation and explanations
# AIX This section is provided by IBM.
######################################################################
#
# timestamps:
#
# the directory ts_dir contains timestamps.  why?  i wanted to create
# targets which are not based on actual files, such as the oid_specific
# target which does some special oid stuff.
#
# special variables:
#
# for each executable you may define variables which indicate which
# libraries need to be linked to create your executable.  the variable
# names always begin with the name of the library or executable and
# followed by the modifiers: _objs, _other_libs,  _libs, _usr_libs, _sys_libs.
# these variables are added to the link line in the order listed above.
# e.g.
#
# objects which may need to be force loaded
#
#       spooler_objs := oid_con.o .....
#
# libraries in our $(LIBDIR)
#
#       spooler_libs := oid spl .....
#
# libraries in /usr/lpp/xlC/lib
#
#       spooler_sys_libs :=
#
# libraries in /usr/lib
#
#       spooler_usr_libs := dce
#
# if _other_libs, then you must be explicit
#
#       spooler_other_libs -L/some/other/directory -lhello
#
# you may also have files compiled for a library or executable compiled
# with special modifiers: _incls _defs.  e.g.
#
#       spooler_defs  := -DSPL
#       spooler_incls := -I/some/dir -I/some/other/dir
#
# you may apply special compile flags to individual files.  e.g.
#
#       boid.cpp_defs := -qpriority=-100
#
# you may apply special compile options for files in a library.  e.g.
#
#       oid_opts := xxxxxx
#
# hopefully, using these variables, generic compilation and linking
# rules are sufficiently flexible.
# things we might want to think about:
#
# misc comments
#
# - pdapi has only one file
# - client has only one file
# - showsplr showspvr pb_u pbsuv_u share similar files.  may want to
#   create two new libraries: pdbspl pdbsuv, put psave_u pvore_u
#   pbusel_u pbmemm_u in pdbspl, put pbssuv_u pbrsuv_u in pdbsuv,
#   change the ifdefs in those files and pbhelp_u.h from:
#
#       PDB_SPOOLER    to PDBSPL
#       PDB_SUPERVISOR to PDBSUV
#
#   and use the pdbsuv library in showspvr and pbsuv_u
#       use the pdbspl library in showsplr and pb_u
#
# Note: The NO_STREAM_WRAPPERS is defined and used by the palladium code.
#       This #DEFINE controls whether the thread safe stream/io libraries are
#       to be used.

#
#    Version      Date     Time    Owner   Comment
# ------------- -------- -------- -------- ----------------------------
# V1.2          08/30/94 11:25:29 nrdlan   Update defaults for oid and odbgen
# V1.3          08/31/94 14:21:59 nrdlan   remove reference to pd_dev
# V1.4          09/01/94 09:22:34 nrdlan   Add complete asn1 support
# V1.5          09/01/94 11:50:29 nrdlan   Add -DCLIENT and -DSERV
# V1.6          09/12/94 15:09:14 nrdlan   add copyright to filter of dpa_all
# V1.7          09/15/94 14:38:20 bilan    updated for pdenq
# V1.8          09/21/94 07:37:08 nrjbehrs shared lib changes
# V1.9          09/23/94 16:05:16 nrdlan   Update dpo and misc modifications
# V1.10         09/26/94 17:45:36 nrdlan   Allow shared and non shared libs
# V1.13         09/27/94 19:07:45 nrdlan   Swap c_r and for timezone
#                                          link problem
# V1.14         09/28/94 08:39:49 nrdlan   create all shared libs
# V1.15         09/30/94 11:03:40 nrdlan   Add file compile var, reorg dpo for
#                                          shared, add build, update unit tests
# V1.16         09/30/94 15:10:03 nrdlan   Update to new build procedure
# V1.17         10/01/94 12:59:36 nrdlan   Add resolve_all_s_libs
# V1.18         10/03/94 12:02:51 nrdlan   Single quote WARNING comment
# V1.19         10/03/94 13:01:15 nrdlan   Add odbmain.db target
# V1.20         10/03/94 14:41:03 nrzesch  Fixed oid dependencies
# V1.21         10/03/94 17:40:31 nrdlan   for oidxxdb to ibmxxdb use -d
# V1.22         10/04/94 17:02:45 nrdlan   new oid deps and new compile macro
# V1.23         10/05/94 11:12:40 nrdlan   Fixes related to building from full
#                                          extract
# V1.24         10/05/94 13:22:10 nrjbehrs shared lib oid init problem
# V1.25         10/05/94 16:15:50 nrdlan   remove qtwolink to fix sti problem
#                                          in dsf
# V1.26         10/05/94 20:14:04 bilan    corrected lib list for pdclient
# V1.27         10/06/94 13:22:17 nrdlan   Fix a couple of typos
# V1.28         10/06/94 13:55:09 nrdlan   One more typo
# V1.29         10/07/94 11:02:29 nrdlan   add s system lib to notifv_u
# V1.30         10/07/94 17:16:04 nrjbehrs inlining and oid optimization
# V1.31         10/08/94 10:35:16 nrzesch  New support for pdfilter
# V1.32         10/08/94 14:07:37 nrdlan   Create startspl link for spooler
# V1.33         10/09/94 10:44:28 nrdlan   Add gui rules
# V1.34         10/10/94 09:34:56 nrdlan   Move oid library to beginning of link line for qcompat problem
# V1.35         10/10/94 11:20:36 nrdlan   Fix typo
# V1.36         10/10/94 14:47:25 nrdlan   New _r thread safe stuff
# V1.37         10/11/94 12:23:44 nrjbehrs oid init fix
# V1.38         10/11/94 14:34:50 nrdlan   gui dependency; special compile for pdcommand; new -D dce_pipe
# V1.39         10/12/94 09:31:20 jswalker Remove fpa.cat before write
# V1.40         10/13/94 17:21:58 bilan    pdenq updates -- dpo updates
# V1.41         10/13/94 17:31:54 nrdlan   Minor modification to dpo
# V1.42         10/14/94 17:13:19 nrdlan   Unit test modifications just to get things to compile
# V1.43         10/15/94 13:04:39 nrdlan   Add pthreads and c_r to pdLibs
# V1.43         10/15/94 13:04:57 nrdlan   Add pthreads and c_r to pdLibs
# V1.44         10/17/94 14:21:40 nrzesch  Removed BSD library from product
# V1.46         10/24/94 15:16:20 nrdlan   remove full path from pdcommands
# V1.47         10/26/94 10:53:50 nrjbehrs perf improvement/shrd lib fixes
# V1.48         10/28/94 17:01:39 nrjbehrs build/perf fixes
# V1.49         10/31/94 09:19:52 nrjbehrs build/perf fixes
# V1.50         10/31/94 13:17:09 nrjbehrs build/perf fixes
# V1.51         11/01/94 16:43:26 nrjbehrs build/perf fixes
# V1.52         11/01/94 17:32:30 nrdlan   fix to ibm.db rule
# V1.53         11/14/94 14:26:23 nrjbehrs remove as_utils/iv-doc/job from suv
# V1.54         11/15/94 17:14:13 nrzesch  Removed the hard-coded path for startspl
# V1.55         11/17/94 16:28:08 dennison Split Binding into ClientBinding and ServerBinding
# V1.57         12/22/94 16:24:47 nrdlan   Second pass after code review
# V1.58         12/29/94 16:57:39 nrjbehrs fix memory leaks
# V1.59         12/30/94 13:04:49 nrjbehrs create server shared lib
# V1.60         12/30/94 14:31:04 nrjbehrs compile with libCns
# V1.62         01/05/95 15:58:00 nrjbehrs fix shLibs
# V1.63         01/06/95 08:18:25 nrjbehrs fix shared lib error logging
# V1.64         01/06/95 16:04:36 nrzesch  Removed startspl link in favor of startup script
# V1.65         01/11/95 06:10:09 hlava    Added in-memory debug log
# V1.66         01/11/95 16:04:32 nrjbehrs add DEBUG debug
# V1.67         01/14/95 16:17:37 nrzesch  Moved oid databases to PDBASE/oids directory
# V1.68         01/17/95 09:59:10 nrjbehrs update makefile for utilities
# V1.69         01/18/95 11:13:42 nrzesch  Fixed dpa_all.o to rm the object file before compile
# V1.70         01/24/95 06:20:21 bilan    added the createion of oid_def.h
# V1.71         01/26/95 05:00:41 bilan    changed link for pdenq and pdcommand
# V1.74         01/28/95 16:39:56 longstaf Modified CLI interface to use library classes; mods to library classes
# V1.75         01/30/95 12:18:28 longstaf Modified pdcommand link to link object files instead of libpdobj.$(LIB)
# V1.76         01/31/95 16:48:50 nrjbehrs debug fixes
# V1.77         01/31/95 18:43:16 longstaf Added pdstopd
# V1.78         02/09/95 08:29:50 nrdlan   First pass of os2 changes
# V1.79         02/10/95 15:13:06 hlava    Misc UT fixes
# V1.80         02/13/95 08:34:26 hlava    Added pdmsghlp
# V1.81         02/15/95 15:42:40 nrjbehrs eliminate inlining
# V1.82         02/16/95 12:06:12 nrzesch  Added -DDG_NO_TRACE option for odbgen
# V1.83         02/20/95 06:50:53 hlava    Change pddmsg and pdmsghlp to use catmsg.h functions
# V1.84         02/24/95 11:31:00 nrdlan   Add fpahelp.cat rule
# V1.85         02/27/95 06:39:12 hlava    Fix pddmsg and pdmsghlp dependencies
# V1.86         02/28/95 17:35:48 nrjbehrs AIX message catalogs
# V1.87         02/28/95 17:40:31 nrjbehrs AIX message catalogs
# V1.88         03/01/95 09:47:18 nrjbehrs msg inc files
# V1.89         03/01/95 14:48:03 nrdlan   dpo special defines for os2
# V1.90         03/01/95 17:36:23 nrjbehrs create common libpd shared lib
# V1.91         03/02/95 11:17:00 nrjbehrs fix dpo and oid rules
# V1.92         03/03/95 10:14:28 nrjbehrs fix non-shared pdclientd build
# V1.93         03/08/95 16:41:59 nrdlan   Remove dependency generation for os2
# V1.94         03/08/95 18:18:30 gnelson  Eliminate extra fpa header files
# V1.95         03/09/95 11:52:38 nrjbehrs fix str_u
# V1.96         03/15/95 15:43:19 longstaf Modified pdobj_u options
# V1.97         03/21/95 10:31:13 nrzesch  OS/2 port. Removed passed priority options and inserted pragmas in source.
# V1.98         03/22/95 15:09:08 nrzesch  Changed directories for OS/2
# V1.100        03/24/95 16:25:12 nrdlan   added static link for os2
# V1.100        03/24/95 16:25:56 nrdlan   added static link for os2
# V1.101        03/27/95 15:32:55 hlava    Added pdgenatt
# V1.102        03/28/95 08:55:37 nrjbehrs fix odbgen build
# V1.103        03/29/95 14:17:32 nrdlan   os2 modifications
# V1.104        03/30/95 09:07:08 nrdlan   Accidentally removed fpa case from aix
# V1.105        03/30/95 17:14:29 nrzesch  Added copyright information to generated OS/2 cmd files
# V1.106        03/31/95 15:48:32 nrjbehrs fix memory leaks
# V1.107        04/03/95 13:07:54 nrjbehrs SENTINEL defs
# V1.108        04/03/95 15:57:01 nrdlan   os2 mods; pddmsg dependencies
# V1.109        04/04/95 17:20:54 nrjbehrs fix pddmsg build
# V1.110        04/05/95 12:47:27 hlava    Added smit to build
# V1.111        04/12/95 05:54:41 hlava    Added pduxblk exit pgms to build
#
# V1.112        04/14/95 04:49:02 dennison d4459 eliminate dpo status codes and fix dpomsg mem leaks
# V1.113        04/17/95 17:28:09 nrzesch  CLIENT definitions in makefile
# V1.114        04/19/95 08:50:54 nrdlan   remove pdinterrupt; clean up pdCommands for os2
# ------------- -------- -------- -------- ----------------------------
# V1.115        04/19/95 16:35:46 dennison create self-contained dpo unit test case
# V1.2          05/01/95 16:22:33 nrzesch  Added libs to msg_u for proper linkage
# V1.3          05/04/95 14:12:55 nrdlan   Remove extra tabs inserted by ve editor
# V1.4          05/05/95 16:55:35 longstaf Changed all references of pdclientd to psmd
# V1.5          05/12/95 15:44:39 dennison disable disallowed os2 commands like pddelete etc
