1 ## Makefile.am - template for generating Makefile via Automake
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4 ## Free 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 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-1.3.texi doc/gpl-3.0.texi
254 dist_man_MANS = $(srcdir)/doc/m4.1
255 EXTRA_DIST += doc/gendocs_template
256 MAINTAINERCLEANFILES += doc/gendocs_template
257 HELP2MAN = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run help2man
259 # Build the man page once in the srcdir, rather than in every VPATH build
260 # dir, to match how automake builds info pages. This is safe for 'make
261 # distcheck' since it is distributed pre-built.
262 $(srcdir)/doc/m4.1: .version src/main.c
263 @if test -f src/m4$(EXEEXT); then \
264 echo "Updating the \`man' page \`$@'"; \
265 $(HELP2MAN) --name="macro processor" --source=FSF \
266 --info-page=m4 --output=$@ src/m4$(EXEEXT); \
268 echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
269 echo " Retry once the program executable is ready."; \
272 ## Disabled for now. Clashes with earlier definition.
273 ## TAGS_FILES = $(infos_TEXINFOS)
274 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
275 ## ETAGS_ARGS = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
277 MAINTAINERCLEANFILES += $(dist_man_MANS)
285 examples/WWW/Makefile \
286 examples/WWW/_footer.htm \
287 examples/WWW/_header.htm \
288 examples/WWW/m4lib/bugs.m4 \
289 examples/WWW/m4lib/changelog.m4 \
290 examples/WWW/m4lib/download.m4 \
291 examples/WWW/m4lib/features.m4 \
292 examples/WWW/m4lib/feedback.m4 \
293 examples/WWW/m4lib/html.m4 \
294 examples/WWW/m4lib/index.m4 \
295 examples/WWW/m4lib/layout.m4 \
296 examples/WWW/m4lib/lists.m4 \
297 examples/WWW/m4lib/menu.m4 \
298 examples/WWW/m4lib/modules.m4 \
299 examples/WWW/m4lib/news.m4 \
300 examples/WWW/m4lib/readme.m4 \
301 examples/WWW/m4lib/setup.m4 \
302 examples/WWW/m4lib/test.m4 \
303 examples/WWW/m4lib/thanks.m4 \
304 examples/WWW/m4lib/thissite.m4 \
305 examples/WWW/m4lib/tmpl.m4 \
306 examples/WWW/m4lib/todo.m4 \
307 examples/WWW/m4lib/uses.m4 \
308 examples/WWW/m4lib/visions.m4 \
309 examples/WWW/m4lib/whatis.m4
311 dist_pkgdata_DATA = \
312 examples/capitalize.m4 \
313 examples/capitalize2.m4 \
314 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 \
328 examples/forloop3.m4 \
331 examples/incl-test.m4 \
333 examples/include.m4 \
338 examples/multiquotes.m4 \
339 examples/patsubst.m4 \
340 examples/pushpop.m4 \
343 examples/reverse.m4 \
345 examples/stack_sep.m4 \
346 examples/sysv-args.m4 \
348 examples/translit.m4 \
349 examples/undivert.incl \
350 examples/undivert.m4 \
352 examples/wrapfifo.m4 \
353 examples/wraplifo.m4 \
354 examples/wraplifo2.m4
360 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
361 # how `testsuite' appears in our dependencies.
362 TESTSUITE = $(srcdir)/tests/testsuite
366 $(srcdir)/tests/generated.at \
373 EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
376 $(srcdir)/tests/package.m4
378 # Using variables so that this snippet is not too wide and can
379 # be used as is in Texinfo @example/@end example.
380 m4_texinfo = $(srcdir)/doc/m4.texinfo
381 generate = $(AWK) -f $(srcdir)/tests/generate.awk
382 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
383 $(generate) $(m4_texinfo) >$@t
386 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
387 AUTOTEST = $(AUTOM4TE) --language=autotest
388 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
389 $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
392 # The leading :; works around a bug in {}>f in some bash versions.
393 $(srcdir)/tests/package.m4: .version
396 echo '# Signature of the current package.'; \
397 echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
398 echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
399 echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
400 echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
401 echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
402 } > $(srcdir)/tests/package.m4
404 tests/atconfig: config.status
405 $(SHELL) ./config.status tests/atconfig
406 DISTCLEANFILES += tests/atconfig
408 # Hook the test suite into the check rule
409 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
411 $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
413 # Run the test suite on the *installed* tree, including any renames
414 # the user requested.
415 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
417 $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
418 AUTOTEST_PATH="$(bindir)" \
419 M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
421 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
422 # will handle that, as part of making a release.
423 DISTCHECK_CONFIGURE_FLAGS = --disable-assert --program-prefix=g
425 # We need to remove any file droppings left behind by testsuite.
427 test ! -f '$(srcdir)/tests/testsuite' || \
428 $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
430 OTHER_FILES = tests/iso8859.m4 tests/stackovf.test \
431 tests/null.m4 tests/null.out tests/null.err
433 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
434 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
436 clean-local: clean-local-tests