# -*-Makefile-*-  Last Modified : Sat Aug 13 12:58:02 2005
# Creation date : Tue Sep 26 15:37:10 2000
# Last Modified : Mon Oct 20 15:49:55 2003

build=D
SPEC=
BIN=bin

##############
# GNU C/C++
CC.gcc=gcc
OPT.gcc.D=-Wall -g3 
OPT.gcc.R=-Wall -O3 
LOPT.gcc=-L/usr/X11R6/lib -lpthread

##############
# GNU C/C++
CC.gpp=g++
OPT.gpp.D=-Wall -g3 -D_i686
OPT.gpp.R=-Wall -O3 -D_i686
LOPT.gpp=-L/usr/X11R6/lib -lpthread
XLIBS.gpp=-lX11

##############
# GNU C/C++ in cygwin
CC.cygwin=g++
OPT.cygwin.D=-Wall -g3 -D_i686 -D_NOLOCK -D_NODRAND48
OPT.cygwin.R=-Wall -O3 -D_i686 -D_NOLOCK -D_NODRAND48
LOPT.cygwin=-L/usr/X11R6/lib -lpthread
XLIBS.cygwin=-lX11

##############
# GNU C/C++ in windows (compile in cygwin, runable in win)
CC.win=g++
OPT.win.D=-Wall -g3 -D_i686 -D_windows -D_NOLOCK -D_NODRAND48 -DNOPREPROCESS -DNO_VSNPRINTF -DNO_XPM -DDEPTH=32 -D__GNU_LIBRARY__ -D_SEM_SEMUN_UNDEFINED -I/usr/include/GL
OPT.win.R=-Wall -O3 -D_i686 -D_windows -D_NOLOCK -D_NODRAND48 -DNOPREPROCESS -DNO_VSNPRINTF -DNO_XPM -DDEPTH=32 -D__GNU_LIBRARY__ -D_SEM_SEMUN_UNDEFINED -I/usr/include/GL
LOPT.win=-L/usr/X11R6/lib -lpthread
XLIBS.win=-lglut32 -lglu32 -lopengl32

##############
# IBM C/C++
CC.ibm=xlC
OPT.ibm.D= -g 
OPT.ibm.R= -O3 
LOPT.ibm=-lpthread
XLIBS.ibm=-lX11

##############
# GPS
CC.gps=cxx -D__gps
OPT.gps.D= -g3 -pthread
OPT.gps.R= -O3 -pthread
GEN.gps+=-DNOPREPROCESS
LOPT.gps= -lrt
XLIBS.gps=-lX11

##############
# Xolas SunOS
CC.SunOS=CC
GEN.SunOS=
OPT.SunOS.D=-xCC -g
OPT.SunOS.R=-xCC -xO5 -xdepend -xarch=v8plus -xchip=ultra -fsimple -dalign
XLIBS.SunOS=-lX11

##############
# SGI IRIX
CC.IP22=CC
OPT.IP22.D=-Xcpluscomm -g
OPT.IP22.R=-Xcpluscomm -mips2 -O3 -kpicopt -non_shared 
XLIBS.IP22=-lX11

##############
# x86 Linux
CC.i686=g++ -D_i686
OPT.i686.D=$(OPT.gcc.D)
OPT.i686.R=$(OPT.gcc.R)
LOPT.i686=-L/usr/X11R6/lib -lpthread
CC.i586=$(CC.i686)
OPT.i586.D=$(OPT.i686.D)
OPT.i586.R=$(OPT.i686.R)
LOPT.i586=$(LOPT.i686)
XLIBS.i586=-lX11

##############
# alpha Linux
CC.alpha=gcc
OPT.alpha.R=$(OPT.gcc.R)
OPT.alpha.D=$(OPT.gcc.D)
LOPT.alpha=-L/usr/X11R6/lib -lpthread
XLIBS.alpha=-lX11

##############
# SGI IRIX64
CC.IP27=CC 
#CC.IP27=gcc -fhuge-objects
FGEN.IP27=-n32
OPT.IP27.R=-Wall -O3
OPT.IP27.D=-D__BIG_ENDIAN
LOPT.IP27=-IPA -lpthread
XLIBS.IP27=-lX11

##############
#OPT.D=-D_DEBUG
OPT.D=
OPT.R=

GEN=$(OPT.$(SYS).$(build)) $(OPT.$(build)) $(GEN.$(SYS))
FGEN=$(FGEN.$(SYS))
LINK=-lm $(GEN) $(LOPT.$(SYS))
XLIBS=$(XLIBS.$(SYS))
CC=$(CC.$(SYS)) $(SPEC)
cc=cc

##################################################
# Default rules:

define link
$(CC) $^ $(LINK) -o ../$(BIN)/$@_$(SYS)
endef

#_$(SYS)
.PHONY: all clean update

all:

%_t.o:%.cpp %.o
	$(CC) -D_TEST -c $(OPT) $< -o $@
%_t.o:%.c %.o
	$(CC) -D_TEST -c $(OPT) $< -o $@

%.to:%.cpp %.o
	$(CC) -D_TEST -c $(GEN) $< -o $@
%.o:%.cpp
	$(CC) -c $(GEN) $(basename $@).cpp
%.o:%.c
	$(CC) -c $(GEN) $(basename $@).c
clean::
	rm -f $(wildcard *.bak *.o *.to a.out *$(SYS))

%.o:%.f
	$(F77) -c $(FGEN) $^
Makefile::
	makedepend -Y *.cpp
