#######################################################################
#
#                     MOSIS distribution Version 8.2
#
#######################################################################

CADDIR = this_is_set_by_the_parent_Makefile_and_the_findcad_script
CAD     = ${CADDIR}
SYSLIB  = $(CAD)/lib/magic/sys


SC_CPP		= `cat ./:cpp` -I./extract_template

SRC     = README COPYRIGHT Makefile scmos.tech scmos.tech26 \
	mos.7bit.dstyle5 mos.7bit.std.cmap1 scmos-tm.tech26 scmos-sub.tech26 \
	scmos.tech27 scmos-tm.tech27 scmos-sub.tech27 scmosWR.tech26 \
	scmosWR.tech27  mos.24bit.dstyle5

CIFin   = cif_template/objs/CIFin
CIFout  = cif_template/objs/CIFout
ICIFin  = cif_template/objs/IBMCIFin
ICIFout = cif_template/objs/IBMCIFout
HCIFin  = cif_template/objs/TMCIFin
HCIFout = cif_template/objs/TMCIFout
SCIFin  = cif_template/objs/SUBCIFin
SCIFout = cif_template/objs/SUBCIFout
INSTALL = cp 

DEPEND = scmos.tech $(CIFin) $(CIFout) $(HCIFin) $(HCIFout) $(SCIFin) \
		$(SCIFout) extract_template/scmosExt.tech \
		extract_template/scmosExt26b-sub.tech \
		extract_template/scmosExt060_orb.tech \
		extract_template/scmosExt080.tech   \
		extract_template/scmosExt100.tech   \
		extract_template/scmosExt34.tech    \
		extract_template/scmosExt14b-sub.tech  \
		extract_template/scmosExtDiag.tech \
		extract_template/scmosExt14b-tm.tech 

all: version5 version4

version4: $(DEPEND)
	$(SC_CPP) -DV4 -DSTANDARD scmos.tech > scmos.tech26
	$(SC_CPP) -DV4 -DHPTECH -DTIGHTMETAL scmos.tech > scmos-tm.tech26
	$(SC_CPP) -DV4 -DSUBMICRON scmos.tech > scmos-sub.tech26
	$(SC_CPP) -DV4 -DSTANDARD -DWELL_ROUTE_CHECK scmos.tech > scmosWR.tech26

version5: $(DEPEND)
	$(SC_CPP) -DV5 -DSTANDARD scmos.tech > scmos.tech27
	$(SC_CPP) -DV5 -DHPTECH -DTIGHTMETAL scmos.tech > scmos-tm.tech27
	$(SC_CPP) -DV5 -DSUBMICRON scmos.tech > scmos-sub.tech27
	$(SC_CPP) -DV5 -DSTANDARD -DWELL_ROUTE_CHECK scmos.tech > scmosWR.tech27
	$(SC_CPP) -DV5 -DSTANDARD peregrine.tech > peregrine.tech27



$(CIFin):
$(CIFout):
$(ICIFin):
$(ICIFout):
$(HCIFin):
$(HCIFout):
$(SCIFin):
$(SCIFout):
	cd cif_template; make clean; make all

install: version4 version5
	$(INSTALL) scmos.tech26 $(SYSLIB)
	$(INSTALL) scmos-sub.tech26 $(SYSLIB)
	$(INSTALL) scmos-tm.tech26 $(SYSLIB)	
	$(INSTALL) scmos.tech27 $(SYSLIB)
	$(INSTALL) scmos-sub.tech27 $(SYSLIB)
	$(INSTALL) scmos-tm.tech27 $(SYSLIB)
	$(INSTALL) scmosWR.tech27 $(SYSLIB)
	$(INSTALL) scmosWR.tech26 $(SYSLIB)
	$(INSTALL) peregrine.tech27 $(SYSLIB)
	$(INSTALL) mos.7bit.dstyle5 $(SYSLIB)
	$(INSTALL) mos.24bit.dstyle5 $(SYSLIB)
	$(INSTALL) mos.7bit.std.cmap1 $(SYSLIB)

tarfile: $(SRC)
	rm -f scmos-tech.tar.Z
	tar -cvf scmos-tech.tar $(SRC) examples cif_template rules doc\
		 irsim-parameters
	compress scmos-tech.tar

uufile: $(SRC)
	uuencode scmos-tech.tar.Z scmos-tech.tar.Z > scmos-tech.uu

clean:;
	-rm -f *.tech27 *.tech26
	cd cif_template; make clean;
