Blame test/mpi/f08/io/Makefile.am

Packit Service c5cf8c
# -*- Mode: Makefile; -*-
Packit Service c5cf8c
# vim: set ft=automake :
Packit Service c5cf8c
#
Packit Service c5cf8c
# (C) 2011 by Argonne National Laboratory.
Packit Service c5cf8c
#     See COPYRIGHT in top-level directory.
Packit Service c5cf8c
#
Packit Service c5cf8c
Packit Service c5cf8c
include $(top_srcdir)/Makefile_f08.mtest
Packit Service c5cf8c
Packit Service c5cf8c
EXTRA_DIST = testlist.in
Packit Service c5cf8c
Packit Service c5cf8c
# avoid having to write many "foo_SOURCES = foo.f90" lines
Packit Service c5cf8c
AM_DEFAULT_SOURCE_EXT = .f90
Packit Service c5cf8c
Packit Service c5cf8c
noinst_PROGRAMS = \
Packit Service c5cf8c
    iwriteatf90 \
Packit Service c5cf8c
    iwritef90 \
Packit Service c5cf8c
    iwriteshf90 \
Packit Service c5cf8c
    writef90 \
Packit Service c5cf8c
    writeatf90 \
Packit Service c5cf8c
    writeallf90 \
Packit Service c5cf8c
    writeallbef90 \
Packit Service c5cf8c
    writeordf90 \
Packit Service c5cf8c
    writeordbef90 \
Packit Service c5cf8c
    writeshf90 \
Packit Service c5cf8c
    writeatallf90 \
Packit Service c5cf8c
    writeatallbef90 \
Packit Service c5cf8c
    fileerrf90 \
Packit Service c5cf8c
    fileinfof90 \
Packit Service c5cf8c
    shpositionf90 \
Packit Service c5cf8c
    atomicityf90 \
Packit Service c5cf8c
    miscfilef90 \
Packit Service c5cf8c
    setviewcurf90 \
Packit Service c5cf8c
    c2f90multio \
Packit Service c5cf8c
    c2f2ciof90
Packit Service c5cf8c
Packit Service c5cf8c
if BUILD_MPIX_TESTS
Packit Service c5cf8c
noinst_PROGRAMS += \
Packit Service c5cf8c
    i_fcoll_test \
Packit Service c5cf8c
    iwriteatallf90
Packit Service c5cf8c
endif
Packit Service c5cf8c
Packit Service c5cf8c
# We don't want to distribute these source files because they are created by
Packit Service c5cf8c
# "testmerge", hence "nodist_foo_SOURCES"
Packit Service c5cf8c
nodist_iwriteatf90_SOURCES     = iwriteatf90.f90
Packit Service c5cf8c
nodist_iwritef90_SOURCES       = iwritef90.f90
Packit Service c5cf8c
nodist_iwriteshf90_SOURCES     = iwriteshf90.f90
Packit Service c5cf8c
nodist_writeallbef90_SOURCES   = writeallbef90.f90
Packit Service c5cf8c
nodist_writeallf90_SOURCES     = writeallf90.f90
Packit Service c5cf8c
nodist_writeatallbef90_SOURCES = writeatallbef90.f90
Packit Service c5cf8c
nodist_writeatallf90_SOURCES   = writeatallf90.f90
Packit Service c5cf8c
nodist_writeatf90_SOURCES      = writeatf90.f90
Packit Service c5cf8c
nodist_writef90_SOURCES        = writef90.f90
Packit Service c5cf8c
nodist_writeordbef90_SOURCES   = writeordbef90.f90
Packit Service c5cf8c
nodist_writeordf90_SOURCES     = writeordf90.f90
Packit Service c5cf8c
nodist_writeshf90_SOURCES      = writeshf90.f90
Packit Service c5cf8c
nodist_iwriteatallf90_SOURCES  = iwriteatallf90.f90
Packit Service c5cf8c
Packit Service c5cf8c
c2f90multio_SOURCES     = c2f90multio.c
Packit Service c5cf8c
# this is a C only program, so we must either:
Packit Service c5cf8c
# A) prevent the makefile-wide "LDADD=mtestf90.o" from affecting this program, or
Packit Service c5cf8c
# B) link with the fortran compiler, otherwise we'll get link failures from
Packit Service c5cf8c
# compilers with runtime support libs, such as PGI
Packit Service c5cf8c
c2f90multio_LDADD = $(top_builddir)/util/mtest.o
Packit Service c5cf8c
Packit Service c5cf8c
c2f2ciof90_SOURCES = c2f2ciof90.f90 c2f902cio.c
Packit Service c5cf8c
Packit Service c5cf8c
## these header files will be distributed because they're listed in
Packit Service c5cf8c
## AC_CONFIG_FILES/AC_OUTPUT
Packit Service c5cf8c
Packit Service c5cf8c
# ensure that dependent tests will be rebuilt when headers are updated
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
# these files are genereated using testmerge (see below)
Packit Service c5cf8c
generated_io_sources = \
Packit Service c5cf8c
    iwriteatf90.f90        \
