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

Packit 0848f5
# -*- Mode: Makefile; -*-
Packit 0848f5
# vim: set ft=automake :
Packit 0848f5
#
Packit 0848f5
# (C) 2011 by Argonne National Laboratory.
Packit 0848f5
#     See COPYRIGHT in top-level directory.
Packit 0848f5
#
Packit 0848f5
Packit 0848f5
include $(top_srcdir)/Makefile_f77.mtest
Packit 0848f5
Packit 0848f5
EXTRA_DIST = testlist.in
Packit 0848f5
Packit 0848f5
# avoid having to write many "foo_SOURCES = foo.f" lines
Packit 0848f5
AM_DEFAULT_SOURCE_EXT = .f
Packit 0848f5
Packit 0848f5
noinst_PROGRAMS = \
Packit 0848f5
    iwriteatf \
Packit 0848f5
    iwritef \
Packit 0848f5
    iwriteshf \
Packit 0848f5
    writef \
Packit 0848f5
    writeatf \
Packit 0848f5
    writeallf \
Packit 0848f5
    writeallbef \
Packit 0848f5
    writeordf \
Packit 0848f5
    writeordbef \
Packit 0848f5
    writeshf \
Packit 0848f5
    writeatallf \
Packit 0848f5
    writeatallbef \
Packit 0848f5
    fileerrf \
Packit 0848f5
    fileinfof \
Packit 0848f5
    shpositionf \
Packit 0848f5
    atomicityf \
Packit 0848f5
    miscfilef \
Packit 0848f5
    setviewcurf \
Packit 0848f5
    c2fmultio \
Packit 0848f5
    c2f2ciof
Packit 0848f5
Packit 0848f5
if BUILD_MPIX_TESTS
Packit 0848f5
noinst_PROGRAMS += \
Packit 0848f5
    i_setviewcurf  \
Packit 0848f5
    iwriteatallf
Packit 0848f5
endif
Packit 0848f5
Packit 0848f5
Packit 0848f5
# We don't want to distribute these source files because they are created by
Packit 0848f5
# "testmerge", hence "nodist_foo_SOURCES"
Packit 0848f5
nodist_iwriteatf_SOURCES     = iwriteatf.f
Packit 0848f5
nodist_iwriteatallf_SOURCES  = iwriteatallf.f
Packit 0848f5
nodist_iwritef_SOURCES       = iwritef.f
Packit 0848f5
nodist_iwriteshf_SOURCES     = iwriteshf.f
Packit 0848f5
nodist_writeallbef_SOURCES   = writeallbef.f
Packit 0848f5
nodist_writeallf_SOURCES     = writeallf.f
Packit 0848f5
nodist_writeatallbef_SOURCES = writeatallbef.f
Packit 0848f5
nodist_writeatallf_SOURCES   = writeatallf.f
Packit 0848f5
nodist_writeatf_SOURCES      = writeatf.f
Packit 0848f5
nodist_writef_SOURCES        = writef.f
Packit 0848f5
nodist_writeordbef_SOURCES   = writeordbef.f
Packit 0848f5
nodist_writeordf_SOURCES     = writeordf.f
Packit 0848f5
nodist_writeshf_SOURCES      = writeshf.f
Packit 0848f5
Packit 0848f5
c2fmultio_SOURCES     = c2fmultio.c
Packit 0848f5
# this is a C only program, so we must either:
Packit 0848f5
# A) prevent the makefile-wide "LDADD=mtestf.o" from affecting this program, or
Packit 0848f5
# B) link with the fortran compiler, otherwise we'll get link failures from
Packit 0848f5
# compilers with runtime support libs, such as PGI
Packit 0848f5
c2fmultio_LDADD =
Packit 0848f5
Packit 0848f5
c2f2ciof_SOURCES      = c2f2cio.c c2f2ciof.f
Packit 0848f5
Packit 0848f5
## these header files will be distributed because they're listed in
Packit 0848f5
## AC_CONFIG_FILES/AC_OUTPUT
Packit 0848f5
Packit 0848f5
# ensure that dependent tests will be rebuilt when headers are updated
Packit 0848f5
atomicityf.$(OBJEXT): iodisp.h
Packit 0848f5
iwriteatf.$(OBJEXT): iooffset.h
Packit 0848f5
iwritef.$(OBJEXT): iooffset.h
Packit 0848f5
miscfilef.$(OBJEXT): iooffset.h iodisp.h
Packit 0848f5
setviewcurf.$(OBJEXT): iooffset.h
Packit 0848f5
shpositionf.$(OBJEXT): iooffset.h ioaint.h
Packit 0848f5
writeallbef.$(OBJEXT): iooffset.h
Packit 0848f5
writeallf.$(OBJEXT): iooffset.h
Packit 0848f5
writeatallbef.$(OBJEXT): iooffset.h
Packit 0848f5
writeatallf.$(OBJEXT): iooffset.h
Packit 0848f5
writeatf.$(OBJEXT): iooffset.h
Packit 0848f5
writef.$(OBJEXT): iooffset.h
Packit 0848f5
writeordbef.$(OBJEXT): iooffset.h
Packit 0848f5
writeordf.$(OBJEXT): iooffset.h
Packit 0848f5
Packit 0848f5
Packit 0848f5
# these files are genereated using testmerge (see below)
Packit 0848f5
generated_io_sources = \
Packit 0848f5
    iwriteatf.f        \
