all: anldump.csv fcsdump.csv

FC=gfortran
FFLAGS=-g
TABLES= -ltableb ./table_b_bufr -ltabled ./table_d_bufr -dump

anldump.txt: Z__C_RJTD_20140710010000_MET_SEQ_RAwstd_Proi_ANAL_bufr.bin
	-rm -f DEBUG.decoder
	bufr_decoder $(TABLES) -output anldump.txt -inbufr Z__C_RJTD_20140710010000_MET_SEQ_RAwstd_Proi_ANAL_bufr.bin
	test ! -f DEBUG.decoder || cat DEBUG.decoder && test ! -f DEBUG.decoder 

fcsdump.txt: Z__C_RJTD_20140710010000_MET_SEQ_RAwstd_Proi_FH01-06_bufr4.bin
	-rm -f DEBUG.decoder
	bufr_decoder $(TABLES) -output fcsdump.txt -inbufr Z__C_RJTD_20140710010000_MET_SEQ_RAwstd_Proi_FH01-06_bufr4.bin
	test ! -f DEBUG.decoder || cat DEBUG.decoder && test ! -f DEBUG.decoder 

readdump: readdump.f90
	$(FC) $(FFLAGS) -o readdump readdump.f90

anldump.csv: anldump.txt readdump
	echo anldump.txt | ./readdump > anldump.csv

fcsdump.csv: fcsdump.txt readdump
	echo fcsdump.txt | ./readdump > fcsdump.csv

clean:
	rm -f readdump

sync:
	rsync -auvz --delete ./ toyoda-eizi.net:public_html/2014/0912hybufr/
