# Makefile for SCIX. Johan Ihren.

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

VERSION = 0.97

# Note that there are two different targets that both produce a scix: "scix"
# and "rawscix". "scix" includes all demos and such stuff, "rawscix" only
# the core SCIX features into the executable "scix". To make scix with demos
# and things, just type "make". To install, edit BINDIR and LIBDIR below and
# type "make install". It should be noted, however, that of the two libraries
# libscix.a is fairly stable, but libscixt.a is still only the barest beginning
# of a toolkit.

# These are only used if you want to install scix.
BINDIR = /usr/local/bin
LIBDIR = /usr/local/lib

.SUFFIXES:

.SUFFIXES:	.sc .o

MAKE	  = make

SCC	  = 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. But then the pmax port of gcc is quite new...
# SCCFLAGS  = -cc gcc -fcombine-regs -finline-functions -fstrength-reduce \
#	      $(SCCFLAGS)

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

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

scix:		src demo libscixt.a 
		cd demo ; $(MAKE) "SCCFLAGS = -O -Ob -Og -Ot"
		cd toolkit ; $(MAKE) "SCCFLAGS = $(SCCFLAGS)"
		cd src ; $(MAKE) "SCCFLAGS = $(SCCFLAGS)" \
			      "VERSION = $(VERSION)" ../scix

all:		libscix.a libscixt.a scix

libscix.a:	src
		cd src ; $(MAKE) "SCCFLAGS = $(SCCFLAGS)" \
			      "VERSION = $(VERSION)" ../libscix.a

libscixt.a:	toolkit
		cd toolkit ; $(MAKE) "SCCFLAGS = $(SCCFLAGS)" \
				  "VERSION = $(VERSION)" ../libscixt.a

rawscix: ;	cd src ; $(MAKE) "SCCFLAGS = $(SCCFLAGS)" \
			      "VERSION = $(VERSION)" ../rawscix

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

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

DISTFILES =	scix-$(VERSION)/MANIFEST scix-$(VERSION)/Makefile \
		scix-$(VERSION)/README scix-$(VERSION)/Copyright \
		scix-$(VERSION)/Release-notes scix-$(VERSION)/ChangeLog \
		scix-$(VERSION)/demo/README scix-$(VERSION)/demo/Makefile \
		scix-$(VERSION)/demo/[a-z]*.sc \
		scix-$(VERSION)/doc/scix.doc \
		scix-$(VERSION)/doc/request-map \
		scix-$(VERSION)/include/[a-z]*.sch \
		scix-$(VERSION)/macros/[a-z]*.sc \
		scix-$(VERSION)/src/README scix-$(VERSION)/src/Makefile \
		scix-$(VERSION)/src/[a-z]*.awk scix-$(VERSION)/src/[a-z]*.sc \
		scix-$(VERSION)/src/ftypes.c scix-$(VERSION)/src/rwsock.c \
		scix-$(VERSION)/src/[a-z]*.tmpl \
		scix-$(VERSION)/src/Xlibsock.c \
		scix-$(VERSION)/toolkit/README \
		scix-$(VERSION)/toolkit/Makefile \
		scix-$(VERSION)/toolkit/buttons.sc \
		scix-$(VERSION)/toolkit/dfsm.sc \
		scix-$(VERSION)/extensions/shape.sc \
		scix-$(VERSION)/extensions/shapetest.sc \
		scix-$(VERSION)/extensions/README \
		scix-$(VERSION)/[A-Z]*.patch

dist: ;		-@if [ -d ../scix-$(VERSION) ]; then \
		  echo "SCIX source-tree already in ../scix-$(VERSION)" ; \
		else \
		  echo "Moving SCIX source-tree to ../scix-$(VERSION)" ; \
		  blorpmagorsk=`pwd` ; \
		  cd .. ; mv $$blorpmagorsk scix-$(VERSION) ; \
		fi
		@(cd .. ; \
		echo "tar cf scix-$(VERSION).tar *lots-of-files*" ; \
		tar cf scix-$(VERSION)/scix-$(VERSION).tar $(DISTFILES) )
		compress scix-$(VERSION).tar