Packit 0848f5
    iwriteatallf.f     \
Packit 0848f5
    iwritef.f          \
Packit 0848f5
    iwriteshf.f        \
Packit 0848f5
    writeallbef.f      \
Packit 0848f5
    writeallf.f        \
Packit 0848f5
    writeatallbef.f    \
Packit 0848f5
    writeatallf.f      \
Packit 0848f5
    writeatf.f         \
Packit 0848f5
    writef.f           \
Packit 0848f5
    writeordbef.f      \
Packit 0848f5
    writeordf.f        \
Packit 0848f5
    writeshf.f
Packit 0848f5
Packit 0848f5
EXTRA_DIST += ioharness.defn ioharness.tlt
Packit 0848f5
Packit 0848f5
# a parallel-safe scheme to generate the tests, see the automake-1.11.1 manual,
Packit 0848f5
# section 27.9 "Handling Tools That Produce Multiple Outputs" for an explanation
Packit 0848f5
# 
Packit 0848f5
# Note that using testmerge at make-time adds a dependency on perl for users.
Packit 0848f5
# It's been like this for a long time, so I don't think it's a problem in
Packit 0848f5
# practice.  The best way to fix this is to drop the nodist_foo_SOURCES lines,
Packit 0848f5
# modify testmerge to output the stamp file, and then enclose modified versions
Packit 0848f5
# of these rules in an "if MAINAINER_MODE".  The files also should then move to
Packit 0848f5
# MAINTAINERCLEANFILES from DISTCLEANFILES. [goodell@ 2011-07-11]
Packit 0848f5
gen-src-stamp: $(srcdir)/ioharness.defn $(srcdir)/ioharness.tlt
Packit 0848f5
	@rm -f gen-src-tmp
Packit 0848f5
	@touch gen-src-tmp
Packit 0848f5
	$(top_builddir)/maint/testmerge -defn=$(top_srcdir)/maint/common.defn \
Packit 0848f5
		$(srcdir)/ioharness.defn $(srcdir)/ioharness.tlt
Packit 0848f5
	@mv -f gen-src-tmp $@
Packit 0848f5
Packit 0848f5
$(generated_io_sources): gen-src-stamp
Packit 0848f5
## Recover from the removal of $@
Packit 0848f5
	@if test -f $@; then :; else \
Packit 0848f5
	  trap 'rm -rf gen-src-lock gen-src-stamp' 1 2 13 15; \
Packit 0848f5
## mkdir is a portable test-and-set
Packit 0848f5
	  if mkdir gen-src-lock 2>/dev/null; then \
Packit 0848f5
## This code is being executed by the first process.
Packit 0848f5
	    rm -f gen-src-stamp; \
Packit 0848f5
	    $(MAKE) $(AM_MAKEFLAGS) gen-src-stamp; \
Packit 0848f5
	    rmdir gen-src-lock; \
Packit 0848f5
	  else \
Packit 0848f5
## This code is being executed by the follower processes.
Packit 0848f5
## Wait until the first process is done.
Packit 0848f5
	    while test -d gen-src-lock; do sleep 1; done; \
Packit 0848f5
## Succeed if and only if the first process succeeded.
Packit 0848f5
	    test -f gen-src-stamp; exit $$?; \
Packit 0848f5
	  fi; \
Packit 0848f5
	fi
Packit 0848f5
Packit 0848f5
# just in case
Packit 0848f5
CLEANFILES += gen-src-tmp gen-src-stamp
Packit 0848f5
Packit 0848f5
# clean up after the test programs
Packit 0848f5
clean-local:
Packit 0848f5
	-rm -f .iotest.txt.*
Packit 0848f5
Packit 0848f5
DISTCLEANFILES = $(generated_io_sources)
Packit 0848f5