1 ## Makefile.am - template for generating Makefile via Automake
3 ## Copyright (C) 2000-2001, 2003-2010, 2013-2014 Free Software
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 . doc 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 thanks_gen = $(srcdir)/$(config_aux_dir)/thanks-gen
35 changelog = $(distdir)/ChangeLog
36 changelog_old = $(srcdir)/ChangeLog.old
37 thanks = $(distdir)/THANKS
38 no_thanks = $(srcdir)/NO-THANKS
40 # Prime the variables that will be augmented by libtool.
41 # FIXME - the -export-symbols-regex ".*" is a hack to work around the
42 # fact that on cygwin, the convenience library libltdl exports symbols,
43 # which effectively disables the auto-exporting of all other symbols.
44 # Revisit this if libtool on cygwin improves.
45 # See http://lists.gnu.org/archive/html/libtool-patches/2007-02/msg00062.html
46 AM_CPPFLAGS = -I$(srcdir) -I.
47 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
48 AM_LDFLAGS = -no-undefined -export-dynamic -export-symbols-regex ".*"
54 MAINTAINERCLEANFILES =
62 # Additional configuration. Version management comes from suggestions
63 # given in build-aux/git-version-gen.
64 AM_CPPFLAGS += -Im4/gnu -I$(srcdir)/m4/gnu \
66 AM_LDFLAGS += $(OS2_LDFLAGS)
67 EXTRA_DIST += bootstrap cfg.mk maint.mk .version .prev-version \
68 $(config_macro_dir)/gnulib-cache.m4 $(gitlog_to_changelog)
69 BUILT_SOURCES += .version
71 echo $(VERSION) > $@-t && mv $@-t $@
72 dist-hook: dist-tarball-version
74 echo $(VERSION) > $(distdir)/.tarball-version
76 dist-hook: $(changelog)
77 changelog_start_date = 2011-01-01
79 $(AM_V_GEN)if test -d '$(srcdir)/.git'; then \
80 $(gitlog_to_changelog) \
81 --since=$(changelog_start_date) > '$@T'; \
82 rm -f '$@'; mv '$@T' '$@'; \
83 cat '$(changelog_old)' >> '$@'; \
86 # Sort in traditional ASCII order, regardless of the current locale;
87 # otherwise we may get into trouble with distinct strings that the
88 # current locale considers to be equal.
89 ASSORT = LC_ALL=C sort
91 # Extract all lines up to the first one starting with "##".
92 prologue = perl -ne '/^\#\#/ and exit; print' $(no_thanks)
94 # Generate THANKS using git log entries as far as possible, fixing
95 # up ommisions and errors from NO-THANKS configuration.
97 $(AM_V_GEN)if test -d '$(srcdir)/.git'; then \
100 { perl -ne '/^$$/.../^$$/ and print' $(no_thanks) \
101 | grep -v '^$$' | perl -pe 's/ +/\0/'; \
102 { sed -e '1,/\#\# /d' -e '/^\#\# /d' \
103 -e 's|[ ][ ]*| |' < $(no_thanks) \
105 git log --pretty=format:'%aN%x00%aE'; \
108 | LC_ALL=en_US.UTF-8 sort -f; \
110 printf ';; %s\n' 'Local Variables:' 'coding: utf-8' End:; \
114 MAINTAINERCLEANFILES += \
115 ABOUT-NLS INSTALL Makefile.in aclocal.m4 \
116 config-h.in configure stamp-h.in \
117 po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
124 bin_PROGRAMS = src/m4
127 src/xstrtol-error.c \
130 src/version-etc-fsf.c \
142 src_m4_SOURCES += src/stackovf.c
144 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
145 src_m4_LDFLAGS = $(AM_LDFLAGS) $(DLPREOPEN)
146 src_m4_LDADD = m4/libm4.la $(LTLIBICONV) $(LTLIBTHREAD)
147 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
150 ## --- PASTED MANUALLY FROM GNULIB --- ##
151 ## To avoid adding unnecessary objects to libm4.la these gnulib ##
152 ## modules are not imported by gnulib-tool, but added manually. ##
153 ## (from: gnulib-tool --extract-automake-snippet getopt-posix) ##
156 BUILT_SOURCES += src/$(GETOPT_H)
158 EXTRA_DIST += src/getopt.c src/getopt1.c src/getopt.in.h src/getopt_int.h
160 ARG_NONNULL_H = $(srcdir)/$(config_aux_dir)/arg-nonnull.h
162 # We need the following in order to create an <getopt.h> when the
163 # system doesn't have one that works with the given compiler.
164 src/getopt.h: src/getopt.in.h $(ARG_NONNULL_H)
165 $(AM_V_GEN)rm -f $@-t $@ && \
166 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
167 sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
168 -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
169 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
170 -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
171 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
172 < $(srcdir)/src/getopt.in.h; \
175 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
177 ## --- END OF PASTED GNULIB --- ##
184 module_ldflags = -avoid-version -module $(AM_LDFLAGS)
185 module_libadd = m4/libm4.la
187 noinst_HEADERS = modules/m4.h
191 pkglib_LTLIBRARIES += modules/gnu.la
192 EXTRA_modules_gnu_la_SOURCES = modules/format.c
193 modules_gnu_la_LDFLAGS = $(module_ldflags)
194 modules_gnu_la_LIBADD = $(module_libadd)
195 EXTRA_DIST += $(EXTRA_modules_gnu_la_SOURCES)
197 pkglib_LTLIBRARIES += modules/m4.la
198 EXTRA_modules_m4_la_SOURCES = modules/evalparse.c
199 modules_m4_la_LDFLAGS = $(module_ldflags)
200 modules_m4_la_LIBADD = $(module_libadd)
201 EXTRA_DIST += $(EXTRA_modules_m4_la_SOURCES)
204 pkglib_LTLIBRARIES += modules/mpeval.la
205 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
206 modules_mpeval_la_LDFLAGS = $(module_ldflags)
207 modules_mpeval_la_LIBADD = $(module_libadd) $(LIBADD_GMP)
210 pkglib_LTLIBRARIES += modules/stdlib.la
211 modules_stdlib_la_LDFLAGS = $(module_ldflags)
212 modules_stdlib_la_LIBADD = $(module_libadd)
214 pkglib_LTLIBRARIES += modules/time.la
215 modules_time_la_LDFLAGS = $(module_ldflags)
216 modules_time_la_LIBADD = $(module_libadd)
218 pkglib_LTLIBRARIES += modules/traditional.la
219 modules_traditional_la_LDFLAGS = $(module_ldflags)
220 modules_traditional_la_LIBADD = $(module_libadd)
227 lib_LTLIBRARIES += m4/libm4.la
229 nobase_include_HEADERS = \
233 m4_libm4_la_SOURCES = \
248 m4_libm4_la_LIBADD = m4/gnu/libgnu.la \
249 $(LTLIBINTL) $(LIBADD_DLOPEN)
250 m4_libm4_la_DEPENDENCIES = m4/gnu/libgnu.la
252 # This file needs to be regenerated at configure time.
254 rm -f $(distdir)/m4/system.h
255 EXTRA_DIST += m4/system_.h
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 module_check = -rpath /dev/null
375 check_LTLIBRARIES += tests/import.la
376 tests_import_la_LDFLAGS = $(module_ldflags) $(module_check)
377 tests_import_la_LIBADD = $(module_libadd)
379 check_LTLIBRARIES += tests/modtest.la
380 tests_modtest_la_LDFLAGS = $(module_ldflags) $(module_check)
381 tests_modtest_la_LIBADD = $(module_libadd)
383 check_LTLIBRARIES += tests/shadow.la
384 tests_shadow_la_LDFLAGS = $(module_ldflags) $(module_check)
385 tests_shadow_la_LIBADD = $(module_libadd)
387 # Using variables so that this snippet is not too wide and can
388 # be used as is in Texinfo @example/@end example.
389 m4_texi = $(srcdir)/doc/m4.texi
391 generate = $(AWK) -f $(srcdir)/tests/generate.awk
392 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texi)
393 $(generate) $(m4_texi) >$@t
396 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
397 AUTOTEST = $(AUTOM4TE) --language=autotest
398 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
399 $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
402 # The leading :; works around a bug in {}>f in some bash versions.
403 $(srcdir)/tests/package.m4: .version
406 echo '# Signature of the current package.'; \
407 echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \
408 echo 'm4_define([AT_PACKAGE_TARNAME], [$(PACKAGE_TARNAME)])'; \
409 echo 'm4_define([AT_PACKAGE_VERSION], [$(PACKAGE_VERSION)])'; \
410 echo 'm4_define([AT_PACKAGE_STRING], [$(PACKAGE_STRING)])'; \
411 echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
412 } > $(srcdir)/tests/package.m4
414 tests/atconfig: config.status
415 $(SHELL) ./config.status tests/atconfig
416 DISTCLEANFILES += tests/atconfig
418 # Hook the test suite into the check rule
419 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
421 $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
423 # Run the test suite on the *installed* tree, including any renames
424 # the user requested.
425 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
427 $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
428 AUTOTEST_PATH="$(bindir)" \
429 M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
431 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
432 # will handle that, as part of making a release.
433 DISTCHECK_CONFIGURE_FLAGS = \
438 # We need to remove any file droppings left behind by testsuite.
440 test ! -f '$(srcdir)/tests/testsuite' || \
441 $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
443 OTHER_FILES = tests/iso8859.m4 tests/stackovf.test \
444 tests/null.m4 tests/null.out tests/null.err
446 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
447 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
449 clean-local: clean-local-tests