#------------------------------------------------------------------
# Makefile to make the whole GFI extensions. Temporarly, you can also 
# remake the original CODAS package from here. However, in the long
# run, this file should be called from the main CODAS makefile.
#
# Edit the following parameters:
#
# top_dir:
#   Relative path to the CODAS top directory
#
# src_YYY_dir:
#   Relative path to the top GFI YYY source files sub-directories
#
# YYY_sub_dirs:
#   List of all YYY sub-directories containing source files to be 
#   made. Each of them must has its own Makefile.
#------------------------------------------------------------------

top_dir      = ..
src_lib_dir  = src/libs
src_bin_dir  = src/apps

lib_sub_dirs = $(src_lib_dir)/ctd  \
               $(src_lib_dir)/db   \
               $(src_lib_dir)/math \
	       $(src_lib_dir)/misc \
	       $(src_lib_dir)/nav  \
	       $(src_lib_dir)/nbr  

bin_sub_dirs = $(src_bin_dir)/nbr  \
               $(src_bin_dir)/nav  \
	       $(src_bin_dir)/util \
	       $(src_bin_dir)/ctd  \
	       $(src_bin_dir)/db

# 2000/12/01 PJ Removed DNMI applications
# $(src_bin_dir)/misc 

#------------------------------------------------------------------
# Normally, no more editiong should be required below
#------------------------------------------------------------------

include $(top_dir)/makefile.dep
include make/$(HOST)/makefile.dep

log_file = Make.log

#------------------------------------------------------------------

all: libs bins

ALL: codas all

codas:
	$(CD) $(top_dir) ; $(MAKE) $(CLEAN)

libs: log_libs $(lib_sub_dirs)

bins: log_bins $(bin_sub_dirs)

#---
# NOTE: Documentation can currently only be compiled on pc170.gfi.uib.no
#       send e-mail to jaccard@gfi.uib.no for more information
#---
docs: 
	$(MAKE) -f Makefile.sgml

#------------------------------------------------------------------

$(lib_sub_dirs): lib.tmp
	@echo lib:  $@ >> $(log_file) 
	$(CD) $@ ; $(MAKE) $(CLEAN)
	$(RM) lib.tmp


$(bin_sub_dirs): bin.tmp
	@echo bin:  $@ >> $(log_file) 
	$(CD) $@ ; $(MAKE) $(CLEAN)
	$(RM) bin.tmp

#------------------------------------------------------------------

lclint:
	$(MAKE) CLEAN=lclint

clean:
	$(MAKE) CLEAN=clean

purge:
	$(MAKE) CLEAN=purge

#------------------------------------------------------------------

lib.tmp:
	echo $@ > lib.tmp

bin.tmp:
	echo $@ > bin.tmp

log_bins: $(log_file)
	@date >> $(log_file)
	@echo bins: $(bin_sub_dirs) >> $(log_file)

log_libs: $(log_file)
	@date >> $(log_file)
	@echo libs: $(lib_sub_dirs) >> $(log_file)

$(log_file):
	touch $@

