#@(#) Makefile started by makeout(1) 2020-01-14 01:11:41
# generated by:   ...
NULL=
#$(NULL)
PROGFILES = \
 ../example/demo1.f90 \
 ../example/demo2.f90 \
 ../example/demo3.f90 \
 ../example/demo4.f90 \
 ../example/demo5.f90 \
 ../example/demo6.f90 \
 ../example/demo7.f90 \
 ../example/demo8.f90 \
 ../example/demo9.f90 \
 ../example/demo10.f90 \
$(NULL)
TESTFILES = \
 ../test/test_suite_M_CLI2.f90 \
$(NULL)
TPROG = ${TESTFILES:.f90=}
PROG = ${PROGFILES:.f90=}
SRCS =  M_CLI2.f90 
OBJS =  M_CLI2.o 
# platform-specific values you will probably change
#
#
# This is a compiler bug. It is well-known, but not fixed in GCC yet. You
# can see the report at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91442
# 
# You can either ignore it, or disable the "may be used uninitialized"
# warnings with -Wno-maybe-uninitialized or compile with optimizations
# (-O1 and more).
gfortran: F90=gfortran
gfortran: F90FLAGS := -g -O -Wall -std=f2018 -Wextra -Wno-maybe-uninitialized -Wno-uninitialized
gfortran: all
	@echo built with $(F90)

nvfortran: F90=nvfortran
nvfortran: F90FLAGS := -Minform=inform -Mbackslash -traceback
nvfortran: all
	@echo built with $(F90)

ifort: F90=ifort
ifort: F90FLAGS := -warn all -traceback
ifort: all
	@echo built with $(F90)

nagfor: F90=nagfor
nagfor: F90FLAGS := -C all
nagfor: all
	@echo built with $(F90)

LIBS := 
LDFLAGS := 
all: $(PROG) $(TPROG)
	@echo "That's All Folks! Enter \"make help\" for more options"
$(PROG): $(OBJS)
	-$(F90) $(LDFLAGS) $@.f90 -o $@ $(OBJS) $(LIBS)
clean:
	rm -f $(PROG) $(CPROG) $(TPROG) $(OBJS) *.mod *.o
.SUFFIXES: $(SUFFIXES) .f90 .F90 
.f90.o:
	$(F90) $(F90FLAGS) -c $<
.F90.o:
	$(F90) $(F90FLAGS) -c $<
.PHONY: help
help:
	: ###############################################################################
	: # gfortran|nvfortran|ifort -- build M_CLI2 module. Default is gfortran        #
	: # run                      -- run manpage demo programs                       #
	: # test                     -- run test programs                               #
	: # man                      -- show all manpages as text                       #
	: # ship                     -- rebuild archive files of manpages               #
	: # clean                    -- clean directory of object files and executables #
	: # doxygen                  -- run doxygen(1) if you have it                   #
	: # ford                     -- run ford(1) if you have it                      #
	: # help                     -- display this text                               #
	: ###############################################################################

.PHONY: run
run: $(PROG)
	# run everything
	#echo $? |xargs -n 1|xargs -iXX time XX 2>&1
	set +x;echo $? |xargs -n 1|xargs -iXX env XX 2>&1

$(TPROG): $(OBJS)

	-$(F90) $(LDFLAGS) $@.f90 -o $@ $(OBJS) $(LIBS) # && ./$@ </dev/null

.PHONY: doxygen
doxygen: 
	doxygen dox.in
.PHONY: ford
ford: 
	cd ..;ford ford.md

.PHONY: test
test: $(TPROG)
	# run tests
	echo $? | xargs -n 1  
	echo $? | xargs -n 1  |(set +x;xargs -iXX env XX 2>&1)

.PHONY: man
man:
	@mandb ../man 1>&2
	: INDEX OF MANPAGES TOPICS
	@env MANPATH=../man MANWIDTH=256 man -k .|col -b
	: MANPAGES
	@env MANPATH=../man MANWIDTH=80  man --regex '.*'|col -b
	: SPELLING
	@env MANPATH=../man MANWIDTH=80  man --regex '.*'|col -b|spell|xargs -n 5|column -t

.PHONY: ship
ship:
	: make easily distributed archive files of manpages
	mkdir -p ../docs
	cd ../man/man3;\
	   gzip *.3m_cli2;\
	   zip -r ../../docs/manpages.zip *gz;\
	   tar cvfz ../../docs/manpages.tgz *gz;\
	   gunzip *.3m_cli2.gz