Packit Service c5cf8c
    iwriteatallf90.f90     \
Packit Service c5cf8c
    iwritef90.f90          \
Packit Service c5cf8c
    iwriteshf90.f90        \
Packit Service c5cf8c
    writeallbef90.f90      \
Packit Service c5cf8c
    writeallf90.f90        \
Packit Service c5cf8c
    writeatallbef90.f90    \
Packit Service c5cf8c
    writeatallf90.f90      \
Packit Service c5cf8c
    writeatf90.f90         \
Packit Service c5cf8c
    writef90.f90           \
Packit Service c5cf8c
    writeordbef90.f90      \
Packit Service c5cf8c
    writeordf90.f90        \
Packit Service c5cf8c
    writeshf90.f90
Packit Service c5cf8c
Packit Service c5cf8c
EXTRA_DIST += ioharness.defn ioharness.tlt
Packit Service c5cf8c
Packit Service c5cf8c
# a parallel-safe scheme to generate the tests, see the automake-1.11.1 manual,
Packit Service c5cf8c
# section 27.9 "Handling Tools That Produce Multiple Outputs" for an explanation
Packit Service c5cf8c
# 
Packit Service c5cf8c
# Note that using testmerge at make-time adds a dependency on perl for users.
Packit Service c5cf8c
# It's been like this for a long time, so I don't think it's a problem in
Packit Service c5cf8c
# practice.  The best way to fix this is to drop the nodist_foo_SOURCES lines,
Packit Service c5cf8c
# modify testmerge to output the stamp file, and then enclose modified versions
Packit Service c5cf8c
# of these rules in an "if MAINAINER_MODE".  The files also should then move to
Packit Service c5cf8c
# MAINTAINERCLEANFILES from DISTCLEANFILES. [goodell@ 2011-07-11]
Packit Service c5cf8c
gen-src-stamp: $(srcdir)/ioharness.defn $(srcdir)/ioharness.tlt
Packit Service c5cf8c
	@rm -f gen-src-tmp
Packit Service c5cf8c
	@touch gen-src-tmp
Packit Service c5cf8c
	$(top_builddir)/maint/testmerge -defn=$(top_srcdir)/maint/common.defn \
Packit Service c5cf8c
		$(srcdir)/ioharness.defn $(srcdir)/ioharness.tlt
Packit Service c5cf8c
	@mv -f gen-src-tmp $@
Packit Service c5cf8c
Packit Service c5cf8c
$(generated_io_sources): gen-src-stamp
Packit Service c5cf8c
## Recover from the removal of $@
Packit Service c5cf8c
	@if test -f $@; then :; else \
Packit Service c5cf8c
	  trap 'rm -rf gen-src-lock gen-src-stamp' 1 2 13 15; \
Packit Service c5cf8c
## mkdir is a portable test-and-set
Packit Service c5cf8c
	  if mkdir gen-src-lock 2>/dev/null; then \
Packit Service c5cf8c
## This code is being executed by the first process.
Packit Service c5cf8c
	    rm -f gen-src-stamp; \
Packit Service c5cf8c
	    $(MAKE) $(AM_MAKEFLAGS) gen-src-stamp; \
Packit Service c5cf8c
	    rmdir gen-src-lock; \
Packit Service c5cf8c
	  else \
Packit Service c5cf8c
## This code is being executed by the follower processes.
Packit Service c5cf8c
## Wait until the first process is done.
Packit Service c5cf8c
	    while test -d gen-src-lock; do sleep 1; done; \
Packit Service c5cf8c
## Succeed if and only if the first process succeeded.
Packit Service c5cf8c
	    test -f gen-src-stamp; exit $$?; \
Packit Service c5cf8c
	  fi; \
Packit Service c5cf8c
	fi
Packit Service c5cf8c
Packit Service c5cf8c
# just in case
Packit Service c5cf8c
CLEANFILES += gen-src-tmp gen-src-stamp
Packit Service c5cf8c
Packit Service c5cf8c
# clean up after the test programs
Packit Service c5cf8c
clean-local:
Packit Service c5cf8c
	-rm -f .iotest.txt.*
Packit Service c5cf8c
Packit Service c5cf8c
DISTCLEANFILES = $(generated_io_sources)
Packit Service c5cf8c
Packit Service c5cf8c
c2f902cio.c: $(srcdir)/../../f90/io/c2f902cio.c
Packit Service c5cf8c
	cp $(srcdir)/../../f90/io/c2f902cio.c c2f902cio.c