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

# 1. Source files

VPATH = .

sources := $(sort $(shell cat ${VPATH}/file_list))

# 2. Objects and library

MAN := $(addprefix man1/, $(sources:.f=.1))
objects := $(sources:.f=.o)
lib = libslatec.a

# 3. Compiler-dependent part

FC = gfortran               
FFLAGS = -fdefault-real-8

# 4. Rules

SHELL = bash

man1/%.1: %.f
	sed -f makedoc.sed $< >$@

.PHONY: all clean
all: ${lib} $(MAN) trace
${lib}: ${lib}(${objects})

clean:
	rm -f ${MAN} ${lib} trace

trace:
	${FC} ${version_flag} >$@ 2>&1
	echo -e "\nFC = ${FC}\n\nFFLAGS = ${FFLAGS}" >>$@
