########################################################################
#  Makefile for NPOI simulation
#
#  To run, this need a library for the atmosphere routines
#
#  in the atmosphere directory type
#
#   make test
#   ar -rc libAtmos.a *.o
########################################################################
CC = g++ -Wall
LINK = g77

OBJECTS = fsm.o combiner.o fringeMath.o fdl.o memory.o atmosphere.o \
	sineWave.o display.o fringeSpectrum.o dmmath.o config.o

#ATMOS =  TestMulti.o GetMultiRoData.o Init.o \
#		InitGeometry.o InitPhaseScreen.o InitAperture.o \
#		InitArray.o StructFn.o InitCoarseArray.o Init2RoArray.o \
#		InitRoArray.o InitSpline.o FIxEt.o \
#		DiagonalCov.o Reset.o GetWaveFront.o \
#		SubdivideRo.o GetRoStep.o \
#		Get2RoStep.o GetCoarseStep.o \
#		spline_routines.o ran1lib.o deigen.o nrutil.o \
#

ATMOS = ../atmos/GetMultiRoData.o ../atmos/Init.o ../atmos/InitGeometry.o \
	../atmos/InitPhaseScreen.o ../atmos/InitAperture.o ../atmos/InitArray.o \
	../atmos/StructFn.o ../atmos/InitCoarseArray.o ../atmos/Init2RoArray.o \
	../atmos/InitRoArray.o ../atmos/InitSpline.o ../atmos/FIxEt.o \
	../atmos/DiagonalCov.o ../atmos/Reset.o ../atmos/GetWaveFront.o \
	../atmos/SubdivideRo.o ../atmos/GetRoStep.o ../atmos/Get2RoStep.o \
	../atmos/GetCoarseStep.o ../atmos/spline_routines.o ../atmos/ran1lib.o \
	../atmos/deigen.o ../atmos/nrutil.o

INCLUDE = /home/cah/inchworm/pgplot_5.1.0/target

#PLOTLIB = -L/usr/local/lib -lcpgplot -lpgplot -L/usr/X11R6/lib  -lX11
PLOTLIB =  -L/home/cah/inchworm/pgplot_5.1.0/target  -lcpgplot -lpgplot -L/usr/X11R6/lib  -lX11

.cpp.o :
	echo compiling $<
	$(CC)  -c $< -I$(INCLUDE)

npoi:	npoi.o $(OBJECTS)
	$(CC) -o npoi  npoi.o $(OBJECTS) $(ATMOS) -lm $(PLOTLIB) -lg2c

twoWay:	twoWay.o $(OBJECTS)
	$(CC) -o twoWay  twoWay.o $(OBJECTS) -L../atmos -lAtmos

# npoi:	npoi.o $(OBJECTS)
# 	$(CC) -o npoi  npoi.o $(OBJECTS) -L../atmos -lAtmos -lm $(PLOTLIB) -lg2c

clean:
	/bin/rm -f *.o

plotIt:  plotIt.c
	$(CC) plotIt.c -c -I$(PGPLOT_DIR)  -Wall
	g77   plotIt.o -o plotIt $(PLOTLIB) -lm


