# Makefile for SCIX. Johan Ihren.

# $Id: Makefile,v 1.8 90/06/26 10:17:14 johani Exp $

VERSION = 1.00

#
# Please replace the definition of SCIXLOADPATH with something appropriate.
# For all demonstration applications to work one directory in the path must
# be the directory in which SCIX was built (i.e. "this directory" probably).
# Note the rather aggressive quoting. It is not optional.
#
SCIXLOADPATH = (\\\".\\\" \\\"/misc/projects/johani/scix-1.00\\\")

.SUFFIXES:

.SUFFIXES:	.sc .o

MAKE	  = make
# For those with GNU Make and lots of memory:
# MAKE	  = gmake -j4

SCC	  = scc
#SCC	  = /usr/local/bin/scc

# SCCFLAGS  = -O -Ob -Og -On -Ot
SCCFLAGS  = -O -On -Ob

# A variant of SCCFLAGS that uses gcc. We haven't noticed any improvements
# with gcc on the pmax, though.
# SCCFLAGS  = -cc gcc -fcombine-regs -finline-functions -fstrength-reduce \
#	      $(SCCFLAGS)

.sc.o: ;	$(SCC) $(SCCFLAGS) $*.sc

.c.o: ;		$(SCC) $(SCCFLAGS) $*.c

all:
	cd include ; $(MAKE)
	cd demo    ; $(MAKE) ../libdemo.a
	cd stox    ; $(MAKE) "SLP=$(SCIXLOADPATH)" ../libstox.a
	cd src     ; $(MAKE) "VERSION=$(VERSION)" ../libscix.a
	$(MAKE)      scix-$(VERSION)
.PHONY:	new

# Note that we only need to explicitly demand initialization of the demo
# module, as that module forces initialization of both scix and stox modules.
scix-$(VERSION):	libscix.a libstox.a libdemo.a
		$(SCC) -i -o Xscix -m scixdemo libdemo.a libstox.a libscix.a
		mv Xscix scix-$(VERSION)
.PHONY:	scix

libdemo.a:
		cd demo    ; $(MAKE) ../libdemo.a
libstox.a:	
		cd stox    ; $(MAKE) "SLP=$(SCIXLOADPATH)" ../libstox.a
libscix.a:	
		cd src     ; $(MAKE) "VERSION=$(VERSION)" ../libscix.a

clean: ;	rm -f *~ *.o core #*
		rm -f doc/*~ doc/#*
		rm -f include/*~ include/#*
		rm -f macros/*~ maccros/#*
		cd csrc ; $(MAKE) clean
		cd src ; $(MAKE) clean
		cd demo ; $(MAKE) clean
		cd stox ; $(MAKE) clean

install:	scix-$(VERSION) libscix.a libstox.a
		install -c -s scix-$(VERSION) $(BINDIR)
		install -c libscix.a $(LIBDIR)
		ranlib $(LIBDIR)/libscix.a
		install -c libstox.a $(LIBDIR)
		ranlib $(LIBDIR)/libstox.a

DISTFILES =	scix-$(VERSION)/MANIFEST scix-$(VERSION)/Makefile \
		scix-$(VERSION)/README scix-$(VERSION)/Copyright \
		scix-$(VERSION)/Release-Notes scix-$(VERSION)/Changes \
		scix-$(VERSION)/demo/README scix-$(VERSION)/demo/Makefile \
		scix-$(VERSION)/demo/[a-z]*.sc scix-$(VERSION)/demo/About \
		scix-$(VERSION)/demo/ship.rules \
		scix-$(VERSION)/doc/*.doc scix-$(VERSION)/doc/request-map \
		scix-$(VERSION)/include/[a-z]*.sch scix-$(VERSION)/include/M* \
		scix-$(VERSION)/macros/oos.sc \
		scix-$(VERSION)/macros/mask-obj.sc \
		scix-$(VERSION)/macros/extsyntax.sc \
		scix-$(VERSION)/csrc/*.c scix-$(VERSION)/csrc/Makefile \
		scix-$(VERSION)/src/README scix-$(VERSION)/src/Makefile \
		scix-$(VERSION)/src/[a-z]*.awk scix-$(VERSION)/src/[a-z]*.sc \
		scix-$(VERSION)/src/[a-z]*.tmpl scix-$(VERSION)/src/indian.c \
		scix-$(VERSION)/src/mkendian.sh \
		scix-$(VERSION)/stox/README scix-$(VERSION)/stox/Makefile \
		scix-$(VERSION)/stox/[a-z]*.sc \
		scix-$(VERSION)/extensions/shape.sc \
		scix-$(VERSION)/extensions/shapetest.sc \
		scix-$(VERSION)/extensions/README

dist: ;		-@if [ ! -d ../scix-$(VERSION) ]; then \
		  echo "Moving SCIX source-tree to ../scix-$(VERSION)" ; \
		  blorpmagorsk=`pwd` ; \
		  cd .. ; mv $$blorpmagorsk scix-$(VERSION) ; \
		fi
		-@if [ -f scix-$(VERSION).tar.Z ]; then \
		  mv scix-$(VERSION).tar.Z scix-$(VERSION).old.tar.Z ; \
		fi
		@(cd .. ; \
		echo "tar cf scix-$(VERSION).tar ..." ; \
		tar cf scix-$(VERSION)/scix-$(VERSION).tar $(DISTFILES) )
		compress scix-$(VERSION).tar
		@uuencode scix-$(VERSION).tar.Z scix-$(VERSION).tar.Z \
			> scix-$(VERSION).tar.Z.uu
