# $Id: Makefile,v 3.5 1998/07/26 17:52:48 brianp Exp $

# Mesa 3-D graphics library
# Version:  3.0
# Copyright (C) 1995-1998  Brian Paul
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


# Makefile for core library


# $Log: Makefile,v $
# Revision 3.5  1998/07/26 17:52:48  brianp
# added rule for ggimesa.o
#
# Revision 3.4  1998/07/09 03:16:10  brianp
# added GGI driver
#
# Revision 3.3  1998/06/19 03:15:53  brianp
# added mthreads.c to CORE_SOURCES
#
# Revision 3.2  1998/06/10 02:16:00  brianp
# added FX/fxddspan.c to sources, part of v0.27 of 3Dfx driver
#
# Revision 3.1  1998/03/10 01:27:13  brianp
# updated for David's v0.23 fxmesa driver
#
# Revision 3.0  1998/02/14 18:03:27  brianp
# initial rev
#



##### MACROS #####

VPATH = RCS

INCDIR = ../include
LIBDIR = ../lib

CORE_SOURCES = accum.c alpha.c alphabuf.c api1.c api2.c apiext.c attrib.c \
	bitmap.c blend.c clip.c colortab.c context.c copypix.c depth.c \
	dlist.c drawpix.c enable.c eval.c feedback.c fog.c \
	get.c hash.c image.c light.c lines.c logic.c masking.c matrix.c \
	misc.c mmath.c mthreads.c pb.c pixel.c points.c pointers.c polygon.c \
	quads.c rastpos.c readpix.c rect.c scissor.c shade.c span.c \
	stencil.c teximage.c texobj.c texstate.c texture.c triangle.c \
	varray.c winpos.c vb.c vbfill.c vbrender.c vbxform.c xform.c \
	zoom.c

DRIVER_SOURCES = AOS/amigamesa.c AOS/amigadisp.c AOS/amigadisp_cgx.c \
	AOS/ht_colors.c AOS/mempools.c OSmesa/osmesa.c

ASM_SOURCES = 


OBJECTS = $(ASM_SOURCES:.S=$(O)) $(CORE_SOURCES:.c=$(O)) $(DRIVER_SOURCES:.c=$(O))



##### RULES #####

%$(O): %.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@

%$(O): %.S
	$(CC) -c $(CFLAGS) -resident -malways-restore-a4 $<

# UGH! These rules shouldn't be needed but IRIX's make (and others?) does!
AOS/amigamesa$(O): AOS/amigamesa.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@
AOS/amigadisp$(O): AOS/amigadisp.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@ -O0
AOS/amigadisp_cgx$(O): AOS/amigadisp_cgx.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@ -O2
AOS/ht_colors$(O): AOS/ht_colors.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@
AOS/mempools$(O): AOS/mempools.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@
OSmesa/osmesa$(O): OSmesa/osmesa.c
	$(CC) -c -I. -I$(INCDIR) $(CFLAGS) -resident -malways-restore-a4 $< -o $@



##### TARGETS #####

default:
	@echo "Specify a target configuration"

clean:
	-rm *$(O) *~ */*$(O) */*~

targets: $(LIBDIR)/$(GL_LIB)

# Make the library
$(LIBDIR)/$(GL_LIB): $(OBJECTS)
	$(MAKELIB) $(GL_LIB) $(MAJOR) $(MINOR) $(OBJECTS)
#	mv $(GL_LIB)* $(LIBDIR)


include ../Make-config

include depend



#
# Run 'make dep' to update the dependencies if you change what's included
# by any source file.
# 
dep: $(CORE_SOURCES) $(DRIVER_SOURCES)
	makedepend -fdepend -Y -I../include $(CORE_SOURCES) $(DRIVER_SOURCES)
