#
# this is a GNUmakefile.  It must be processed with GNU make.
#

TARGET_ARCH=
TOP=../..

# you should define the make variables LOBJS and HEADERS before the
# include directive.  LOBJS is a list of Library OBJects that belong
# in libiac++.a.  HEADERS is a list of public header files that belong
# in iac++/include.

OPSRCS=$(foreach T,bit uc int flt cpl rgb,$(foreach OP,ad or er mn,${T}Set${OP}.c))
OPOBJS=${patsubst %.c,%.o,${OPSRCS}}

LOBJS= VS_Specials.o ${OPOBJS}
HEADERS= Set.h BaseSet.h SetIter.h BSetIter.h ClosureSet.h
DISTFILES= GNUmakefile \
	Set.c Set.h VS_Specials.c OpTable.h OpTable.c \
	BaseSet.h BaseSet.c ValueSet.c ValueSet.h LazySet.c LazySet.h \
		ClosureSet.h \
	set_errors.h \
	closure.c \
	SetIter.h SetIter.c \
	BSetIter.h BSetIter.c VSIter.h VSIter.c \
	metacode
#REGTESTS= ${basename ${wildcard test2??.C}}
CLOSUREOBJS=closure.o
BLASTABLE_PTFILES = spam*

include ${TOP}/src/gnumake.templ

closure: Set.c LazySet.h LazySet.c OpTable.c \
	SetIter.c BSetIter.c VSIter.c \
	${INCDIR}/IntPS.h ${INCDIR}/DblPS.h

${LOBJS} closure :${INCDIR}/IntPS.h ${INCDIR}/DblPS.h

${INCDIR}/IntPS.h ${INCDIR}/DblPS.h: ../pointset/IntPS.h ../pointset/DblPS.h
	cd ../pointset; ${MAKE} headers

lib: closure

#
#
#

${OPOBJS}:${OPSRCS}

${OPSRCS}: metacode
	rm -f ${OPSRCS}
	for spam in "IA_Bit bit" "u_char uc" "int int" "float flt" "complex cpl" "IA_RGB rgb"; do \
		set $$spam; \
		perl -pe " s/TYPENAME/$$1/g; \
		   s/TYPE/$$1/g; \
		   s/OPNAME/intersect/g; \
		   s/OPERATOR/operator&/g; \
		   s/OPNUM/1/g;" < metacode >  $${2}Setad.c; \
		perl -pe " s/TYPENAME/$$1/g; \
		   s/TYPE/$$1/g; \
		   s/OPNAME/union/g; \
		   s/OPERATOR/operator|/g;" < metacode > $${2}Setor.c; \
		perl -pe " s/TYPENAME/$$1/g; \
		   s/TYPE/$$1/g; \
		   s/OPNAME/XOR/g; \
		   s/OPERATOR/operator^/g;" < metacode > $${2}Seter.c; \
		perl -pe " s/TYPENAME/$$1/g; \
		   s/TYPE/$$1/g; \
		   s/OPNAME/minus/g; \
		   s-OPERATOR-operator/-g; \
		   s/OPNUM/2/g;" < metacode > $${2}Setmn.c; \
	done
	chmod a-w ${OPSRCS}

#
#
#

fullsrc: ${OPSRCS}

# sample program target:
# test1 only needs test1.o and the library.  The defaults will
# build this without a rule
#
#all: test1 test2
#
#T2OBJS= test2.o frob.o
#test2: ${T2OBJS}
#	${CCC} -o $@ ${CCFLAGS} ${CPPFLAGS} ${LDFLAGS} ${T2OBJS} ${LDLIBS}

# the gnumake.templ has a few targets that everyone will use
#
# all: install the header files, build the LOBJS and add them
# to the library
#
# headers-force: force the header files to be copied into include
#
# headers: used by all to install the header files when changed
#
# lib: used by all to add LOBJS to the libwork.a.  libwork.a is
# your own personal copy of the libiac++.a that only contains the
# parts you are working on.
#
# reallib: this puts your LOBJS into the real libiac++ so that
# everyone else can use them.  Make sure they work first.
#
# clean:: removes all .o and ~ files.  You may define additional
# clean targets to remove other files that you may have generated.
#
# spotless:: the same as clean, but more so.  It should remove
# binaries.  You should define additional spotless targets that
# remove your test binaries and other files that aren't deleted
# by clean.



# dependencies
VS_Specials.o : VS_Specials.c ${INCDIR}/compat.h ${INCDIR}/Bit.h ${INCDIR}/RGB.h \
  ${INCDIR}/DblPoint.h ${INCDIR}/ia.h ${INCDIR}/Point.h ${INCDIR}/IntPoint.h \
  Set.h BaseSet.h ValueSet.h LazySet.h 
bitSetad.o : bitSetad.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
bitSetor.o : bitSetor.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
bitSeter.o : bitSeter.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
bitSetmn.o : bitSetmn.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
ucSetad.o : ucSetad.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h ${INCDIR}/Array.h \
  Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h ${INCDIR}/Bit.h 
ucSetor.o : ucSetor.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h ${INCDIR}/Array.h \
  Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h ${INCDIR}/Bit.h 
ucSeter.o : ucSeter.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h ${INCDIR}/Array.h \
  Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h ${INCDIR}/Bit.h 
ucSetmn.o : ucSetmn.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h ${INCDIR}/Array.h \
  Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h ${INCDIR}/Bit.h 
intSetad.o : intSetad.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
intSetor.o : intSetor.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
intSeter.o : intSeter.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
intSetmn.o : intSetmn.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
fltSetad.o : fltSetad.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
fltSetor.o : fltSetor.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
fltSeter.o : fltSeter.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
fltSetmn.o : fltSetmn.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
cplSetad.o : cplSetad.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
cplSetor.o : cplSetor.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
cplSeter.o : cplSeter.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
cplSetmn.o : cplSetmn.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
rgbSetad.o : rgbSetad.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
rgbSetor.o : rgbSetor.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
rgbSeter.o : rgbSeter.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
rgbSetmn.o : rgbSetmn.c OpTable.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Array.h Set.h BaseSet.h LazySet.h ValueSet.h BSetIter.h ${INCDIR}/RGB.h \
  ${INCDIR}/Bit.h 
closure.o : closure.c ${INCDIR}/DblPoint.h ${INCDIR}/ia.h ${INCDIR}/compat.h \
  ${INCDIR}/Point.h ${INCDIR}/IntPoint.h ${INCDIR}/Bit.h ${INCDIR}/RGB.h \
  Set.h BaseSet.h SetIter.h BSetIter.h ValueSet.h ClosureSet.h 
