/*
** Special makefile for common!adf!admin
** Copy everything to the deliverables area, and compile the C code.
**
** History: 
**
**	??-aug-1990 (jonb)
**		Created.
**	12-sep-1990 (jonb)
**		Guarantee that iiadd.h.hold will be renamed even if
**		a previous ming bailed out.
**	18-dec-1990 (bonobo)
**		Altered to function properly in the dbmspe environment.
**	19-aug-1991 (gillnh2o)
**		Adding files integrated by Lan: build.sh, common.c, cpx.c
**		cpx.qry, udt.h, zchar.c zchar.qry.
**	29-aug-1991 (jonb)
**		Cleanup of integration of new datatypes cpx and zchar.
**	9-sep-1991 (jonb)
**		It seems the compiler on VAX/Ultrix doesn't like a -o
**		flag with a filename with a .o extension.  Weird, but
**		this means we have to generate the .o files locally and
**		explicitly move them into the demo directory.
**	28-dec-1992 (dianeh)
**		Modified to use dependency-checking instead of just re-doing
**		everything every time; deleted udttest from the files target
**		(it's an executable, not a file).
**	23-feb-1992 (dianeh)
**		Brought in changes from 6.4: change dest for iiadd.h;
**		also, move files list to top; add udt.h to files list;
**		organize files targets; deleted pointer to current
**		directory (ADMINSRC); use automatic variables in
**		target command-blocks; add -I$(INGFILES) so .c's
**		can find <iiadd.h>; use .FILE rule for files.
**      14-May-1993 (fred)
**              Moved udt.h work around so it gets moved before
**              anything else is compiled.  Keeps compilers happy...
**  	    	Also added $(OPTIM) to flags used, since it was not
**              being used at all, making things harder to debug.
**      12-aug-1993 (stevet)
**              Added PNUM files: numeric.c, iicvpk.c, iimhpk.c, numeric.doc
**              pnum_test.qry and pnum_test.log.
**	25-aug-1993 (dianeh)
**		Removed ii{cv,mh}pk.c from files list -- not delivered; added
**		Makefile (from 6.4).
**	26-aug-1993 (dianeh)
**		iipk.h isn't a preprocess file, it's just a file (got fooled
**		by the #ifdef ris_us5 in it); added an echo for the Makefile.
**	28-oct-93 (vijay)
**		Integrate changes from 63p. Create .o's using the makefile,
**		since that is how the users will be doing it.
**	06-dec-93 (vijay)
**		Clean up so that ming will not try to recreate the objects
**		at every invocation even if target is newer than depends.
**	15-mar-94 (vijay)
**		Add chmod.
**	27-Feb-96 (smiba01)
**		Changed ming rule for source code from .FILE to .DEMO to
**		strip out engineering history comments (starting with ##)
**		from demo udt files.  These source files are shipped to the
**		customer.
**	07-Jan-1998 (shero03)
**	    Added BYTE_SWAP to iiadd.h
**	03-Jun-1998 (hanch04)
**	    Corrected BYTE_SWAP and BYTE_ALIGN for iiadd.h
**	10-Jun-1998 (hanch04)
**	    Need to do two greps for iiadd.h
**      28-jun-1999 (hanch04)
**          Changed doc to txt.
**	20-feb-2001 (gupsh01)
**	    Added nvarchar.
**	02-mar-2001 (gupsh01)
**	    Fixed the nvarchar.c .DEMO entry.
**	04-Apr-2002 (somsa01)
**	    To prevent clashes with possible 64-bit binaries, tack on
**	    "32" to the object names.
**      12-Jul-2002 (hanch04)
**          remove "32" from object names, 64-bit objects will be in the
**          lp64 dir.
*/

