# Set up the ARCH variables
#
ARCH		:=		$(shell arch)
#
# Define directories
#
MATLABROOT=/usr/local/matlab
LIBDIR=$(MATLABROOT)/extern/lib/$(ARCH)
INCDIR=$(MATLABROOT)/extern/include
#
# Defaults
#
CC=cc
CFLAGS=-O
CPPFLAGS=-I$(INCDIR)
SYSLIBS=-lm
#
# Platform specific defines
#
ifeq ($(ARCH),sun4)
  CC=gcc
  CFLAGS=-O -ansi
  CPPFLAGS=-I$(INCDIR) -Dsparc
endif
ifeq ($(ARCH),sol2)
  CFLAGS=-O -Xa -xlibmieee -xlibmil
endif
ifeq ($(ARCH),hp700)
  CPPFLAGS=-I$(INCDIR) -Aa -D_HPUX_SOURCE
endif
ifeq ($(ARCH),sgi)
  SYSLIBS=-lblas -lm
endif
ifeq ($(ARCH),ibm_rs)
  CFLAGS=-O -qfloat=nomaf
  CPPFLAGS=-I$(INCDIR) -qlanglvl=ansi -D_ALL_SOURCE
endif 
ifeq ($(ARCH),alpha)
  CFLAGS=-O -ieee_with_no_inexact -assume noaccuracy_sensitive
  CPPFLAGS=-I$(INCDIR) -std1
  SYSLIBS=-lots -lm
endif
%.$(ARCH):%.c
	$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $^ $(LIBDIR)/libtbx.a $(LIBDIR)/libmcc.a $(LIBDIR)/libmatlb.a $(SYSLIBS)

head: mrank.$(ARCH) mrankp.$(ARCH) multargp.$(ARCH)

mrank.$(ARCH):	main.c mrank.c

mrankp.$(ARCH): mrankp.c mrank.c

multargp.$(ARCH): multargp.c multarg.c

