1##
2## Copyright (C) by Argonne National Laboratory
3##     See COPYRIGHT in top-level directory
4##
5
6ACLOCAL_AMFLAGS = -I confdb -I modules/hwloc/config
7
8# automake requires that we initialize variables to something, even just empty,
9# before appending to them with "+="
10AM_CFLAGS = @VISIBILITY_CFLAGS@ @HWLOC_EMBEDDED_CFLAGS@
11AM_CPPFLAGS = @HWLOC_EMBEDDED_CPPFLAGS@
12AM_FFLAGS =
13AM_FCFLAGS =
14include_HEADERS =
15nodist_include_HEADERS =
16nodist_noinst_HEADERS =
17BUILT_SOURCES =
18bin_PROGRAMS =
19bin_SCRIPTS =
20dist_noinst_SCRIPTS = autogen.sh
21noinst_DATA =
22dist_noinst_DATA =
23noinst_HEADERS =
24noinst_LIBRARIES =
25noinst_LTLIBRARIES =
26sysconf_DATA =
27nodist_pkgconfig_DATA =
28CLEANFILES =
29DISTCLEANFILES =
30MAINTAINERCLEANFILES =
31SUFFIXES =
32EXTRA_DIST =
33DOC_SUBDIRS =
34MANDOC_SUBDIRS =
35HTMLDOC_SUBDIRS =
36INSTALL_DATA_LOCAL_TARGETS =
37doc1_src_txt =
38doc3_src_txt =
39
40# add (+=) target names to this variable to add them to the dependencies of the
41# 'clean-local' target
42CLEAN_LOCAL_TARGETS =
43
44# used by nodist_pkgconfig_DATA
45pkgconfigdir = @pkgconfigdir@
46
47# contains all of the "errnames.txt" files that are used by maint/extracterrmsgs
48# to build src/mpi/errhan/defmsg.h
49errnames_txt_files =
50
51external_subdirs = @mplsrcdir@ @zmsrcdir@ @hwlocsrcdir@ @jsonsrcdir@ @yaksasrcdir@
52external_ldflags = @mpllibdir@ @zmlibdir@ @hwloclibdir@ @netloclibdir@ @yaksalibdir@
53external_libs = @WRAPPER_LIBS@
54mpi_convenience_libs =
55pmpi_convenience_libs = @mpllib@ @zmlib@ @hwloclib@ @jsonlib@ @yaksalib@
56
57# NOTE on our semi-unconventional usage of DIST_SUBDIRS:
58# The automake manual recommends thinking of DIST_SUBDIRS as the list of all
59# *configured* subdirectories.  The normal autotools model involves
60# unconditional configure steps for all/most directories with conditional make
61# steps (i.e., conditional inclusion in SUBDIRS).  But in the MPICH case we
62# almost always configure exactly the directories that will be included in
63# SUBDIRS.  So most additions to DIST_SUBDIRS should be conditional on the same
64# condition as the corresponding SUBDIRS addition.
65DIST_SUBDIRS = ${external_subdirs}
66SUBDIRS = ${external_subdirs}
67
68lib_lib@MPILIBNAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
69	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
70	$(lib_lib@MPILIBNAME@_la_CFLAGS) $(CFLAGS) \
71	$(lib_lib@MPILIBNAME@_la_LDFLAGS) $(LDFLAGS) -o $@
72lib_lib@PMPILIBNAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
73	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
74	$(lib_lib@PMPILIBNAME@_la_CFLAGS) $(CFLAGS) \
75	$(lib_lib@PMPILIBNAME@_la_LDFLAGS) $(LDFLAGS) -o $@
76
77if BUILD_F77_BINDING
78if BUILD_FC_BINDING
79lib_lib@MPIFCLIBNAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=FC \
80	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(FCLD) \
81	$(AM_FCFLAGS) $(FCFLAGS) $(lib_lib@MPIFCLIBNAME@_la_LDFLAGS) \
82	$(LDFLAGS) -o $@
83else !BUILD_FC_BINDING
84lib_lib@MPIFCLIBNAME@_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=F77 \
85	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(F77LD) \
86	$(AM_FFLAGS) $(FFLAGS) $(lib_lib@MPIFCLIBNAME@_la_LDFLAGS) \
87	$(LDFLAGS) -o $@
88endif !BUILD_FC_BINDING
89endif BUILD_F77_BINDING
90
91## Create lists of files for different libraries
92##
93## mpi_sources: When compiled with -DMPICH_MPI_FROM_PMPI, these files
94## provide "MPI_" public functions for the C bindings and end up in
95## lib@MPILIBNAME@.  When compiled without this macro, these files
96## provide "PMPI_" public functions for the C bindings as well as a
97## few other internal MPICH functions, all of which end up in
98## lib@PMPILIBNAME@ (which is the same as lib@MPILIBNAME@ on systems
99## that support weak symbols).
100##
101## mpi_f77_sources: When compiled with -DMPICH_MPI_FROM_PMPI, these
102## files provide the "mpi_" public functions for the F77 bindings and
103## end up in lib@MPIFCLIBNAME@.
104##
105## mpi_fc_sources: When compiled with -DMPICH_MPI_FROM_PMPI, these
106## files provide the "mpi_" public functions for the F90+ bindings and
107## end up in lib@MPIFCLIBNAME@.
108##
109## mpi_cxx_sources: When compiled with -DMPICH_MPI_FROM_PMPI, these
110## files provide the "MPI" public functions for the C++ bindings and
111## end up in lib@MPICXXLIBNAME@.
112##
113## mpi_core_sources: These files are internal non-public functions
114## that are used by all bindings.
115mpi_sources =
116mpi_f77_sources =
117mpi_fc_sources =
118mpi_fc_modules =
119mpi_cxx_sources =
120mpi_core_sources =
121
122lib_LTLIBRARIES =
123
124# include our subdir automake fragments
125include maint/Makefile.mk
126include src/Makefile.mk
127
128if BUILD_PROFILING_LIB
129# dropping mpi_fc_sources and mpi_cxx_sources from libmpmpi since they
130# don't contribute any PMPI symbols.
131lib_LTLIBRARIES += lib/lib@PMPILIBNAME@.la
132lib_lib@PMPILIBNAME@_la_SOURCES = $(mpi_sources) $(mpi_f77_sources) $(mpi_core_sources)
133lib_lib@PMPILIBNAME@_la_LDFLAGS = $(external_ldflags) $(ABIVERSIONFLAGS)
134lib_lib@PMPILIBNAME@_la_CPPFLAGS = $(AM_CPPFLAGS) -DF77_USE_PMPI
135lib_lib@PMPILIBNAME@_la_LIBADD = $(external_libs) $(pmpi_convenience_libs)
136EXTRA_lib_lib@PMPILIBNAME@_la_DEPENDENCIES = $(pmpi_convenience_libs)
137
138# lib@MPILIBNAME@.la might depend on lib@PMPILIBNAME@.la.  We add them
139# in that order to lib_LTLIBRARIES so libtool doesn't get
140# confused. (see https://bugzilla.redhat.com/show_bug.cgi?id=91110)
141lib_LTLIBRARIES += lib/lib@MPILIBNAME@.la
142lib_lib@MPILIBNAME@_la_SOURCES = $(mpi_sources)
143lib_lib@MPILIBNAME@_la_LDFLAGS = $(ABIVERSIONFLAGS)
144lib_lib@MPILIBNAME@_la_CPPFLAGS = $(AM_CPPFLAGS) -DMPICH_MPI_FROM_PMPI
145lib_lib@MPILIBNAME@_la_LIBADD = lib/lib@PMPILIBNAME@.la $(mpi_convenience_libs)
146
147else !BUILD_PROFILING_LIB
148
149lib_LTLIBRARIES += lib/lib@MPILIBNAME@.la
150lib_lib@MPILIBNAME@_la_SOURCES = $(mpi_sources) $(mpi_core_sources)
151lib_lib@MPILIBNAME@_la_LDFLAGS = $(external_ldflags) $(ABIVERSIONFLAGS)
152lib_lib@MPILIBNAME@_la_CPPFLAGS = $(AM_CPPFLAGS)
153lib_lib@MPILIBNAME@_la_LIBADD = $(external_libs) $(pmpi_convenience_libs) $(mpi_convenience_libs)
154EXTRA_lib_lib@MPILIBNAME@_la_DEPENDENCIES = $(pmpi_convenience_libs) $(mpi_convenience_libs)
155endif !BUILD_PROFILING_LIB
156
157if BUILD_F77_BINDING
158lib_LTLIBRARIES += lib/lib@MPIFCLIBNAME@.la
159lib_lib@MPIFCLIBNAME@_la_CPPFLAGS = $(AM_CPPFLAGS)
160if BUILD_PROFILING_LIB
161lib_lib@MPIFCLIBNAME@_la_CPPFLAGS += -DMPICH_MPI_FROM_PMPI -DUSE_ONLY_MPI_NAMES
162endif BUILD_PROFILING_LIB
163lib_lib@MPIFCLIBNAME@_la_SOURCES = $(mpi_f77_sources)
164if BUILD_FC_BINDING
165modinc_HEADERS = $(mpi_fc_modules)
166lib_lib@MPIFCLIBNAME@_la_SOURCES += $(mpi_fc_sources)
167endif BUILD_FC_BINDING
168lib_lib@MPIFCLIBNAME@_la_LDFLAGS = $(ABIVERSIONFLAGS)
169lib_lib@MPIFCLIBNAME@_la_LIBADD = lib/lib@MPILIBNAME@.la
170endif BUILD_F77_BINDING
171
172if BUILD_CXX_BINDING
173lib_LTLIBRARIES += lib/lib@MPICXXLIBNAME@.la
174lib_lib@MPICXXLIBNAME@_la_SOURCES = $(mpi_cxx_sources)
175lib_lib@MPICXXLIBNAME@_la_LDFLAGS = $(ABIVERSIONFLAGS)
176lib_lib@MPICXXLIBNAME@_la_LIBADD = lib/lib@MPILIBNAME@.la
177endif BUILD_CXX_BINDING
178
179# build the current directory and then the examples directory after everything else
180SUBDIRS += . examples
181DIST_SUBDIRS += . examples test
182
183EXTRA_DIST += README CHANGES COPYRIGHT README.envvar
184
185# README.vin is tricky, we don't actually distribute it when we use release.pl,
186# but we do need to distribute it in order for ./autogen.sh to work
187# correctly on a distribution tarball.  For now we distribute it when we "make
188# dist".
189EXTRA_DIST += README.vin
190
191testing:
192	( cd test && $(MAKE) $(AM_MAKEFLAGS) testing )
193
194test-clean:
195	( cd test && $(MAKE) $(AM_MAKEFLAGS) clean )
196CLEAN_LOCAL_TARGETS += test-clean
197
198## FIXME: this should live in src/env/Makefile.mk. Moving it there
199## will not cause a problem, but it will break the build if another
200## Makefile.mk also decides to create a install-exec-hook target. A
201## better approach might be to have each Makefile.mk append to a
202## common set of rules.
203install-exec-hook:
204	for e in ${DESTDIR}${bindir}/@MPICC_NAME@ ${DESTDIR}${bindir}/@MPICXX_NAME@ \
205		${DESTDIR}${bindir}/@MPIF77_NAME@ ${DESTDIR}${bindir}/@MPIFORT_NAME@ ; do \
206		if test -e $${e} ; then \
207			sed -e 's|__PREFIX_TO_BE_FILLED_AT_INSTALL_TIME__|${prefix}|g' \
208				-e 's|__EXEC_PREFIX_TO_BE_FILLED_AT_INSTALL_TIME__|${exec_prefix}|g' \
209				-e 's|__SYSCONFDIR_TO_BE_FILLED_AT_INSTALL_TIME__|${sysconfdir}|g' \
210				-e 's|__INCLUDEDIR_TO_BE_FILLED_AT_INSTALL_TIME__|${includedir}|g' \
211				-e 's|__LIBDIR_TO_BE_FILLED_AT_INSTALL_TIME__|${libdir}|g' $${e} > $${e}.tmp ; \
212			$(INSTALL_SCRIPT) $${e}.tmp $${e} ; \
213			rm -f $${e}.tmp ; \
214		fi ; \
215	done ; \
216	if test -e ${DESTDIR}${bindir}/@MPICXX_NAME@ ; then \
217		if test "@MPICXX_NAME@" != "@MPICPP_NAME@" ; then \
218			cd ${DESTDIR}${bindir} && ln -f -s @MPICXX_NAME@ @MPICPP_NAME@ ; \
219		fi ; \
220	fi ; \
221	if test -e ${DESTDIR}${bindir}/@MPIFORT_NAME@ ; then \
222		if test "@MPIFORT_NAME@" != "@MPIF90_NAME@" ; then \
223			cd ${DESTDIR}${bindir} && ln -f -s @MPIFORT_NAME@ @MPIF90_NAME@ ; \
224		fi ; \
225	fi ; \
226	if test -e ${DESTDIR}${bindir}/@MPIFORT_NAME@ -a ! -e ${DESTDIR}${bindir}/@MPIF77_NAME@ ; then \
227		if test "@MPIFORT_NAME@" != "@MPIF77_NAME@" ; then \
228			cd ${DESTDIR}${bindir} && ln -f -s @MPIFORT_NAME@ @MPIF77_NAME@ ; \
229		fi ; \
230	fi ; \
231	if test -e ${DESTDIR}${libdir}/lib@MPILIBNAME@@SHLIB_EXT@ ; then \
232		if test "@MPILIBNAME@" != "mpl" ; then \
233			cd ${DESTDIR}${libdir} && ln -f -s lib@MPILIBNAME@@SHLIB_EXT@ libmpl@SHLIB_EXT@ ; \
234		fi ; \
235		if test "@MPILIBNAME@" != "opa" ; then \
236			cd ${DESTDIR}${libdir} && ln -f -s lib@MPILIBNAME@@SHLIB_EXT@ libopa@SHLIB_EXT@ ; \
237		fi ; \
238		if test "@MPILIBNAME@" != "mpich" ; then \
239			cd ${DESTDIR}${libdir} && ln -f -s lib@MPILIBNAME@@SHLIB_EXT@ libmpich@SHLIB_EXT@ ; \
240		fi ; \
241	fi ; \
242	if test -e ${DESTDIR}${libdir}/lib@MPIFCLIBNAME@@SHLIB_EXT@ ; then \
243		if test "@MPIFCLIBNAME@" != "fmpich" ; then \
244			cd ${DESTDIR}${libdir} && ln -f -s lib@MPIFCLIBNAME@@SHLIB_EXT@ libfmpich@SHLIB_EXT@ ; \
245		fi ; \
246		if test "@MPIFCLIBNAME@" != "mpichf90" ; then \
247			cd ${DESTDIR}${libdir} && ln -f -s lib@MPIFCLIBNAME@@SHLIB_EXT@ libmpichf90@SHLIB_EXT@ ; \
248		fi ; \
249	fi ; \
250	if test -e ${DESTDIR}${libdir}/lib@MPICXXLIBNAME@@SHLIB_EXT@ ; then \
251		if test "@MPICXXLIBNAME@" != "mpichcxx" ; then \
252			cd ${DESTDIR}${libdir} && ln -f -s lib@MPICXXLIBNAME@@SHLIB_EXT@ libmpichcxx@SHLIB_EXT@ ; \
253		fi ; \
254	fi
255
256# the configure step checks for the 'lib' dir to decide whether a source
257# directory has been previously used for an in-path build before allowing a
258# VPATH build to continue
259distclean-local:
260	-rm -rf $(top_builddir)/lib
261	-rm -rf $(top_builddir)/bin
262	-rm -rf $(top_builddir)/include
263	-rm -rf $(top_builddir)/share
264
265# created by confdb/aclocal_cache.m4
266DISTCLEANFILES += config.system
267
268# we can only have one clean-local, so we hook into it via conditionally
269# defined variables in the dependencies section
270clean-local: $(CLEAN_LOCAL_TARGETS)
271
272uninstall-local:
273	for x in @MPICPP_NAME@ @MPIF90_NAME@ @MPIF77_NAME@ ; do \
274		rm -f ${DESTDIR}${bindir}/$$x ; \
275	done ; \
276	for x in mpl opa mpich fmpich mpichf90 mpichcxx ; do \
277		rm -f ${DESTDIR}${libdir}/lib$$x@SHLIB_EXT@ ; \
278	done
279
280# --------------------------------------------------------------------------
281#  coverage rules
282# --------------------------------------------------------------------------
283
284.PHONY: coverage
285
286if BUILD_COVERAGE
287
288# $(lib_lib@MPILIBNAME@_la_SOURCES) already contains $(mpi_sources)
289# We don't include the $(lib_lib@PMPILIBNAME@_la_SOURCES) here because of gcov's
290# inability to correctly handle multiple object files with the same source file.
291gcov_sources = $(lib_lib@MPILIBNAME@_la_SOURCES)
292
293# local var meaning (for profiling foo/bar/baz.c):
294#   dir=foo/bar
295#   bname=baz.c
296#   aux=baz
297#
298# Note that we delete all extra ".gcov" files that were not the direct goal,
299# even though they contain useful information.  A more robust solution is needed
300# in the long run, probably one that uses "--long-file-names --preserve-paths"
301# and some postprocessing in a perl script.
302#
303# Gcov has no good way to deal with source files that have been compiled twice
304# into two different object files, such as
305#   bcast.c --> {bcast.o,lib_libpmpi_la-bcast.o}
306# It still generates a bcast.c.gcov output for each object file.  Long file
307# names and preserved paths do not help with this problem.
308# What we can do in this case is to move the second files to a separate
309# directory, rename name, and run gcov on the new files.
310# For the web-based coverage reports, the gcov output for the two files
311# needs to be merged; see maint/gcovmerge .
312# To make it easier to re-run the coverage generation, we copy, rather than
313# move, when there are two object files for each source file.
314# A change to the build procedure broke this target.  This is a partial though
315# nearly complete fix to the broken build process.  The generated coverage
316# files after the fix appear mostly correct, though there appear to also be
317# errors in the gcov output itself (the format of this output changes
318# frequently).  However, the coverage analysis is still valuable and has
319# identified missing tests.
320#
321# The problem:
322#   The source file is foo.c
323#   gcov expects foo.o, foo.gcno, and foo.gcda files
324#   The MPICH build process, unfortunately, does not produce a foo.o file;
325#   instead, it produces a .libs/lib_lib@MPILIBNAME@_la-foo.o file (and
326#   similarly .libs/lib_lib@MPILIBNAME@_la_foo.gcno etc.
327#   This change broke this coverage target.  If further changes to the
328#   naming conventions for object files are made, make sure that the
329#   coverage target is also modified to correspond to those changes.
330#
331coverage:
332	@for file in $(gcov_sources) ; do \
333	    dir=`dirname $$file` ; \
334	    bname=`basename $$file` ; \
335	    aux=`echo $$bname | sed -e 's,\.*$$,,'` ; \
336	    sname=`echo $$bname | sed -e 's/\.[^\.]*$$//'` ;\
337	    if [ -s "$$dir/$$sname.o" ] ; then \
338	        echo "( $(GCOV) -b -f -o $$file $$file && mv $$bname.gcov $$dir )" ; \
339	        ( $(GCOV) -b -f -o $$file $$file && mv $$bname.gcov $$dir ) ; \
340	    elif [ -s "$$dir/lib_lib@MPILIBNAME@_la-$$sname.o" ] ; then \
341	        if [ ! -d $$dir-mpi ] ; then mkdir $$dir-mpi ; fi ; \
342		echo "Copying name-mangled files to $$dir-mpi" ; \
343		for pfile in $$dir/.libs/lib_lib@MPILIBNAME@_la-$$sname.* ; do \
344		     nfile=`echo $$pfile | sed -e 's/lib_lib@MPILIBNAME@_la-//'` ;\
345		     nfile=`basename $$nfile` ; \
346		     echo "cp -p $$pfile $$dir-mpi/$$nfile" ; \
347		     cp -p $$pfile $$dir-mpi/$$nfile ; \
348		done ; \
349		for pfile in $$dir/lib_lib@MPILIBNAME@_la-$$sname.o ; do \
350		     nfile=`echo $$pfile | sed -e 's/lib_lib@MPILIBNAME@_la-//'` ;\
351		     nfile=`basename $$nfile` ; \
352		     echo "( cd $$dir-mpi && $(GCOV) -b -f $$nfile )" ; \
353		     ( cd $$dir-mpi && $(GCOV) -b -f $$nfile ) ; \
354		     if [ ! -s $$dir-mpi/$$bname.gcov ] ; then \
355			echo "No $$bname.gcov file created" ;\
356		     else \
357		        mv $$dir-mpi/$$bname.gcov $$dir ; \
358		     fi ; \
359		done ; \
360	    else \
361		echo "Missing object file for source $$file" ; \
362	    fi ; \
363	    if [ -s "$$dir/lib_lib@PMPILIBNAME@_la-$$sname.o" ] ; then \
364	        if [ ! -d $$dir-pmpi ] ; then mkdir $$dir-pmpi ; fi ; \
365		echo "Copying name-mangled files to $$dir-pmpi" ; \
366		for pfile in $$dir/.libs/lib_lib@PMPILIBNAME@_la-$$sname.* ; do \
367		     nfile=`echo $$pfile | sed -e 's/lib_lib@PMPILIBNAME@_la-//'` ;\
368		     nfile=`basename $$nfile` ; \
369		     echo "cp -p $$pfile $$dir-pmpi/$$nfile" ; \
370		     cp -p $$pfile $$dir-pmpi/$$nfile ; \
371		done ; \
372		for pfile in $$dir/lib_lib@PMPILIBNAME@_la-$$sname.o ; do \
373		     nfile=`echo $$pfile | sed -e 's/lib_lib@PMPILIBNAME@_la-//'` ;\
374		     nfile=`basename $$nfile` ; \
375		     echo "( cd $$dir-pmpi && $(GCOV) -b -f $$nfile )" ; \
376		     ( cd $$dir-pmpi && $(GCOV) -b -f $$nfile ) ; \
377		     if [ -s $$dir/$$bname.gcov ] ; then \
378		         echo "gcovmerge $$dir-pmpi/$$bname.gcov $$dir/$$bname.gcov > $$dir/$$bname.gcov.merge" ; \
379		         $(srcdir)/maint/gcovmerge $$dir-pmpi/$$bname.gcov \
380				$$dir/$$bname.gcov > $$dir/$$bname.gcov.merge ;\
381		     else \
382			 echo "Did not find file $$dir/$$bname.gcov" ; \
383		         echo "mv $$dir-pmpi/$$bname.gcov $$dir/$$bname.gcov";\
384			 mv $$dir-pmpi/$$bname.gcov $$dir/$$bname.gcov ; \
385		     fi ;\
386		done ; \
387	    fi ; \
388	    rm -f *.gcov ; \
389	done
390	for subdir in $(SUBDIRS) - ; do \
391	    if test "x$$subdir" = "x-" ; then break ; fi ; \
392## SUBDIRS contains "."
393	    if test "x$$subdir" = "x." ; then \
394	        : ; \
395	    else \
396		if grep coverage: $$subdir/Makefile >/dev/null 2>&1 ; then  \
397	           ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) coverage ) ; \
398		fi \
399	    fi \
400	done
401
402CLEAN_LOCAL_TARGETS += coverage-clean
403# heavy handed, but it gets the job done
404coverage-clean:
405	-find $(top_builddir) -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" | \
406	    xargs -n 10 rm -f
407
408else !BUILD_COVERAGE
409coverage:
410	@echo 'ERROR: MPICH was not configured with "--enable-coverage"'
411	exit 1
412endif !BUILD_COVERAGE
413
414# --------------------------------------------------------------------------
415#  documentation rules
416# --------------------------------------------------------------------------
417
418# Tell make (via the automake SUFFIXES var) that our phony suffixes exist and
419# should be considered when dissecting suffix-based implicit rules.  These phony
420# suffix files should NOT be added to a .PHONY target, otherwise make will not
421# use the implicit rules to attempt to build them.
422SUFFIXES += .man-phony .html-phony .man1-phony .html1-phony .man3-phony .html3-phony .txt
423
424# "make V=1" support for our documentation recipes
425doctextman_verbose = $(doctextman_verbose_$(V))
426doctextman_verbose_ = $(doctextman_verbose_$(AM_DEFAULT_VERBOSITY))
427doctextman_verbose_0 = @echo "   DOCTEXTMAN  " $@;
428doctexthtml_verbose = $(doctexthtml_verbose_$(V))
429doctexthtml_verbose_ = $(doctexthtml_verbose_$(AM_DEFAULT_VERBOSITY))
430doctexthtml_verbose_0 = @echo "   DOCTEXTHTML  " $@;
431
432# build dir paths for doc generation, used to override subdir (esp. ROMIO) doc
433# generation locations/options
434mandoc_path1=$(abs_top_builddir)/man/man1
435mandoc_path3=$(abs_top_builddir)/man/man3
436htmldoc_path1=$(abs_top_builddir)/www/www1
437htmldoc_path3=$(abs_top_builddir)/www/www3
438doctext_docnotes=$(abs_top_srcdir)/maint/docnotes
439# Provide an easily replaced url root for the generated index file.
440# You can override this with URL desired in the index file generated by doctext.
441# You can ignore this if you don't use mapnames or tohtml to add links
442# to the MPI manual pages to documents.
443htmldoc_root3="--your-url-here--"
444
445# Implicit suffix rules to cause the docs to be built.  These are a bit of a
446# hack, but using the implicit rules like this instead of a shell for loop
447# permits make -jN to work.
448.c.man-phony:
449	$(doctextman_verbose)$(DOCTEXT) -man -mpath $(mandoc_path3) -ext 3 \
450	    -heading MPI -quotefmt -nolocation $(doctext_docnotes) $<
451.c.html-phony:
452	$(doctexthtml_verbose)$(DOCTEXT) -html -mpath $(htmldoc_path3) \
453	    -heading MPI -quotefmt -nolocation \
454	    -index $(htmldoc_path3)/mpi.cit -indexdir $(htmldoc_root3) \
455		$(doctext_docnotes) $<
456
457.txt.man1-phony:
458	$(doctextman_verbose)$(DOCTEXT) -man -mpath $(mandoc_path1) -ext 1 \
459	    -heading MPI -quotefmt -nolocation $(doctext_docnotes) $<
460.txt.html1-phony:
461	$(doctexthtml_verbose)$(DOCTEXT) -html -mpath $(htmldoc_path1) \
462	    -heading MPI -quotefmt -nolocation $(doctext_docnotes) $<
463.txt.man3-phony:
464	$(doctextman_verbose)$(DOCTEXT) -man -mpath $(mandoc_path3) -ext 3 \
465	    -heading MPI -quotefmt -nolocation $(doctext_docnotes) $<
466.txt.html3-phony:
467	$(doctexthtml_verbose)$(DOCTEXT) -html -mpath $(htmldoc_path3) \
468	    -heading MPI -quotefmt -nolocation \
469	    -index $(htmldoc_path3)/mpi.cit -indexdir $(htmldoc_root3) \
470		$(doctext_docnotes) $<
471
472# use mandoc-local target to force directory creation before running DOCTEXT
473mandoc:
474	test -d $(mandoc_path1) || $(MKDIR_P) $(mandoc_path1)
475	test -d $(mandoc_path3) || $(MKDIR_P) $(mandoc_path3)
476	$(MAKE) $(AM_MAKEFLAGS) mandoc-local
477mandoc-local: $(mpi_sources:.c=.man-phony) $(doc1_src_txt:.txt=.man1-phony) \
478	$(doc3_src_txt:.txt=.man3-phony)
479	for subdir in $(MANDOC_SUBDIRS) - ; do \
480	    if test "x$$subdir" = "x-" ; then break ; fi ; \
481## MANDOC_SUBDIRS might accidentally contain "."
482	    if test "x$$subdir" = "x." ; then \
483	        : ; \
484	    else \
485		if grep 'mandoc:' $$subdir/Makefile >/dev/null 2>&1 ; then  \
486## make 'mandoc' in subdirectory but tell sub-make to output to the top-level
487	           ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) \
488			mandoc_path1=$(mandoc_path1) \
489			mandoc_path3=$(mandoc_path3) \
490			doctext_docnotes=$(doctext_docnotes) \
491			mandoc ) ; \
492		fi \
493	    fi \
494	done
495#      FIXME: the 'mancnst' script need to be committed for this to work
496#      (cd $(abs_top_builddir) && $(abs_top_srcdir)/doc/mansrc/mancnst)
497
498# use htmldoc-local target to force directory creation before running DOCTEXT
499# Note that the mpi.cit is appended to by each update, so it must be removed
500# and recreated when the documentation files are updated
501htmldoc:
502	test -d $(top_builddir)/www/www1 || $(MKDIR_P) $(top_builddir)/www/www1
503	test -d $(top_builddir)/www/www3 || $(MKDIR_P) $(top_builddir)/www/www3
504	rm -f $(htmldoc_path3)/mpi.cit
505	$(MAKE) $(AM_MAKEFLAGS) htmldoc-local
506
507htmldoc-local: $(mpi_sources:.c=.html-phony) $(doc1_src_txt:.txt=.html1-phony) \
508	$(doc3_src_txt:.txt=.html3-phony)
509	for subdir in $(HTMLDOC_SUBDIRS) - ; do \
510	    if test "x$$subdir" = "x-" ; then break ; fi ; \
511## HTMLDOC_SUBDIRS might accidentally contain "."
512	    if test "x$$subdir" = "x." ; then \
513	        : ; \
514	    else \
515		if grep 'htmldoc:' $$subdir/Makefile >/dev/null 2>&1 ; then  \
516## make 'htmldoc' in subdirectory but tell sub-make to output to the top-level
517	           ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) \
518			htmldoc_path1=$(htmldoc_path1) \
519			htmldoc_path3=$(htmldoc_path3) \
520			doctext_docnotes=$(doctext_docnotes) \
521			htmldoc ) ; \
522		fi \
523	    fi \
524	done
525	$(srcdir)/maint/createhtmlindex -wwwroot=$(top_builddir)
526
527# install-man does not have a special "-local" target for some reason
528INSTALL_DATA_LOCAL_TARGETS += install-man-local
529# this is a variation on the recipe that was previously generated by simplemake
530install-man-local:
531	@dir= ; \
532	if test -d $(builddir)/man ; then \
533	 dir=$(builddir)/man ; \
534	elif test -d $(srcdir)/man ; then \
535	 dir=$(srcdir)/man ; \
536	fi ; \
537	export dir ; \
538	if test ! -z $$dir && test -d $$dir && cd $$dir ; then \
539	 for name in * ; do \
540	  if [ "$$name" = "*" ] ; then continue ; fi ; \
541	  if [ -f $$name ] ; then \
542	    echo "$(INSTALL_DATA) $$name ${DESTDIR}${mandir}/$$name" ; \
543	    $(INSTALL_DATA) $$name ${DESTDIR}${mandir}/$$name ; \
544	  elif [ -d $$name ] ; then \
545	    if [ ! -d ${DESTDIR}${mandir}/$$name ] ; then $(MKDIR_P) ${DESTDIR}${mandir}/$$name ; fi ;\
546	    ( cd $$name && for name2 in * ; do \
547	        if [ "$$name2" = "*" ] ; then continue ; fi ; \
548	        if [ -f $$name2 ] ; then \
549	            echo "$(INSTALL_DATA) $$name2 ${DESTDIR}${mandir}/$$name/$$name2" ; \
550	            $(INSTALL_DATA) $$name2 ${DESTDIR}${mandir}/$$name/$$name2 ; \
551	        elif [ -d $$name2 ] ; then  \
552	            echo "cp -rp $$name2 ${DESTDIR}${mandir}/$$name" ; \
553	            cp -rp $$name2 ${DESTDIR}${mandir}/$$name ; \
554	        fi \
555	    done ) ; \
556	  else \
557	    echo "Unknown file type for $$name" ; \
558	  fi ; \
559	 done ; \
560	fi
561
562INSTALL_DATA_LOCAL_TARGETS += install-html-local
563install-html-local:
564	@dir= ; \
565	if test -d $(builddir)/www ; then \
566	 dir=$(builddir)/www ; \
567	elif test -d $(srcdir)/www ; then \
568	 dir=$(srcdir)/www ; \
569	fi ; \
570	export dir ; \
571	if test ! -z $$dir && test -d $$dir && cd $$dir ; then \
572	 if [ ! -e ${DESTDIR}${htmldir} ] ; then $(MKDIR_P) ${DESTDIR}${htmldir} ; fi ; \
573	 for name in * ; do \
574	  if [ "$$name" = "*" ] ; then continue ; fi ; \
575	  if [ -f $$name ] ; then \
576	    echo "$(INSTALL_DATA) $$name ${DESTDIR}${htmldir}/$$name" ; \
577	    $(INSTALL_DATA) $$name ${DESTDIR}${htmldir}/$$name ; \
578	  elif [ -d $$name ] ; then \
579	    if [ ! -d ${DESTDIR}${htmldir}/$$name ] ; then $(MKDIR_P) ${DESTDIR}${htmldir}/$$name ; fi ;\
580	    ( cd $$name && for name2 in * ; do \
581	        if [ "$$name2" = "*" ] ; then continue ; fi ; \
582	        if [ -f $$name2 ] ; then \
583	            echo "$(INSTALL_DATA) $$name2 ${DESTDIR}${htmldir}/$$name/$$name2" ; \
584	            $(INSTALL_DATA) $$name2 ${DESTDIR}${htmldir}/$$name/$$name2 ; \
585	        elif [ -d $$name2 ] ; then  \
586	            echo "cp -rp $$name2 ${DESTDIR}${htmldir}/$$name" ; \
587	            cp -rp $$name2 ${DESTDIR}${htmldir}/$$name ; \
588	        fi \
589	    done ) ; \
590	  else \
591	    echo "Unknown file type for $$name" ; \
592	  fi ; \
593	 done ; \
594	fi
595
596.PHONY: mandoc mandoc-local htmldoc htmldoc-local install-html-local install-man-local
597
598# build the latex docs in the old style
599latexdoc:
600	for dir in $(DOC_SUBDIRS) ; do \
601		(cd $$dir && ${MAKE} latexdoc ) ; done
602
603# install-pdf will not be run by default in a "make install" unless we do this
604INSTALL_DATA_LOCAL_TARGETS += install-pdf-local
605# note that these PDFs are currently built in the srcdir, even in a VPATH
606# build...
607install-pdf-local:
608	if [ ! -e ${DESTDIR}${docdir} ] ; then $(MKDIR_P) ${DESTDIR}${docdir} ; fi
609	if [ -s $(srcdir)/doc/userguide/user.pdf ] ; then $(INSTALL_DATA) $(srcdir)/doc/userguide/user.pdf ${DESTDIR}${docdir}/user.pdf ; fi
610	if [ -s $(srcdir)/doc/installguide/install.pdf ] ; then $(INSTALL_DATA) $(srcdir)/doc/installguide/install.pdf ${DESTDIR}${docdir}/install.pdf ; fi
611	if [ -s $(srcdir)/doc/logging/logging.pdf ] ; then $(INSTALL_DATA) $(srcdir)/doc/logging/logging.pdf ${DESTDIR}${docdir}/logging.pdf ; fi
612
613include $(top_srcdir)/doc/Makefile.mk
614
615# use the _TARGETS var as a workaround for being unable to define multiple
616# -local targets
617install-data-local: $(INSTALL_DATA_LOCAL_TARGETS)
618
619
620# sometimes helpful when debugging macros to see the preprocessed output.
621# Also using '-CC' because comments provide useful landmarks
622
623SUFFIXES += .i
624
625.c.i:
626	$(COMPILE) -CC -E -o $@ $<
627