#
# Szymon Rusinkiewicz
#
# Makedefs
# This contains all the defines needed for the Makefiles
# Note that this almost certainly requires a recent GNU make
#
#
# Misc variables used in the Makefiles...
#
MACH=$(subst IRIX64,IRIX,$(shell uname))
DATE=$(shell date)
CWD=$(shell pwd)
#
#
# This must be GNU tar (not needed for compiling)
#
#TAR = tar
TAR = gtar
#
#
# Uncomment this to get debugging CFLAGS and keep symbol information
#
#DEBUG = y
#
#
# The C and C++ compilers
#  gcc/g++ are recommended ; IRIX cc/CC are known to work
#
CC = gcc
CXX = g++
#CC = cc
#CXX = CC
#
#
# Any misc defines go here
DEFINES =
#
# Uncomment this to use texture mapping instead of glDrawPixels
#
#DEFINES += -DUSE_TEXMAP
#
# Uncomment this to draw polygons instead of using glDrawPixels
# This is definitely a win on some SGI boxen
#
DEFINES += -DUSE_POLYGONS
#
#
# Standard includes, compiler options, libraries, etc.
# Also check out the architecture-specific sections below
#
COPTS =
LDOPTS = -Wl,-x -Wl,-s
SHLIBOPTS = -fpic
INCLUDES =
XINCLUDES = -I/usr/include/GL -I/usr/include/X11
LIBDIR =
XLIBDIR =
LIBS = -lm
XLIBS = -Wl,-B -Wl,static -lforms -lglut -Wl,-B -Wl,dynamic -lX11 -lXmu
LINKSHARED = $(CXX) -shared
MAKEDEPEND = makedepend
RANLIB = ranlib
#
# Additional architecture/compiler-specific options
#
## IRIX and GCC
#
ifeq ($(MACH),IRIX)
ifeq ($(CC),gcc)
    COPTS += -Wall -Wno-unused -pipe
    COPTS += -mcpu=r4000 -mips2 -O3 -funroll-loops -ffast-math
    XINCLUDES += -I/u/smr/xforms/include -I/usr/common/include
    XLIBDIR += -L/u/smr/xforms/lib -L/usr/common/lib
    XLIBS += -lGLU -lGL
    MAKEDEPEND = makedepend -I/usr/include/CC
    RANLIB =
else
#
## IRIX with bundled CC
#
    COPTS += -32 -mips2 -O2 -woff 3247,3262
    #COPTS += -n32 -mips3 -O3 -woff 1155
    SHLIBOPTS =
    LDOPTS = -Wl,-w
    XINCLUDES += -I/u/smr/xforms/include -I/usr/common/include
    #XLIBDIR += -L/u/smr/xforms/lib32 -L/usr/common/lib32
    XLIBDIR += -L/u/smr/xforms/lib -L/usr/common/lib
    XLIBS += -lGLU -lGL
    MAKEDEPEND = makedepend -I/usr/include/CC
    RANLIB =
endif
else
#
## Linux and GCC
#
ifeq ($(MACH),Linux)
    COPTS += -Wall -Wno-unused -pipe
    COPTS += -m486 -malign-double -O6 -funroll-loops -ffast-math -fomit-frame-pointer
    XLIBS += -lMesaGLU -lMesaGL -lXi -lXext
else
#
## None of the above - please notify smr@cs.stanford.edu if you port bv to
## any other systems
#
    COPTS += -O2
    XLIBS += -lGLU -lGL
endif
endif
#
#
# Overrides for debugging
#
ifdef DEBUG
    DEFINES += -DDEBUG
    COPTS = -g
    LDOPTS = -g
endif
#
#
# Xforms default rule
#
%.h %.c: %.fd
	fdesign -convert $<
