
# --------------------------------------------------------------
#
#	gmake
#	gmake install	 [to install  it in the correct directory]
#	gmake clean	 [to clean the source directory]
#
#
# --------------------------------------------------------------
#
# System definition (architecture)
#
ARCH := $(shell ../../../xop_uname)
CPP = cpp

#**************PLATFORM DEPENDENT VARIABLES       **************
#
# libraries for sun5 
#
ifeq ($(ARCH),sun5)
FC = f77
FFLAGS =  -Bstatic -O 
LDFLAGS = -lV77
endif
#
# libraries for linux 
#
ifeq ($(ARCH),linux)
#FC = g77
FC = gfortran
FFLAGS = -O 
endif
#
# libraries for sgi (lindsga) 
#
ifeq ($(ARCH),irix)
FC = f77
FFLAGS = -O 
endif
#
#-------------------------- libraries for darwin
#
ifeq ($(ARCH),darwin)
FC = gfortran
FFLAGS =  
endif
#**************************************************************

.SUFFIXES:
.SUFFIXES: .c .f .F .o .do

all: tc

#  TC executables (tunning curves)
tc : tc.o brighte.o hunt.o usb.o
	$(FC) -o $@ tc.o usb.o brighte.o hunt.o $(LDFLAGS)

#  Fortran files
.f.o:
	$(FC) -c $(FFLAGS) $(INCLUDES) $<
.F.o:
	$(FC) -c $(FFLAGS) $(INCLUDES) $<
.f.do:
	$(FC) -c $(FFLAGSD) $(INCLUDES) -o $@ $<

#  Clean up
clean:
	$(RM) -rf tc $(OBJ_TC) $(OBJD_TC) core *~ *.o *.trace

install:
	/bin/cp tc ../../../bin.$(ARCH)/tc
