1 ## Makefile.am - template for generating Makefile via Automake
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free
4 ## Software Foundation, Inc.
6 ## This file is part of GNU M4.
8 ## GNU M4 is free software: you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation, either version 3 of the License, or
11 ## (at your option) any later version.
13 ## GNU M4 is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ## Written by Gary V. Vaughan <gary@gnu.org>
23 config_aux_dir = build-aux
24 config_macro_dir= ltdl/m4
26 SUBDIRS = po gnu . tests/gnu
28 ACLOCAL_AMFLAGS = -I ltdl/m4
29 AUTOMAKE_OPTIONS = nostdinc
31 # Prime the variables that will be augmented by libtool.
32 # FIXME - the -export-symbols-regex ".*" is a hack to work around the
33 # fact that on cygwin, the convenience library libltdl exports symbols,
34 # which effectively disables the auto-exporting of all other symbols.
35 # Revisit this if libtool on cygwin improves.
36 # See http://lists.gnu.org/archive/html/libtool-patches/2007-02/msg00062.html
38 AM_LDFLAGS = -export-dynamic -export-symbols-regex ".*"
50 # Include Libtool's rules.
51 include ltdl/Makefile.inc
53 # Additional configuration. Version management comes from suggestions
54 # given in build-aux/git-version-gen.
55 AM_CPPFLAGS += -Ignu -I$(srcdir)/gnu \
57 EXTRA_DIST += bootstrap cfg.mk maint.mk .version \
58 $(config_macro_dir)/gnulib-cache.m4
59 BUILT_SOURCES += .version
61 echo $(VERSION) > $@-t && mv $@-t $@
62 dist-hook: dist-tarball-version
64 echo $(VERSION) > $(distdir)/.tarball-version
65 MAINTAINERCLEANFILES = \
66 ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
67 config-h.in configure stamp-h.in \
68 po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
81 src/version-etc-fsf.c \
93 src_m4_SOURCES += src/stackovf.c
95 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
96 src_m4_LDFLAGS = $(AM_LDFLAGS) $(DLPREOPEN)
97 src_m4_LDADD = m4/libm4.la
98 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
101 ## --- PASTED MANUALLY FROM GNULIB --- ##
102 ## To avoid adding unnecessary objects to libm4.la these gnulib ##
103 ## modules are not imported by gnulib-tool, but added manually. ##
104 ## (from: gnulib-tool --extract-automake-snippet getopt version-etc) ##
106 BUILT_SOURCES += src/$(GETOPT_H)
107 EXTRA_DIST += src/getopt.in.h src/getopt_int.h
109 # We need the following in order to create an <getopt.h> when the
110 # system doesn't have one that works with the given compiler.
111 all-local: src/$(GETOPT_H)
112 src/getopt.h: src/getopt.in.h
113 cp $(srcdir)/src/getopt.in.h $@-t
115 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
117 ## --- END OF PASTED GNULIB --- ##
124 pkgmodincludedir= $(pkgincludedir)/modules
126 ETAGS_ARGS = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
128 module_ldflags = -module $(AM_LDFLAGS)
129 module_libadd = m4/libm4.la
131 pkgmodinclude_HEADERS = modules/m4.h
133 pkglibexec_LTLIBRARIES = \
137 modules/traditional.la
139 EXTRA_modules_gnu_la_SOURCES = modules/format.c
140 modules_gnu_la_LDFLAGS = $(module_ldflags)
141 modules_gnu_la_LIBADD = $(module_libadd)
142 EXTRA_DIST += $(EXTRA_modules_gnu_la_SOURCES)
144 modules_load_la_LDFLAGS = $(module_ldflags)
145 modules_load_la_LIBADD = $(module_libadd)
147 EXTRA_modules_m4_la_SOURCES = modules/evalparse.c
148 modules_m4_la_LDFLAGS = $(module_ldflags)
149 modules_m4_la_LIBADD = $(module_libadd)
150 EXTRA_DIST += $(EXTRA_modules_m4_la_SOURCES)
152 modules_traditional_la_LDFLAGS = $(module_ldflags)
153 modules_traditional_la_LIBADD = $(module_libadd)
156 pkglibexec_LTLIBRARIES += modules/mpeval.la
157 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
158 modules_mpeval_la_LDFLAGS = $(module_ldflags)
159 modules_mpeval_la_LIBADD = $(module_libadd) $(LIBADD_GMP)
162 ## Disabled for now. It is too fragile to be useful.
163 ## pkglibexec_LTLIBRARIES += modules/perl.la
164 ## modules_perl_la_CPPFLAGS = `$(PERL) -MExtUtils::Embed -e ccopts`
165 ## modules_perl_la_LDFLAGS = \
166 ## $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
167 ## modules_perl_la_LIBADD = $(module_libadd)
168 ## BUILT_SOURCES = perlxsi.c
169 ## DISTCLEANFILES += $(BUILT_SOURCES)
172 ## $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
174 ## but we should still distribute it, because it is listed in POTFILES.in:
175 EXTRA_DIST += modules/perl.c
177 module_check = -rpath /dev/null
178 check_LTLIBRARIES = \
185 tests_import_la_LDFLAGS = $(module_ldflags) $(module_check)
186 tests_import_la_LIBADD = $(module_libadd)
187 tests_import_la_SOURCES = modules/import.c
189 tests_modtest_la_LDFLAGS = $(module_ldflags) $(module_check)
190 tests_modtest_la_LIBADD = $(module_libadd)
191 tests_modtest_la_SOURCES = modules/modtest.c
193 tests_shadow_la_LDFLAGS = $(module_ldflags) $(module_check)
194 tests_shadow_la_LIBADD = $(module_libadd)
195 tests_shadow_la_SOURCES = modules/shadow.c
197 tests_stdlib_la_LDFLAGS = $(module_ldflags) $(module_check)
198 tests_stdlib_la_LIBADD = $(module_libadd)
199 tests_stdlib_la_SOURCES = modules/stdlib.c
201 tests_time_la_LDFLAGS = $(module_ldflags) $(module_check)
202 tests_time_la_LIBADD = $(module_libadd)
203 tests_time_la_SOURCES = modules/time.c
216 lib_LTLIBRARIES += m4/libm4.la
218 nobase_include_HEADERS = \
220 nobase_pkginclude_HEADERS = \
223 m4_libm4_la_SOURCES = \
238 m4_libm4_la_LIBADD = gnu/libgnu.la \
239 $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
240 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) gnu/libgnu.la
242 # This file needs to be regenerated at configure time.
244 rm -f $(distdir)/m4/system.h
245 EXTRA_DIST += m4/system_.h
252 info_TEXINFOS = doc/m4.texinfo
253 doc_m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl.texi doc/gpl-3.0.texi
254 dist_man_MANS = $(srcdir)/doc/m4.1
255 EXTRA_DIST += $(config_aux_dir)/gendocs.sh doc/gendocs_template
256 MAINTAINERCLEANFILES += $(config_aux_dir)/gendocs.sh doc/gendocs_template \
258 HELP2MAN = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run help2man
260 # Build the man page once in the srcdir, rather than in every VPATH build
261 # dir, to match how automake builds info pages. This is safe for 'make
262 # distcheck' since it is distributed pre-built.
263 $(srcdir)/doc/m4.1: .version src/main.c
264 @if test -f src/m4$(EXEEXT); then \
265 echo "Updating the \`man' page \`$@'"; \
266 $(HELP2MAN) --name="macro processor" --source=FSF \
267 --info-page=m4 --output=$@ src/m4$(EXEEXT); \
269 echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
270 echo " Retry once the program executable is ready."; \
273 ## Disabled for now. Clashes with earlier definition.
274 ## TAGS_FILES = $(infos_TEXINFOS)
275 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
276 ## ETAGS_ARGS = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
278 MAINTAINERCLEANFILES += $(dist_man_MANS)
286 examples/WWW/Makefile \
287 examples/WWW/_footer.htm \
288 examples/WWW/_header.htm \
289 examples/WWW/m4lib/bugs.m4 \
290 examples/WWW/m4lib/changelog.m4 \
291 examples/WWW/m4lib/download.m4 \
292 examples/WWW/m4lib/features.m4 \
293 examples/WWW/m4lib/feedback.m4 \
294 examples/WWW/m4lib/html.m4 \
295 examples/WWW/m4lib/index.m4 \
296 examples/WWW/m4lib/layout.m4 \
297 examples/WWW/m4lib/lists.m4 \
298 examples/WWW/m4lib/menu.m4 \
299 examples/WWW/m4lib/modules.m4 \
300 examples/WWW/m4lib/news.m4 \
301 examples/WWW/m4lib/readme.m4 \
302 examples/WWW/m4lib/setup.m4 \
303 examples/WWW/m4lib/test.m4 \
304 examples/WWW/m4lib/thanks.m4 \
305 examples/WWW/m4lib/thissite.m4 \
306 examples/WWW/m4lib/tmpl.m4 \
307 examples/WWW/m4lib/todo.m4 \
308 examples/WWW/m4lib/uses.m4 \
309 examples/WWW/m4lib/visions.m4 \
310 examples/WWW/m4lib/whatis.m4
312 dist_pkgdata_DATA = \
313 examples/capitalize.m4 \
314 examples/capitalize2.m4 \
315 examples/comments.m4 \
316 examples/ddivert.m4 \
318 examples/esyscmd.m4 \
320 examples/foreach.m4 \
321 examples/foreach2.m4 \
322 examples/foreachq.m4 \
323 examples/foreachq2.m4 \
324 examples/foreachq3.m4 \
325 examples/foreachq4.m4 \
326 examples/forloop.m4 \
327 examples/forloop2.m4 \
330 examples/incl-test.m4 \
332 examples/include.m4 \
337 examples/multiquotes.m4 \
338 examples/patsubst.m4 \
339 examples/pushpop.m4 \
342 examples/reverse.m4 \
343 examples/sysv-args.m4 \
345 examples/translit.m4 \
346 examples/undivert.incl \
347 examples/undivert.m4 \
349 examples/wrapfifo.m4 \
350 examples/wraplifo.m4 \
351 examples/wraplifo2.m4
357 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
358 # how `testsuite' appears in our dependencies.
359 TESTSUITE = $(srcdir)/tests/testsuite
363 $(srcdir)/tests/generated.at \
370 EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
373 $(srcdir)/tests/package.m4
375 # Be sure to reexport important environment variables:
376 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
377 CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
378 LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
379 OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
380 abs_top_builddir="$(abs_top_builddir)" \
381 CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
382 F77="$(F77)" FFLAGS="$(FFLAGS)" \
383 GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
385 # Using variables so that this snippet is not too wide and can
386 # be used as is in Texinfo @example/@end example.
387 m4_texinfo = $(srcdir)/doc/m4.texinfo
388 generate = $(AWK) -f $(srcdir)/tests/generate.awk
389 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
390 $(generate) $(m4_texinfo) >$@t
394 AUTOTEST = $(AUTOM4TE) --language=autotest
395 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
396 $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
399 # The leading :; works around a bug in {}>f in some bash versions.
400 $(srcdir)/tests/package.m4: .version
403 echo '# Signature of the current package.'; \
404 echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
405 echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
406 echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
407 echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
408 echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
409 } > $(srcdir)/tests/package.m4
411 tests/atconfig: config.status
412 $(SHELL) ./config.status tests/atconfig
413 DISTCLEANFILES += tests/atconfig
415 # Hook the test suite into the check rule
416 check-local: tests/atconfig tests/m4 $(TESTSUITE) $(check_LTLIBRARIES)
417 $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
418 $(TESTS_ENVIRONMENT) $(TESTSUITEFLAGS)
420 # Run the test suite on the *installed* tree, including any renames
421 # the user requested.
422 installcheck-local: tests/atconfig $(TESTSUITE) $(check_LTLIBRARIES)
423 $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
424 $(TESTS_ENVIRONMENT) AUTOTEST_PATH="$(bindir)" \
425 M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
427 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
428 # will handle that, as part of making a release.
429 DISTCHECK_CONFIGURE_FLAGS = --disable-assert --program-prefix=g
431 # We need to remove any file droppings left behind by testsuite.
433 test ! -f '$(srcdir)/tests/testsuite' || \
434 $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
436 OTHER_FILES = tests/iso8859.m4 tests/stackovf.test \
437 tests/null.m4 tests/null.out tests/null.err
439 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
440 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
442 clean-local: clean-local-tests