Fix regression in argument collection, from 2008-01-21.
[m4/ericb.git] / Makefile.am
blob2ef72617981c36ae652c08e6e48113810cdf9a04
1 ## Makefile.am - template for generating Makefile via Automake
2 ##
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008 Free
4 ## Software Foundation, Inc.
5 ##
6 ## This file is part of GNU M4.
7 ##
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
37 AM_CPPFLAGS     =
38 AM_LDFLAGS      = -export-dynamic -export-symbols-regex ".*"
39 EXTRA_DIST      =
40 BUILT_SOURCES   =
41 CLEANFILES      =
42 DISTCLEANFILES  =
43 MOSTLYCLEANFILES=
45 include_HEADERS =
46 noinst_LTLIBRARIES=
47 lib_LTLIBRARIES =
48 EXTRA_LTLIBRARIES=
50 # Include Libtool's rules.
51 include ltdl/Makefile.inc
53 # Additional configuration.
54 AM_CPPFLAGS    += -Ignu -I$(srcdir)/gnu \
55                   -Im4 -I$(srcdir)/m4
56 EXTRA_DIST     += bootstrap \
57                   $(config_aux_dir)/mkstamp \
58                   $(config_macro_dir)/gnulib-cache.m4
59 MAINTAINERCLEANFILES = \
60                   ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
61                   config-h.in configure stamp-h.in \
62                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
64 MKSTAMP = $(SHELL) $(srcdir)/$(config_aux_dir)/mkstamp
66 # Make sure config.status is regenerated when the version timestamp changes
67 CONFIG_STATUS_DEPENDENCIES = ChangeLog
70 ## ------- ##
71 ## GNU M4. ##
72 ## ------- ##
74 bin_PROGRAMS    = src/m4
75 src_m4_SOURCES  = \
76                   src/xstrtoul.c \
77                   src/xstrtol-error.c \
78                   src/xstrtol.c \
79                   src/xstrtol.h \
80                   src/version-etc-fsf.c \
81                   src/version-etc.c \
82                   src/version-etc.h \
83                   src/main.c \
84                   src/m4.h \
85                   src/freeze.c
86 if GETOPT
87 src_m4_SOURCES += \
88                   src/getopt.c \
89                   src/getopt1.c
90 endif
91 if STACKOVF
92 src_m4_SOURCES += src/stackovf.c
93 endif
94 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
95 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
96 src_m4_LDADD    = m4/libm4.la
97 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
99 ##                                                                      ##
100 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
101 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
102 ##     modules are not imported by gnulib-tool, but added manually.     ##
103 ##  (from: gnulib-tool --extract-automake-snippet getopt version-etc)   ##
104 ##                                                                      ##
105 BUILT_SOURCES  += src/$(GETOPT_H)
106 EXTRA_DIST     += src/getopt.in.h src/getopt_int.h
108 # We need the following in order to create an <getopt.h> when the
109 # system doesn't have one that works with the given compiler.
110 all-local: src/$(GETOPT_H)
111 src/getopt.h: src/getopt.in.h
112         cp $(srcdir)/src/getopt.in.h $@-t
113         mv $@-t $@
114 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
115 ##                                                                      ##
116 ##                     --- END OF PASTED GNULIB ---                     ##
117 ##                                                                      ##
119 ## -------- ##
120 ## Modules. ##
121 ## -------- ##
123 pkgmodincludedir= $(pkgincludedir)/modules
125 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
127 module_ldflags  = -module $(AM_LDFLAGS)
128 module_libadd   = m4/libm4.la
130 pkgmodinclude_HEADERS = modules/m4.h
132 pkglibexec_LTLIBRARIES = \
133                   modules/gnu.la \
134                   modules/load.la \
135                   modules/m4.la \
136                   modules/traditional.la
138 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
139 modules_gnu_la_LDFLAGS          = $(module_ldflags)
140 modules_gnu_la_LIBADD           = $(module_libadd)
141 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
143 modules_load_la_LDFLAGS         = $(module_ldflags)
144 modules_load_la_LIBADD          = $(module_libadd)
146 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
147 modules_m4_la_LDFLAGS           = $(module_ldflags)
148 modules_m4_la_LIBADD            = $(module_libadd)
149 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
151 modules_traditional_la_LDFLAGS  = $(module_ldflags)
152 modules_traditional_la_LIBADD   = $(module_libadd)
154 if USE_GMP
155 pkglibexec_LTLIBRARIES         += modules/mpeval.la
156 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
157 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
158 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
159 endif
161 ## Disabled for now.  It is too fragile to be useful.
162 ## pkglibexec_LTLIBRARIES         += modules/perl.la
163 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
164 ## modules_perl_la_LDFLAGS              = \
165 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
166 ## modules_perl_la_LIBADD               = $(module_libadd)
167 ## BUILT_SOURCES                        = perlxsi.c
168 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
170 ## perlxsi.c:
171 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
173 ## but we should still distribute it, because it is listed in POTFILES.in:
174 EXTRA_DIST += modules/perl.c
176 module_check    = -rpath /dev/null
177 check_LTLIBRARIES = \
178                   tests/import.la \
179                   tests/modtest.la \
180                   tests/shadow.la \
181                   tests/stdlib.la \
182                   tests/time.la
184 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
185 tests_import_la_LIBADD          = $(module_libadd)
186 tests_import_la_SOURCES         = modules/import.c
188 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
189 tests_modtest_la_LIBADD         = $(module_libadd)
190 tests_modtest_la_SOURCES        = modules/modtest.c
192 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
193 tests_shadow_la_LIBADD          = $(module_libadd)
194 tests_shadow_la_SOURCES         = modules/shadow.c
196 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
197 tests_stdlib_la_LIBADD          = $(module_libadd)
198 tests_stdlib_la_SOURCES         = modules/stdlib.c
200 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
201 tests_time_la_LIBADD            = $(module_libadd)
202 tests_time_la_SOURCES           = modules/time.c
204 EXTRA_DIST     += \
205                   modules/modtest.m4 \
206                   modules/shadow.m4 \
207                   modules/time.m4 \
208                   modules/time2.m4 \
209                   modules/stdlib.m4
211 ## ----- ##
212 ## libm4 ##
213 ## ----- ##
215 lib_LTLIBRARIES += m4/libm4.la
217 nobase_include_HEADERS = \
218                   m4/m4module.h
219 nobase_pkginclude_HEADERS = \
220                   m4/hash.h \
221                   m4/system.h
222 m4_libm4_la_SOURCES     = \
223                   m4/builtin.c \
224                   m4/debug.c \
225                   m4/hash.c \
226                   m4/input.c \
227                   m4/m4.c \
228                   m4/m4private.h \
229                   m4/macro.c \
230                   m4/module.c \
231                   m4/output.c \
232                   m4/path.c \
233                   m4/resyntax.c \
234                   m4/symtab.c \
235                   m4/syntax.c \
236                   m4/utility.c
237 m4_libm4_la_LIBADD = gnu/libgnu.la \
238                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
239 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) gnu/libgnu.la
241 # This file needs to be regenerated at configure time.
242 dist-hook:
243         rm -f $(distdir)/m4/system.h
244 EXTRA_DIST     += m4/system_.h
247 ## -------------- ##
248 ## Documentation. ##
249 ## -------------- ##
251 info_TEXINFOS   = doc/m4.texinfo
252 doc_m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl.texi doc/gpl-3.0.texi
253 dist_man_MANS   = $(srcdir)/doc/m4.1
254 EXTRA_DIST     += $(config_aux_dir)/gendocs.sh doc/gendocs_template
255 MAINTAINERCLEANFILES += $(config_aux_dir)/gendocs.sh doc/gendocs_template \
256                   doc/fdl.texi
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: configure.ac 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); \
267         else \
268           echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
269           echo "         Retry once the program executable is ready."; \
270         fi
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)
280 ## --------- ##
281 ## Examples. ##
282 ## --------- ##
284 EXTRA_DIST     += \
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 \
315                   examples/ddivert.m4 \
316                   examples/debug.m4 \
317                   examples/esyscmd.m4 \
318                   examples/exp.m4 \
319                   examples/foreach.m4 \
320                   examples/foreach2.m4 \
321                   examples/foreachq.m4 \
322                   examples/foreachq2.m4 \
323                   examples/foreachq3.m4 \
324                   examples/forloop.m4 \
325                   examples/forloop2.m4 \
326                   examples/fstab.m4 \
327                   examples/hanoi.m4 \
328                   examples/incl-test.m4 \
329                   examples/incl.m4 \
330                   examples/include.m4 \
331                   examples/indir.m4 \
332                   examples/loop.m4 \
333                   examples/misc.m4 \
334                   examples/multiquotes.m4 \
335                   examples/patsubst.m4 \
336                   examples/pushpop.m4 \
337                   examples/quote.m4 \
338                   examples/regexp.m4 \
339                   examples/reverse.m4 \
340                   examples/sysv-args.m4 \
341                   examples/trace.m4 \
342                   examples/translit.m4 \
343                   examples/undivert.incl \
344                   examples/undivert.m4 \
345                   examples/wrap.m4
347 ## ----------- ##
348 ## Test suite. ##
349 ## ----------- ##
351 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
352 # how `testsuite' appears in our dependencies.
353 TESTSUITE = $(srcdir)/tests/testsuite
354 TESTSUITE_AT    = \
355                   tests/builtins.at \
356                   tests/freeze.at \
357                   tests/generated.at \
358                   tests/macros.at \
359                   tests/modules.at \
360                   tests/options.at \
361                   tests/others.at \
362                   tests/testsuite.at
364 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
365                   tests/atlocal.in \
366                   tests/generate.awk \
367                   tests/package.m4
369 # Be sure to reexport important environment variables:
370 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
371         CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
372         LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
373         OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
374         abs_top_builddir="$(abs_top_builddir)" \
375         CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
376         F77="$(F77)" FFLAGS="$(FFLAGS)" \
377         GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
379 # Using variables so that this snippet is not too wide and can
380 # be used as is in Texinfo @example/@end example.
381 m4_texinfo  = $(srcdir)/doc/m4.texinfo
382 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
383 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
384         $(generate) $(m4_texinfo) >$@t
385         mv $@t $@
387 AUTOM4TE = autom4te
388 AUTOTEST = $(AUTOM4TE) --language=autotest
389 $(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
390         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
391         mv $@.tmp $@
393 # The leading :; works around a bug in {}>f in some bash versions.
394 $(srcdir)/tests/package.m4: configure.ac
395         :; \
396         { \
397           echo '# Signature of the current package.'; \
398           echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
399           echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
400           echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
401           echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
402           echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
403         } > $(srcdir)/tests/package.m4
405 tests/atconfig: config.status
406         $(SHELL) ./config.status tests/atconfig
407 DISTCLEANFILES += tests/atconfig
409 # Hook the test suite into the check rule
410 check-local: tests/atconfig tests/m4 $(TESTSUITE) $(check_LTLIBRARIES)
411         $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
412           $(TESTS_ENVIRONMENT) $(TESTSUITEFLAGS)
414 # Run the test suite on the *installed* tree.
415 installcheck-local: tests/atconfig $(TESTSUITE) $(check_LTLIBRARIES)
416         $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
417           $(TESTS_ENVIRONMENT) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
419 # We need to remove any file droppings left behind by testsuite.
420 clean-local-tests:
421         test ! -f '$(srcdir)/tests/testsuite' || \
422           $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
424 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test \
425                 tests/null.m4 tests/null.out tests/null.err
427 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
428 MAINTAINERCLEANFILES += tests/generated.at '$(TESTSUITE)'
430 clean-local: clean-local-tests
432 ##                                                                      ##
433 ##                   --- RULES FOR THE MAINTAINER ---                   ##
434 ##           You shouldn't need to touch anything below here.           ##
435 ##              (mostly copied from automake/Makefile.am)               ##
436 ##                                                                      ##
438 CVS     = cvs # set it to `:' to avoid CVS operations at dist time
440 # Tag before making distribution.  Also, don't make a distribution if
441 # checks fail.  Also, make sure the NEWS file is up-to-date.
442 cvs-dist: distcheck # maintainer-check
443         @if sed '1,2d;3q' $(srcdir)/NEWS | grep -e "$(VERSION)" > dev/null; \
444           echo "NEWS not updated; not releasing" 1>&2; \
445           exit 1;
446         fi
447         cd $(srcdir) && \
448           $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
449         $(MAKE) dist
451 cvs-diff:
452         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
453         if test -z "$$OLDVERSION"; then \
454           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
455         else prevno="$$OLDVERSION"; fi; \
456         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
457         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
458             > $(PACKAGE)-$$prevno-$(VERSION).diff
460 .PHONY: web-manual
461 web-manual:
462         @cd $(srcdir)/doc; \
463           $(SHELL) "$(abs_srcdir)/$(config_aux_dir)/gendocs.sh" $(PACKAGE) \
464             "GNU $(PACKAGE)- GNU macro processor"
465         @echo " *** Upload the doc/manual directory to web-cvs."