FC = gfortran
DATDIR = \"/home/ascuser/aceprog/coordtrans\"
FFLAGS = -DDATDIR=$(DATDIR) -O2 -ffixed-line-length-none -fno-automatic -cpp

OBJS = dxjul.o \
ic_angles_to_vector.o \
ic_conv_geo_to_gci.o \
ic_conv_matrix.o \
ic_cross_product.o \
ic_fetch_slp_coef.o \
ic_fetch_tcc_rec.o \
ic_gci_to_geo.o \
ic_gci_to_gse.o \
ic_gci_to_gsm.o \
ic_get_coef.o \
ic_get_nut_angles.o \
ic_get_time_diff.o \
ic_grnwch_sidereal.o \
ic_gse_to_geo.o \
ic_gse_to_gsm.o \
ic_gsm_to_geo.o \
ic_open_time_coeff_file.o \
ic_pos_vel_of_sun.o \
ic_vector_to_angles.o \
icss_cnvt_from_rp.o \
icss_payload_to_gse.o \
icss_pos_of_sun.o \
icss_tilt_angle.o \
icss_transf_att.o \
icss_transf_orb.o \
icss_velocity_trans.o \
ic_gse_to_hseb.o \
ic_hsea_to_hs.o \
ic_hseb_to_hsea.o \
ic_gci_to_rtn.o \
ic_rtn_to_gci.o \
ic_gci_to_geo_xx.o \
ic_gci_to_gse_xx.o \
ic_gse_to_hseb_xx.o \
ic_hseb_to_hsea_xx.o \
ic_hseb_to_hsea_xy.o \
ic_hsea_to_hs_xx.o \
mulmat.o \
matadd.o \
solar_spin_gci.o \
solar_spin_gci_xx.o \
utmxtrp8.o \
gaussj.o \
dot_prod.o \
unit_vec.o \
circulo.o \
rtntogse.o \
rtntogsegsm.o

libcoordtrans.a:	$(OBJS)
	ar rcv libcoordtrans.a $(OBJS)

test_j2000_rtn: test_j2000_rtn.o libcoordtrans.a
	$(FC) ${FFLAGS} $^ -o $@ -L. -lcoordtrans

test_j2000_rtn.o: test_j2000_rtn.f
	$(FC) ${FFLAGS} -c $< -o $@ 

test_rtn_to_gse: test_rtn_to_gse.o libcoordtrans.a
	$(FC) ${FFLAGS} $^ -o $@ -L. -lcoordtrans

test_rtn_to_gse.o: test_rtn_to_gse.f
	$(FC) ${FFLAGS} -c $< -o $@

test_gse_to_rtn: test_gse_to_rtn.o libcoordtrans.a
	$(FC) ${FFLAGS} $^ -o $@ -L. -lcoordtrans

test_gse_to_rtn.o: test_gse_to_rtn.f
	$(FC) ${FFLAGS} -c $< -o $@

read_tdiff: read_tdiff.o libcoordtrans.a
	$(FC) ${FFLAGS} $^ -o $@ -L. -lcoordtrans

read_tdiff.o: read_tdiff.f
	$(FC) ${FFLAGS} -c $< -o $@ 

read_pos_of_sun: read_pos_of_sun.o libcoordtrans.a
	$(FC) ${FFLAGS} $^ -o $@ -L. -lcoordtrans 

read_pos_of_sun.o: read_pos_of_sun.f
	$(FC) ${FFLAGS} -c $< -o $@

read_tilt_angle: read_tilt_angle.o libcoordtrans.a
	$(FC) ${FFLAGS} $^ -o $@ -L. -lcoordtrans 

read_tilt_angle.o: read_tilt_angle.f
	$(FC) ${FFLAGS} -c $< -o $@ 

clean:
	rm -f *.o
	rm -f libcoordtrans.a \
	test_j2000_rtn test_rtn_to_gse test_gse_to_rtn \
	read_tdiff read_pos_of_sun read_tilt_angle
	
	










