# SMakefile for sample 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

# Only for 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+$(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 = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth \
	eval fog font line logo nurb oglinfo olympic \
	overlay point prim quad select shape \
	speed sphere star stencil stretch texture \
	tri wave

#Not yet in amiga version:blendxor,olginfo,olympic
AMIGAPROGS = accum bitmap1 bitmap2 blendeq copy cursor depth \
	eval fog font line logo nurb \
	overlay point prim quad select shape \
	speed sphere star stencil stretch texture \
	tri 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"

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


