#  Main body of the installation makefile for the GALAHAD TOOLS package

#  Nick Gould, for GALAHAD productions
#  This version: 2024-03-26

#  include standard GALAHAD makefile defaults before package-specifics

include $(GALAHAD)/src/makedefs/defaults

#  ===========================================================================
#  ====================  package-dependent parts  ============================
#  ===========================================================================

#  package name

package = tools
PACKAGE = TOOLS

#  auxiliary packages that current package depends on (prepend with make_)

DEPENDENCIES = make_dummy

#  other packages that depend on package

DEPENDS = nlpt

#  auxiliary packages that are needed for tests (prepend with make_)

TESTDEPS =

#  tests to be performed (preprend with test_)

TESTS =

#  ===========================================================================
#  =================  end of package-dependent parts  ========================
#  ===========================================================================

#  include standard GALAHAD makefile definitions

include $(GALAHAD)/src/makedefs/definitions

#  include compilation and run instructions

include $(GALAHAD)/src/makedefs/instructions

#  non-standard package compilation

$(package).o: $(LG)($(package)_$(PRECIS).o)

$(LG)($(package)_$(PRECIS).o): ../$(package)/$(package).F90
	@printf ' %-9s %-15s\t\t' "Compiling" "$(package)"
	$(CP) ../$(package)/$(package).F90 $(OBJ)/$(package).F90
	cd $(OBJ); $(FORTRAN) -o $(package)_$(PRECIS).o \
                     $(FFLAGS) $(package).F90 \
                || ( printf ' %-26s' "=> Disabling optimization " ; \
                   $(FORTRAN) -o $(package)_$(PRECIS).o \
                     $(FFLAGSN) $(package).F90 )
	cd $(OBJ); $(ARR) $(package)_$(PRECIS).o; \
          $(RM) $(package).F90 $(package)_$(PRECIS).o
	$(MVMODS)
	@printf '[ OK ]\n'

#  include required package intermediaries

include $(GALAHAD)/src/makedefs/intermediaries
