# This is a makefile for GNU make.
# This makefile builds the NR_util library.

# 1. Source files

sources := $(sort nrtype.f90 nr_util.f90 iminloc.f90 arth.f90 array_copy.f90 swap.f90 reallocate.f90 imaxloc.f90 assert.f90 assert_eq.f90 geop.f90 cumsum.f90 poly.f90 poly_term.f90 outerprod.f90 outerdiff.f90 scatter_add.f90 scatter_max.f90 diagadd.f90 diagmult.f90 get_diag.f90 put_diag.f90 cumprod.f90 ifirstloc.f90 lower_triangle.f90 nrerror.f90 outerand.f90 outerdiv.f90 outersum.f90 unit_matrix.f90 upper_triangle.f90 vabs.f90 zroots_unity.f90)

# 2. Objects and library

objects := $(sources:.f90=.o)
lib = libnr_util.a

# 3. Rules

# Extend known suffixes:
%.o: %.f90
	$(COMPILE.f) $(OUTPUT_OPTION) $<

.PHONY: all clean depend

all: ${lib}

${lib}: ${lib}(${objects})

depend depend.mk:
	makedepf90 -Wmissing -Wconfused -nosrc ${sources} >depend.mk

clean:
	rm -f ${lib} ${objects}

# Dependencies between object files and include files:
include depend.mk
