#MinGW   = -DMinGW    ### If you compile tazel under MinGW & MSYS, Enable this line. ###

HDR_FILES = tazel.h
SRC_FILES = main.c glinfo.c rd_tledata.c fdisp.c fparam.c fbasis.c fepoch.c predict-mod.c
LIB_FILES = sgp-c-lib.mod/sgp-c-lib.o
#OPTIONS   = -Wall -g -I. -DnDEBUG -pg
OPTIONS   = -Wall -g -I. -DnDEBUG

tazel: ${HDR_FILES} ${SRC_FILES} ${LIB_FILES} Makefile
	gcc ${OPTIONS} ${MinGW} ${SRC_FILES} ${LIB_FILES} -lm -o tazel

${LIB_FILES}:
	( cd sgp-c-lib.mod ; make sgp-c-lib.o )

clean:
	rm -f tazel tazel.exe test-*.out
	( cd sgp-c-lib.mod; make clean )

test:
# 88888U.tle Test ( Erase CR for MinGW )
	tazel -gTEST SampleData/88888U.tle 1980-10-01 23:41:24 | tr -d "\r" >  test-88888U.out
	tazel -gTEST SampleData/88888U.tle 1980-10-02 05:41:24 | tr -d "\r" >> test-88888U.out
	tazel -gTEST SampleData/88888U.tle 1980-10-02 11:41:24 | tr -d "\r" >> test-88888U.out
	tazel -gTEST SampleData/88888U.tle 1980-10-02 17:41:24 | tr -d "\r" >> test-88888U.out
	tazel -gTEST SampleData/88888U.tle 1980-10-02 23:41:24 | tr -d "\r" >> test-88888U.out
	diff SampleData/refs-88888U.out test-88888U.out
	@if [ $$? -eq 0 ] ; then  echo "[01;36m    *** Test 1/4 -> OK!! ***[00m" ; fi
# 11801U.tle Test ( Erase CR for MinGW )
	tazel -gTEST SampleData/11801U.tle 1980-08-17 07:06:40 | tr -d "\r" >  test-11801U.out
	tazel -gTEST SampleData/11801U.tle 1980-08-17 13:06:40 | tr -d "\r" >> test-11801U.out
	tazel -gTEST SampleData/11801U.tle 1980-08-17 19:06:40 | tr -d "\r" >> test-11801U.out
	tazel -gTEST SampleData/11801U.tle 1980-08-18 01:06:40 | tr -d "\r" >> test-11801U.out
	tazel -gTEST SampleData/11801U.tle 1980-08-18 07:06:40 | tr -d "\r" >> test-11801U.out
	diff SampleData/refs-11801U.out test-11801U.out
	@if [ $$? -eq 0 ] ; then  echo "[01;36m    *** Test 2/4 -> OK!! ***[00m" ; fi
# iss-XXXX.tle Parallel Mode Test ( Erase CR for MinGW )
	tazel -gTEST -p SampleData/iss-XXXX.tle e          e 10d | tr -d "\r" >  test-parall.out
	diff SampleData/refs-parall.out test-parall.out
	@if [ $$? -eq 0 ] ; then  echo "[01;36m    *** Test 3/4 -> OK!! ***[00m" ; fi
# iss-XXXX.tle Serial   Mode Test ( Erase CR for MinGW )
	tazel -gTEST -s SampleData/iss-XXXX.tle 1995-01-01 0 25y | tr -d "\r" >  test-serial.out
	diff SampleData/refs-serial.out test-serial.out
	@if [ $$? -eq 0 ] ; then  echo "[01;36m    *** Test 4/4 -> OK!! ***[00m" ; fi
