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= ltdl/m4
26 SUBDIRS = po gnu . doc tests/gnu
28 ACLOCAL_AMFLAGS = -I ltdl/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
43 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
44 AM_LDFLAGS = -export-dynamic -export-symbols-regex ".*"
56 # Include Libtool's rules.
57 include ltdl/Makefile.inc
59 # Additional configuration. Version management comes from suggestions
60 # given in build-aux/git-version-gen.
61 syntax_check_exceptions = \
62 .x-sc_cast_of_argument_to_free \
63 .x-sc_prohibit_tab_based_indentation \
64 .x-sc_require_config_h \
65 .x-sc_require_config_h_first \
68 AM_CPPFLAGS += -Ignu -I$(srcdir)/gnu \
70 EXTRA_DIST += bootstrap cfg.mk maint.mk .version .prev-version \
71 $(config_macro_dir)/gnulib-cache.m4 \
72 $(syntax_check_exceptions) $(gitlog_to_changelog)
73 BUILT_SOURCES += .version
75 echo $(VERSION) > $@-t && mv $@-t $@
76 dist-hook: dist-tarball-version
78 echo $(VERSION) > $(distdir)/.tarball-version
81 changelog_start_date = 2011-01-01
83 $(AM_V_GEN)if test -d '$(srcdir)/.git'; then \
84 $(gitlog_to_changelog) \
85 --since=$(changelog_start_date) > '$@T'; \
86 rm -f '$@'; mv '$@T' '$@'; \
87 cat '$(changelog_old)' >> '$@'; \
90 MAINTAINERCLEANFILES = \
91 ABOUT-NLS INSTALL Makefile.in aclocal.m4 \
92 config-h.in configure stamp-h.in \
93 po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
100 bin_PROGRAMS = src/m4
103 src/xstrtol-error.c \
106 src/version-etc-fsf.c \
118 src_m4_SOURCES += src/stackovf.c
120 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
121 src_m4_LDFLAGS = $(AM_LDFLAGS) $(DLPREOPEN)
122 src_m4_LDADD = m4/libm4.la $(LTLIBICONV) $(LTLIBTHREAD)
123 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
126 ## --- PASTED MANUALLY FROM GNULIB --- ##
127 ## To avoid adding unnecessary objects to libm4.la these gnulib ##
128 ## modules are not imported by gnulib-tool, but added manually. ##
129 ## (from: gnulib-tool --extract-automake-snippet getopt-posix) ##
132 BUILT_SOURCES += src/$(GETOPT_H)
134 EXTRA_DIST += src/getopt.c src/getopt1.c src/getopt.in.h src/getopt_int.h
136 ARG_NONNULL_H = $(srcdir)/$(config_aux_dir)/arg-nonnull.h
138 # We need the following in order to create an <getopt.h> when the
139 # system doesn't have one that works with the given compiler.
140 src/getopt.h: src/getopt.in.h $(ARG_NONNULL_H)
141 $(AM_V_GEN)rm -f $@-t $@ && \
142 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
143 sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
144 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
145 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
146 -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
147 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
148 < $(srcdir)/src/getopt.in.h; \
151 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
153 ## --- END OF PASTED GNULIB --- ##
160 pkgmodincludedir= $(pkgincludedir)/modules
162 ETAGS_ARGS = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
164 module_ldflags = -module $(AM_LDFLAGS)
165 module_libadd = m4/libm4.la
167 pkgmodinclude_HEADERS = modules/m4.h
169 pkglib_LTLIBRARIES = \
173 modules/traditional.la
175 EXTRA_modules_gnu_la_SOURCES = modules/format.c
176 modules_gnu_la_LDFLAGS = $(module_ldflags)
177 modules_gnu_la_LIBADD = $(module_libadd)
178 EXTRA_DIST += $(EXTRA_modules_gnu_la_SOURCES)
180 modules_load_la_LDFLAGS = $(module_ldflags)
181 modules_load_la_LIBADD = $(module_libadd)
183 EXTRA_modules_m4_la_SOURCES = modules/evalparse.c
184 modules_m4_la_LDFLAGS = $(module_ldflags)
185 modules_m4_la_LIBADD = $(module_libadd)
186 EXTRA_DIST += $(EXTRA_modules_m4_la_SOURCES)
188 modules_traditional_la_LDFLAGS = $(module_ldflags)
189 modules_traditional_la_LIBADD = $(module_libadd)
192 pkglib_LTLIBRARIES += modules/mpeval.la
193 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
194 modules_mpeval_la_LDFLAGS = $(module_ldflags)
195 modules_mpeval_la_LIBADD = $(module_libadd) $(LIBADD_GMP)
198 ## Disabled for now. It is too fragile to be useful.
199 ## pkglib_LTLIBRARIES += modules/perl.la
200 ## modules_perl_la_CPPFLAGS = `$(PERL) -MExtUtils::Embed -e ccopts`
201 ## modules_perl_la_LDFLAGS = \
202 ## $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
203 ## modules_perl_la_LIBADD = $(module_libadd)
204 ## BUILT_SOURCES = perlxsi.c
205 ## DISTCLEANFILES += $(BUILT_SOURCES)
208 ## $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
210 ## but we should still distribute it, because it is listed in POTFILES.in:
211 EXTRA_DIST += modules/perl.c
213 module_check = -rpath /dev/null
214 check_LTLIBRARIES = \
221 tests_import_la_LDFLAGS = $(module_ldflags) $(module_check)
222 tests_import_la_LIBADD = $(module_libadd)
223 tests_import_la_SOURCES = modules/import.c
225 tests_modtest_la_LDFLAGS = $(module_ldflags) $(module_check)
226 tests_modtest_la_LIBADD = $(module_libadd)
227 tests_modtest_la_SOURCES = modules/modtest.c
229 tests_shadow_la_LDFLAGS = $(module_ldflags) $(module_check)
230 tests_shadow_la_LIBADD = $(module_libadd)
231 tests_shadow_la_SOURCES = modules/shadow.c
233 tests_stdlib_la_LDFLAGS = $(module_ldflags) $(module_check)
234 tests_stdlib_la_LIBADD = $(module_libadd)
235 tests_stdlib_la_SOURCES = modules/stdlib.c
237 tests_time_la_LDFLAGS = $(module_ldflags) $(module_check)
238 tests_time_la_LIBADD = $(module_libadd)
239 tests_time_la_SOURCES = modules/time.c
246 lib_LTLIBRARIES += m4/libm4.la
248 nobase_include_HEADERS = \
250 nobase_pkginclude_HEADERS = \
253 m4_libm4_la_SOURCES = \
268 m4_libm4_la_LIBADD = gnu/libgnu.la \
269 $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
270 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) gnu/libgnu.la
272 # This file needs to be regenerated at configure time.
274 rm -f $(distdir)/m4/system.h
275 EXTRA_DIST += m4/system_.h
283 examples/WWW/Makefile \
284 examples/WWW/_footer.htm \
285 examples/WWW/_header.htm \
286 examples/WWW/m4lib/bugs.m4 \
287 examples/WWW/m4lib/changelog.m4 \
288 examples/WWW/m4lib/download.m4 \
289 examples/WWW/m4lib/features.m4 \
290 examples/WWW/m4lib/feedback.m4 \
291 examples/WWW/m4lib/html.m4 \
292 examples/WWW/m4lib/index.m4 \
293 examples/WWW/m4lib/layout.m4 \
294 examples/WWW/m4lib/lists.m4 \
295 examples/WWW/m4lib/menu.m4 \
296 examples/WWW/m4lib/modules.m4 \
297 examples/WWW/m4lib/news.m4 \
298 examples/WWW/m4lib/readme.m4 \
299 examples/WWW/m4lib/setup.m4 \
300 examples/WWW/m4lib/test.m4 \
301 examples/WWW/m4lib/thanks.m4 \
302 examples/WWW/m4lib/thissite.m4 \
303 examples/WWW/m4lib/tmpl.m4 \
304 examples/WWW/m4lib/todo.m4 \
305 examples/WWW/m4lib/uses.m4 \
306 examples/WWW/m4lib/visions.m4 \
307 examples/WWW/m4lib/whatis.m4
309 dist_pkgdata_DATA = \
310 examples/capitalize.m4 \
311 examples/capitalize2.m4 \
312 examples/comments.m4 \
314 examples/ddivert.m4 \
316 examples/esyscmd.m4 \
318 examples/foreach.m4 \
319 examples/foreach2.m4 \
320 examples/foreachq.m4 \
321 examples/foreachq2.m4 \
322 examples/foreachq3.m4 \
323 examples/foreachq4.m4 \
324 examples/forloop.m4 \
325 examples/forloop2.m4 \
326 examples/forloop3.m4 \
329 examples/incl-test.m4 \
331 examples/include.m4 \
336 examples/multiquotes.m4 \
337 examples/patsubst.m4 \
338 examples/pushpop.m4 \
341 examples/reverse.m4 \
343 examples/stack_sep.m4 \
344 examples/sysv-args.m4 \
346 examples/translit.m4 \
347 examples/undivert.incl \
348 examples/undivert.m4 \
350 examples/wrapfifo.m4 \
351 examples/wraplifo.m4 \
352 examples/wraplifo2.m4
355 examples/modtest.m4 \
365 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
366 # how `testsuite' appears in our dependencies.
367 TESTSUITE = $(srcdir)/tests/testsuite
371 $(srcdir)/tests/generated.at \
378 EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
381 $(srcdir)/tests/package.m4
383 # Using variables so that this snippet is not too wide and can
384 # be used as is in Texinfo @example/@end example.
385 m4_texi = $(srcdir)/doc/m4.texi
386 generate = $(AWK) -f $(srcdir)/tests/generate.awk
387 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texi)
388 $(generate) $(m4_texi) >$@t
391 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
392 AUTOTEST = $(AUTOM4TE) --language=autotest
393 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
394 $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
397 # The leading :; works around a bug in {}>f in some bash versions.
398 $(srcdir)/tests/package.m4: .version
401 echo '# Signature of the current package.'; \
402 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
403 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
404 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
405 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
406 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
407 } > $(srcdir)/tests/package.m4
409 tests/atconfig: config.status
410 $(SHELL) ./config.status tests/atconfig
411 DISTCLEANFILES += tests/atconfig
413 # Hook the test suite into the check rule
414 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
416 $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
418 # Run the test suite on the *installed* tree, including any renames
419 # the user requested.
420 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
422 $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
423 AUTOTEST_PATH="$(bindir)" \
424 M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
426 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
427 # will handle that, as part of making a release.
428 DISTCHECK_CONFIGURE_FLAGS = \
433 # We need to remove any file droppings left behind by testsuite.
435 test ! -f '$(srcdir)/tests/testsuite' || \
436 $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
438 OTHER_FILES = tests/iso8859.m4 tests/stackovf.test \
439 tests/null.m4 tests/null.out tests/null.err
441 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
442 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
444 clean-local: clean-local-tests