#             sipp 2.0 - a 3-d rendering library
#
# Copyright 1990 Inge Wallin, Jonas Yngvesson
#
# This is the main Makefile for sipp version 2.0. This directory
# contains three subdirectories:
# libsipp: source code for the library itself.
# demo:    source code for demonstrations and tests
# doc:     standard manual pages for the library.
#
# You can either make the library and the tests/demos separately or 
# you can make them all in one make session. 
#
# To create the library, just type 'make library'.
# To make the demo programs, type 'make demos', but if you haven't 
# made the library first, this will be made automatically for you by
# the makefile in the demos directory.
#
# Before you can make anything, though, you may have to edit the 
# following definitions:


# If your C compiler doesn't grok the void type, uncomment the 
# following line:
#NOVOID = -Dvoid=int

# If you don't have memcpy() and friends in your C library, or 
# if you don't have memory.h in /usr/include, uncomment the
# following line:
#NOMEMCPY = -DNOMEMCPY

# If you don't have alloca(), uncomment the following line:
#ALLOCA = -DHAVE_NO_ALLOCA

# Choose a suitable C compiler and appropriate flags:
CC = cc
CFLAGS = -O4 -pipe

# Choose a lexical analyzer generator:
LEX = lex


# LIBDIR is where libsipp.a will be placed when you make install.
# INCLUDEDIR is where the include files will be placed when you make install.
# MANDIR is where the manuals will be placed when you make install.
# MANEXT is the extension the manuals will receive in MANDIR

LIBDIR = /usr/local/lib
INCLUDEDIR = /usr/local/include
MANDIR = /usr/local/man/man3
MANEXT = 3


# ================================================================
#           Don't change anything below this line.
# ================================================================

DOCFILES = primitives.man shaders.man sipp.man
HEADERS =  sipp.h shaders.h primitives.h


MAKEOPTS = CC=$(CC) LEX=$(LEX) \
	CFLAGS="$(NOVOID) $(NOMEMCPY) $(ALLOCA) $(CFLAGS) -I../libsipp"
        

all: library demos

library:
	cd libsipp; $(MAKE) $(MAKEOPTS) libsipp.a

demos:
	cd demo; $(MAKE) $(MAKEOPTS) programs


install: library
	cd libsipp; $(MAKE) LIBDIR=$(LIBDIR) INCLUDEDIR=$(INCLUDEDIR) install
	for i in $(DOCFILES) ; do \
	    cp doc/$$i $(MANDIR)/`basename $$i .man`.$(MANEXT); \
	done


clean:
	$(RM) *~ *shar*
	cd libsipp; $(MAKE) clean;
	cd demo; $(MAKE) clean;
	cd doc;   ls -1 | egrep -v \.man$$ | xargs rm -f

shar: clean
	shar -a -n sipp-2.0 -l 50 -o sipp-2.0.shar Makefile README \
	libsipp/* doc/* demo/*