files : \
	$(INGFILES)/iiadd.h \
	$(UDTDEMO)/Makefile \
	$(UDTDEMO)/iipk.h \
	$(UDTDEMO)/udt.h \
	$(UDTDEMO)/common.c \
	$(UDTDEMO)/common.o \
	$(UDTDEMO)/cpx.c \
	$(UDTDEMO)/cpx.o \
	$(UDTDEMO)/cpx.log \
	$(UDTDEMO)/cpx.qry \
	$(UDTDEMO)/intlist.c \
	$(UDTDEMO)/intlist.o \
	$(UDTDEMO)/intlist.log \
	$(UDTDEMO)/intlist.qry \
	$(UDTDEMO)/op.c \
	$(UDTDEMO)/op.o \
	$(UDTDEMO)/op_load.log \
	$(UDTDEMO)/op_load.qry \
	$(UDTDEMO)/op_test.log \
	$(UDTDEMO)/op_test.qry \
	$(UDTDEMO)/zchar.c \
	$(UDTDEMO)/zchar.o \
	$(UDTDEMO)/zchar.log \
	$(UDTDEMO)/zchar.qry \
	$(UDTDEMO)/numeric.c \
	$(UDTDEMO)/numeric.o \
	$(UDTDEMO)/iicvpk.o \
	$(UDTDEMO)/iimhpk.o \
	$(UDTDEMO)/numeric.txt \
	$(UDTDEMO)/pnum_test.qry \
	$(UDTDEMO)/pnum_test.log \
	$(UDTDEMO)/nvarchar.c \
	$(UDTDEMO)/nvarchar.o \
	$(UDTDEMO)/nvarchar.log \
	$(UDTDEMO)/nvarchar.qry \
	Makefile

.UDTDEMOOBJ : .USE Makefile
	@-
	make $(<:BS=.o)
	echo cp $(<:BS=.o) $(<)
	cp $(<:BS=.o) $(<)
	$(CHMOD) $(FILEMODE) $(<)

$(INGFILES)/iiadd.h : iiadd.h
	@-
	echo cp $(>) $(<)
	grep BYTE_ALIGN $(HDR3)/bzarch.h | \
	$(SED) 's/BYTE_ALIGN/ALIGNMENT_REQUIRED/' | \
	cat $(>) - > $(<)
	grep BYTE_SWAP $(HDR3)/bzarch.h | \
	cat - >> $(<)
	$(CHMOD) $(FILEMODE) $(<)

$(UDTDEMO)/Makefile : Makefile .FILE

Makefile : Makefile.ccpp
	@-
	echo "Building $(<) ..."
	ccpp $(>) > $(<)
	$(CHMOD) $(FILEMODE) $(<)

$(UDTDEMO)/iipk.h : iipk.h .DEMO

$(UDTDEMO)/common.c : common.c .DEMO

$(UDTDEMO)/common.o : common.c .UDTDEMOOBJ

$(UDTDEMO)/cpx.c : cpx.c .DEMO

$(UDTDEMO)/cpx.o : cpx.c  .UDTDEMOOBJ

$(UDTDEMO)/cpx.log : cpx.log .FILE
$(UDTDEMO)/cpx.qry : cpx.qry .FILE
$(UDTDEMO)/intlist.c : intlist.c .DEMO
$(UDTDEMO)/intlist.log : intlist.log .FILE
$(UDTDEMO)/intlist.qry : intlist.qry .FILE

$(UDTDEMO)/intlist.o : intlist.c  .UDTDEMOOBJ

$(UDTDEMO)/op.c : op.c .DEMO

$(UDTDEMO)/op.o : op.c  .UDTDEMOOBJ

$(UDTDEMO)/op_load.log : op_load.log .FILE
$(UDTDEMO)/op_load.qry : op_load.qry .FILE
$(UDTDEMO)/op_test.log : op_test.log .FILE
$(UDTDEMO)/op_test.qry : op_test.qry .FILE

$(UDTDEMO)/udt.h: udt.h .DEMO

$(UDTDEMO)/depend.h: depend.h .DEMO

$(UDTDEMO)/zchar.c : zchar.c .DEMO
$(UDTDEMO)/zchar.log : zchar.log .FILE
$(UDTDEMO)/zchar.qry : zchar.qry .FILE

$(UDTDEMO)/zchar.o : zchar.c  .UDTDEMOOBJ

$(UDTDEMO)/pnum_test.qry : pnum_test.qry .FILE
$(UDTDEMO)/pnum_test.log : pnum_test.log .FILE
$(UDTDEMO)/numeric.txt   : numeric.txt   .FILE
$(UDTDEMO)/numeric.c     : numeric.c     .DEMO

$(UDTDEMO)/numeric.o : numeric.c  .UDTDEMOOBJ

$(UDTDEMO)/nvarchar.c : nvarchar.c .DEMO
$(UDTDEMO)/nvarchar.log : nvarchar.log .FILE
$(UDTDEMO)/nvarchar.qry : nvarchar.qry .FILE

$(UDTDEMO)/nvarchar.o : nvarchar.c .UDTDEMOOBJ

$(UDTDEMO)/iicvpk.o : iicvpk.c  .UDTDEMOOBJ

$(UDTDEMO)/iimhpk.o : iimhpk.c .UDTDEMOOBJ

$(UDTDEMO)/udttest :: udttest.sh .SHELL
