1 ## Makefile.am - template for generating Makefile via Automake
3 ## Copyright (C) 2000-2001, 2003-2010, 2013 Free Software Foundation,
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= $(config_aux_dir)/m4
26 SUBDIRS = po m4/gnu . tests/gnu
28 ACLOCAL_AMFLAGS = -I build-aux/m4
29 AUTOMAKE_OPTIONS = nostdinc
31 gitlog_to_changelog = $(srcdir)/$(config_aux_dir)/gitlog-to-changelog
32 git_log_fix = $(srcdir)/$(config_aux_dir)/git-log-fix
33 changelog = $(srcdir)/ChangeLog
34 changelog_old = $(srcdir)/ChangeLog.old
36 # Prime the variables that will be augmented by libtool.
37 # FIXME - the -export-symbols-regex ".*" is a hack to work around the
38 # fact that on cygwin, the convenience library libltdl exports symbols,
39 # which effectively disables the auto-exporting of all other symbols.
40 # Revisit this if libtool on cygwin improves.
41 # See http://lists.gnu.org/archive/html/libtool-patches/2007-02/msg00062.html
42 AM_CPPFLAGS = -I$(srcdir) -I.
43 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
44 AM_LDFLAGS = -export-dynamic -export-symbols-regex ".*"
50 MAINTAINERCLEANFILES =
57 # Additional configuration. Version management comes from suggestions
58 # given in build-aux/git-version-gen.
59 AM_CPPFLAGS += -Im4/gnu -I$(srcdir)/m4/gnu \
61 EXTRA_DIST += bootstrap cfg.mk maint.mk .version .prev-version \
62 $(config_macro_dir)/gnulib-cache.m4 $(gitlog_to_changelog)
63 BUILT_SOURCES += .version
65 echo $(VERSION) > $@-t && mv $@-t $@
66 dist-hook: dist-tarball-version
68 echo $(VERSION) > $(distdir)/.tarball-version
71 changelog_start_date = 2011-01-01
73 $(AM_V_GEN)if test -d '$(srcdir)/.git'; then \
74 $(gitlog_to_changelog) \
75 --since=$(changelog_start_date) > '$@T'; \
76 rm -f '$@'; mv '$@T' '$@'; \
77 cat '$(changelog_old)' >> '$@'; \
80 MAINTAINERCLEANFILES += \
81 ABOUT-NLS INSTALL Makefile.in aclocal.m4 \
82 config-h.in configure stamp-h.in \
83 po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
96 src/version-etc-fsf.c \
108 src_m4_SOURCES += src/stackovf.c
110 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
111 src_m4_LDFLAGS = $(AM_LDFLAGS) $(DLPREOPEN)
112 src_m4_LDADD = m4/libm4.la $(LTLIBICONV) $(LTLIBTHREAD)
113 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
116 ## --- PASTED MANUALLY FROM GNULIB --- ##
117 ## To avoid adding unnecessary objects to libm4.la these gnulib ##
118 ## modules are not imported by gnulib-tool, but added manually. ##
119 ## (from: gnulib-tool --extract-automake-snippet getopt-posix) ##
122 BUILT_SOURCES += src/$(GETOPT_H)
124 EXTRA_DIST += src/getopt.c src/getopt1.c src/getopt.in.h src/getopt_int.h
126 ARG_NONNULL_H = $(srcdir)/$(config_aux_dir)/arg-nonnull.h
128 # We need the following in order to create an <getopt.h> when the
129 # system doesn't have one that works with the given compiler.
130 src/getopt.h: src/getopt.in.h $(ARG_NONNULL_H)
131 $(AM_V_GEN)rm -f $@-t $@ && \
132 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
133 sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
134 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
135 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
136 -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
137 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
138 < $(srcdir)/src/getopt.in.h; \
141 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
143 ## --- END OF PASTED GNULIB --- ##
150 module_ldflags = -module $(AM_LDFLAGS)
151 module_libadd = m4/libm4.la
153 noinst_HEADERS = modules/m4.h
155 pkglib_LTLIBRARIES = \
158 modules/traditional.la
160 EXTRA_modules_gnu_la_SOURCES = modules/format.c
161 modules_gnu_la_LDFLAGS = $(module_ldflags)
162 modules_gnu_la_LIBADD = $(module_libadd)
163 EXTRA_DIST += $(EXTRA_modules_gnu_la_SOURCES)
165 EXTRA_modules_m4_la_SOURCES = modules/evalparse.c
166 modules_m4_la_LDFLAGS = $(module_ldflags)
167 modules_m4_la_LIBADD = $(module_libadd)
168 EXTRA_DIST += $(EXTRA_modules_m4_la_SOURCES)
170 modules_traditional_la_LDFLAGS = $(module_ldflags)
171 modules_traditional_la_LIBADD = $(module_libadd)
174 pkglib_LTLIBRARIES += modules/mpeval.la
175 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
176 modules_mpeval_la_LDFLAGS = $(module_ldflags)
177 modules_mpeval_la_LIBADD = $(module_libadd) $(LIBADD_GMP)
180 module_check = -rpath /dev/null
181 check_LTLIBRARIES = \
188 tests_import_la_LDFLAGS = $(module_ldflags) $(module_check)
189 tests_import_la_LIBADD = $(module_libadd)
190 tests_import_la_SOURCES = modules/import.c
192 tests_modtest_la_LDFLAGS = $(module_ldflags) $(module_check)
193 tests_modtest_la_LIBADD = $(module_libadd)
194 tests_modtest_la_SOURCES = modules/modtest.c
196 tests_shadow_la_LDFLAGS = $(module_ldflags) $(module_check)
197 tests_shadow_la_LIBADD = $(module_libadd)
198 tests_shadow_la_SOURCES = modules/shadow.c
200 tests_stdlib_la_LDFLAGS = $(module_ldflags) $(module_check)
201 tests_stdlib_la_LIBADD = $(module_libadd)
202 tests_stdlib_la_SOURCES = modules/stdlib.c
204 tests_time_la_LDFLAGS = $(module_ldflags) $(module_check)
205 tests_time_la_LIBADD = $(module_libadd)
206 tests_time_la_SOURCES = modules/time.c
213 lib_LTLIBRARIES += m4/libm4.la
215 nobase_include_HEADERS = \
219 m4_libm4_la_SOURCES = \
234 m4_libm4_la_LIBADD = m4/gnu/libgnu.la \
235 $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
236 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) m4/gnu/libgnu.la
238 # This file needs to be regenerated at configure time.
240 rm -f $(distdir)/m4/system.h
241 EXTRA_DIST += m4/system_.h
247 info_TEXINFOS = doc/m4.texi
248 m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl-1.3.texi doc/gpl-3.0.texi
249 dist_man_MANS = $(srcdir)/doc/m4.1
250 EXTRA_DIST += doc/gendocs_template
251 MAINTAINERCLEANFILES += doc/gendocs_template
252 HELP2MAN = $(SHELL) $(top_srcdir)/$(config_aux_dir)/missing --run help2man
254 # Build the man page once in the srcdir, rather than in every VPATH build
255 # dir, to match how automake builds info pages. This is safe for 'make
256 # distcheck' since it is distributed pre-built.
257 $(srcdir)/doc/m4.1: .version $(srcdir)/src/main.c
258 @echo "Updating the \`man' page \`$@'"; \
259 $(HELP2MAN) --name="macro processor" --source=FSF \
260 --info-page=m4 --output=$@ src/m4$(EXEEXT)
262 TAGS_FILES = $(infos_TEXINFOS)
263 TAGS_DEPENDENCIES = $(TAGS_FILES)
264 ETAGS_ARGS = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
266 MAINTAINERCLEANFILES += $(dist_man_MANS)
273 doc/examples/WWW/Makefile \
274 doc/examples/WWW/_footer.htm \
275 doc/examples/WWW/_header.htm \
276 doc/examples/WWW/m4lib/bugs.m4 \
277 doc/examples/WWW/m4lib/changelog.m4 \
278 doc/examples/WWW/m4lib/download.m4 \
279 doc/examples/WWW/m4lib/features.m4 \
280 doc/examples/WWW/m4lib/feedback.m4 \
281 doc/examples/WWW/m4lib/html.m4 \
282 doc/examples/WWW/m4lib/index.m4 \
283 doc/examples/WWW/m4lib/layout.m4 \
284 doc/examples/WWW/m4lib/lists.m4 \
285 doc/examples/WWW/m4lib/menu.m4 \
286 doc/examples/WWW/m4lib/modules.m4 \
287 doc/examples/WWW/m4lib/news.m4 \
288 doc/examples/WWW/m4lib/readme.m4 \
289 doc/examples/WWW/m4lib/setup.m4 \
290 doc/examples/WWW/m4lib/test.m4 \
291 doc/examples/WWW/m4lib/thanks.m4 \
292 doc/examples/WWW/m4lib/thissite.m4 \
293 doc/examples/WWW/m4lib/tmpl.m4 \
294 doc/examples/WWW/m4lib/todo.m4 \
295 doc/examples/WWW/m4lib/uses.m4 \
296 doc/examples/WWW/m4lib/visions.m4 \
297 doc/examples/WWW/m4lib/whatis.m4
299 dist_pkgdata_DATA = \
300 doc/examples/capitalize.m4 \
301 doc/examples/capitalize2.m4 \
302 doc/examples/comments.m4 \
303 doc/examples/curry.m4 \
304 doc/examples/ddivert.m4 \
305 doc/examples/debug.m4 \
306 doc/examples/esyscmd.m4 \
307 doc/examples/exp.m4 \
308 doc/examples/foreach.m4 \
309 doc/examples/foreach2.m4 \
310 doc/examples/foreachq.m4 \
311 doc/examples/foreachq2.m4 \
312 doc/examples/foreachq3.m4 \
313 doc/examples/foreachq4.m4 \
314 doc/examples/forloop.m4 \
315 doc/examples/forloop2.m4 \
316 doc/examples/forloop3.m4 \
317 doc/examples/fstab.m4 \
318 doc/examples/hanoi.m4 \
319 doc/examples/incl-test.m4 \
320 doc/examples/incl.m4 \
321 doc/examples/include.m4 \
322 doc/examples/indir.m4 \
323 doc/examples/join.m4 \
324 doc/examples/loop.m4 \
325 doc/examples/misc.m4 \
326 doc/examples/multiquotes.m4 \
327 doc/examples/patsubst.m4 \
328 doc/examples/pushpop.m4 \
329 doc/examples/quote.m4 \
330 doc/examples/regexp.m4 \
331 doc/examples/reverse.m4 \
332 doc/examples/stack.m4 \
333 doc/examples/stack_sep.m4 \
334 doc/examples/sysv-args.m4 \
335 doc/examples/trace.m4 \
336 doc/examples/translit.m4 \
337 doc/examples/undivert.incl \
338 doc/examples/undivert.m4 \
339 doc/examples/wrap.m4 \
340 doc/examples/wrapfifo.m4 \
341 doc/examples/wraplifo.m4 \
342 doc/examples/wraplifo2.m4
345 doc/examples/modtest.m4 \
346 doc/examples/shadow.m4 \
347 doc/examples/time.m4 \
348 doc/examples/time2.m4 \
349 doc/examples/stdlib.m4
355 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
356 # how `testsuite' appears in our dependencies.
357 TESTSUITE = $(srcdir)/tests/testsuite
361 $(srcdir)/tests/generated.at \
368 EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
371 $(srcdir)/tests/package.m4
373 # Using variables so that this snippet is not too wide and can
374 # be used as is in Texinfo @example/@end example.
375 m4_texi = $(srcdir)/doc/m4.texi
376 generate = $(AWK) -f $(srcdir)/tests/generate.awk
377 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texi)
378 $(generate) $(m4_texi) >$@t
381 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
382 AUTOTEST = $(AUTOM4TE) --language=autotest
383 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
384 $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
387 # The leading :; works around a bug in {}>f in some bash versions.
388 $(srcdir)/tests/package.m4: .version
391 echo '# Signature of the current package.'; \
392 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
393 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
394 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
395 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
396 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
397 } > $(srcdir)/tests/package.m4
399 tests/atconfig: config.status
400 $(SHELL) ./config.status tests/atconfig
401 DISTCLEANFILES += tests/atconfig
403 # Hook the test suite into the check rule
404 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
406 $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
408 # Run the test suite on the *installed* tree, including any renames
409 # the user requested.
410 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
412 $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
413 AUTOTEST_PATH="$(bindir)" \
414 M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
416 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
417 # will handle that, as part of making a release.
418 DISTCHECK_CONFIGURE_FLAGS = \
423 # We need to remove any file droppings left behind by testsuite.
425 test ! -f '$(srcdir)/tests/testsuite' || \
426 $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
428 OTHER_FILES = tests/iso8859.m4 tests/stackovf.test \
429 tests/null.m4 tests/null.out tests/null.err
431 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
432 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
434 clean-local: clean-local-tests