# SMakefile for demo programs

# Mesa 3-D graphics library
# Version:  1.2
# Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
#
# 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.




##### MACROS #####

INCDIR = /include
GL_LIB = MesaGL.LIB
GLU_LIB = MesaGLU.LIB
TK_LIB = Mesatk.LIB
AUX_LIB = Mesaaux.LIB

TMP_FILE = T:MesaTMP_SCOPTS


#AMIWIN 
XLIBS = X11.LIB
XDIR = x11:sasc
NET_INC = netinclude:
NET_LIB = netinclude:/netlib/net.lib

AMIWINGL_LIBS = lib lib:sc.lib+lib:scm881.lib+lib:scmieee.lib+$(NET_LIB)+$(XDIR)/lib/$(XLIBS)+/lib/$(AUX_LIB)+/lib/$(TK_LIB)+/lib/$(GLU_LIB)+/lib/$(GL_LIB)
AMIGAGL_LIBS =  lib lib:sc.lib+/lib/$(AUX_LIB)+/lib/$(TK_LIB)+/lib/$(GLU_LIB)


PROGS = bounce gamma gears glxdemo glxpixmap isosurf offset osdemo shadow \
	spin test0 wave xdemo
	
# Missing in Amiga version is :glxdemo,glxpixmap,xdemo, offset	
AMIGAPROGS = bounce gamma gears isosurf osdemo shadow spin test0 wave 

CC = sc

AMIWINSCFLAGS = idir=$(NET_INC) idir=$(INCDIR) idir=$(XDIR)/include data=far idlen=63 \
          nostkchk IGN=ALL math=68882 cpu=68040 optimize define=AMIWIN

AMIGASCFLAGS = idir=$(INCDIR) data=far idlen=63 with=/amiga/SCOPTIONS\
          IGN=ALL define=AMIGA


##### TARGETS #####

default:
	@echo "specify: smake <target>"
	@echo "Where <targets> is one of"
	@echo "       amiga   - Compiles using link library"
	@echo "       library - Compiles using standard library (still beta)"
	@echo "       targets - Compilations for AMIWIN"
	smake amiga

clean:
	-delete *.o *.lnk *.info

realclean: 
	-delete $(PROGS)
	-delete *.o *.lnk *.info

amiga: AmigaLIB $(AMIGAPROGS) DeleteTMP

library: AmigaLibrary $(AMIGAPROGS) DeleteTMP

targets: AMIWIN $(PROGS) DeleteTMP


AmigaLIB:
	@echo >$(TMP_FILE) "$(AMIGASCFLAGS) define=AMIGALIB $(AMIGAGL_LIBS)+/lib/$(GL_LIB)"

AmigaLibrary:
	@echo >$(TMP_FILE) "$(AMIGASCFLAGS) $(AMIGAGL_LIBS)"

AMIWIN:
	@echo >$(TMP_FILE) "$(AMIWINSCFLAGS) $(AMIWINGL_LIBS)"

DeleteTMP:
	@delete $(TMP_FILE)

$(PROGS):
	$(CC) WITH=$(TMP_File) link $>.c
