###############################################################
# Makefile for all the source codes under sorc folder
# # Use:
# # make - build the executable
# # make install - build and copy the executable files to exec folder
# # make clean - start with a clean slate
# ###############################################################
#
all:
	@echo "-----------------------------------"
	@echo "First, compile petss model codes:"
	@echo "-----------------------------------"
	@echo "Attempting to compile etss_in_wind_hindcst."
	(cd ./etss_in_wind_hindcst.fd && make)
	@echo "Attempting to compile etss_in_wind_fcst."
	(cd ./etss_in_wind_fcst.fd && make)
	@echo "Attempting to compile etss_model."
	(cd ./etss_model.fd && make)
	@echo "Attempting to compile etss_model_13consti."
	(cd ./etss_model_13consti.fd && make)
	@echo "Attempting to compile etss_out_stn."
	(cd ./etss_out_stn.fd && make)
	@echo "Attempting to compile etss_out_grid."
	(cd ./etss_out_grid.fd && make)
	@echo "-----------------------------------"
	@echo "Secondly, compile etss-post processing codes:"
	@echo "-----------------------------------"
	@echo "Compiling libraries"
	@echo "********"
	(cd ../lib/ && make clean install)
	@echo "Compiling combAll, obsAll, debufr, surgeAll, tideAll, degrib and drawshp executables"
	@echo "********"
	(cd ./etss_post_combAll.fd && make all)
	(cd ./etss_post_obsAll.fd && make all)
	(cd ./etss_post_debufr.fd && make all)
	(cd ./etss_post_surgeAll.fd && make all)
	(cd ./etss_post_tideAll.fd && make all)
	(cd ./degrib.cd && make)
	(cd ./drawshp.cd && make)
install: all
	(cd ./etss_in_wind_hindcst.fd && make install)
	(cd ./etss_in_wind_fcst.fd && make install)
	(cd ./etss_model.fd && make install)
	(cd ./etss_model_13consti.fd && make install)
	(cd ./etss_out_stn.fd && make install)
	(cd ./etss_out_grid.fd && make install)
	(cd ./etss_post_combAll.fd && make install)
	(cd ./etss_post_obsAll.fd && make install)
	(cd ./etss_post_debufr.fd && make install)
	(cd ./etss_post_surgeAll.fd && make install)
	(cd ./etss_post_tideAll.fd && make install)
	(cd ./degrib.cd && make install)
	(cd ./drawshp.cd && make install)
clean:
	(cd ./etss_in_wind_hindcst.fd && make clean)
	(cd ./etss_in_wind_fcst.fd && make clean)
	(cd ./etss_model.fd && make clean)
	(cd ./etss_model_13consti.fd && make clean)
	(cd ./etss_out_stn.fd && make clean)
	(cd ./etss_out_grid.fd && make clean)
	(cd ./etss_post_combAll.fd && make clean)
	(cd ./etss_post_obsAll.fd && make clean)
	(cd ./etss_post_debufr.fd && make clean)
	(cd ./etss_post_surgeAll.fd && make clean)
	(cd ./etss_post_tideAll.fd && make clean)
	(cd ./degrib.cd && make clean)
	(cd ./drawshp.cd && make clean)
	(cd ../lib && make clean)