* bootstrap (ltdl/m4/.cvsignore): Add xstrtol module macros.
[m4/ericb.git] / Makefile.am
blob01b34eaa26fa3a31456de05b3b15e3e843745fa6
1 ## Makefile.am - template for generating Makefile via Automake
2 ##
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
4 ## 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  = ltdl/config
24 config_macro_dir= ltdl/m4
26 SUBDIRS         = ltdl po gnu tests/gnu .
28 ACLOCAL_AMFLAGS = -I ltdl/m4
29 AUTOMAKE_OPTIONS = nostdinc
30 AM_CPPFLAGS     = -I. -I$(srcdir) \
31                   -Ignu -I$(srcdir)/gnu \
32                   -Im4 -I$(srcdir)/m4 \
33                   $(LTDLINCL)
34 # FIXME - the -export-symbols-regex ".*" is a hack to work around the
35 # fact that on cygwin, the convenience library libltdl exports symbols,
36 # which effectively disables the auto-exporting of all other symbols.
37 # Revisit this if libtool on cygwin improves.
38 # See http://lists.gnu.org/archive/html/libtool-patches/2007-02/msg00062.html
39 AM_LDFLAGS      = -no-undefined -export-dynamic -export-symbols-regex ".*"
41 EXTRA_DIST      = bootstrap \
42                   $(config_aux_dir)/mkstamp \
43                   $(config_macro_dir)/gnulib-cache.m4
44 CLEANFILES      =
45 DISTCLEANFILES  =
46 MOSTLYCLEANFILES=
47 MAINTAINERCLEANFILES = \
48                   ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
49                   config-h.in configure stamp-h.in \
50                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
52 BUILT_SOURCES   =
54 MKSTAMP = $(SHELL) $(srcdir)/$(config_aux_dir)/mkstamp
56 # Make sure config.status is regenerated when the version timestamp changes
57 CONFIG_STATUS_DEPENDENCIES = ChangeLog
60 ## ------- ##
61 ## GNU M4. ##
62 ## ------- ##
64 bin_PROGRAMS    = src/m4
65 src_m4_SOURCES  = \
66                   src/xstrtoul.c \
67                   src/xstrtol-error.c \
68                   src/xstrtol.c \
69                   src/xstrtol.h \
70                   src/version-etc-fsf.c \
71                   src/version-etc.c \
72                   src/version-etc.h \
73                   src/main.c \
74                   src/m4.h \
75                   src/freeze.c
76 if GETOPT
77 src_m4_SOURCES += \
78                   src/getopt.c \
79                   src/getopt1.c \
80                   src/getopt.h
81 endif
82 if STACKOVF
83 src_m4_SOURCES += src/stackovf.c
84 endif
85 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
86 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
87 src_m4_LDADD    = m4/libm4.la
88 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
90 ## Since we do not build a libtool library in src, Automake fails to infer
91 ## that there may be a libs directory there.  FIXME - revisit this if
92 ## automake 1.10 fixes the bug.
93 clean-local-src:
94         -rm -rf src/.libs src/_libs
97 ##                                                                      ##
98 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
99 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
100 ##     modules are not imported by gnulib-tool, but added manually.     ##
101 ##  (from: gnulib-tool --extract-automake-snippet getopt version-etc)   ##
102 ##                                                                      ##
103 BUILT_SOURCES  += src/$(GETOPT_H)
104 EXTRA_DIST     += src/getopt_.h src/getopt_int.h
106 # We need the following in order to create an <getopt.h> when the
107 # system doesn't have one that works with the given compiler.
108 all-local: src/$(GETOPT_H)
109 src/getopt.h: src/getopt_.h
110         cp $(srcdir)/src/getopt_.h $@-t
111         mv $@-t $@
112 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
113 ##                                                                      ##
114 ##                     --- END OF PASTED GNULIB ---                     ##
115 ##                                                                      ##
117 ## -------- ##
118 ## Modules. ##
119 ## -------- ##
121 pkgmodincludedir= $(pkgincludedir)/modules
123 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
125 module_ldflags  = -module $(AM_LDFLAGS)
126 module_libadd   = m4/libm4.la
128 pkgmodinclude_HEADERS = modules/m4.h
130 pkglibexec_LTLIBRARIES = \
131                   modules/gnu.la \
132                   modules/load.la \
133                   modules/m4.la \
134                   modules/traditional.la
136 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
137 modules_gnu_la_LDFLAGS          = $(module_ldflags)
138 modules_gnu_la_LIBADD           = $(module_libadd)
139 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
141 modules_load_la_LDFLAGS         = $(module_ldflags)
142 modules_load_la_LIBADD          = $(module_libadd)
144 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
145 modules_m4_la_LDFLAGS           = $(module_ldflags)
146 modules_m4_la_LIBADD            = $(module_libadd)
147 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
149 modules_traditional_la_LDFLAGS  = $(module_ldflags)
150 modules_traditional_la_LIBADD   = $(module_libadd)
152 if USE_GMP
153 pkglibexec_LTLIBRARIES         += modules/mpeval.la
154 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
155 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
156 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
157 endif
159 ## Disabled for now.  It is too fragile to be useful.
160 ## pkglibexec_LTLIBRARIES         += modules/perl.la
161 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
162 ## modules_perl_la_LDFLAGS              = \
163 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
164 ## modules_perl_la_LIBADD               = $(module_libadd)
165 ## BUILT_SOURCES                        = perlxsi.c
166 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
168 ## perlxsi.c:
169 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
171 ## but we should still distribute it, because it is listed in POTFILES.in:
172 EXTRA_DIST += modules/perl.c
174 module_check    = -rpath /dev/null
175 check_LTLIBRARIES = \
176                   tests/import.la \
177                   tests/modtest.la \
178                   tests/shadow.la \
179                   tests/stdlib.la \
180                   tests/time.la
182 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
183 tests_import_la_LIBADD          = $(module_libadd)
184 tests_import_la_SOURCES         = modules/import.c
186 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
187 tests_modtest_la_LIBADD         = $(module_libadd)
188 tests_modtest_la_SOURCES        = modules/modtest.c
190 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
191 tests_shadow_la_LIBADD          = $(module_libadd)
192 tests_shadow_la_SOURCES         = modules/shadow.c
194 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
195 tests_stdlib_la_LIBADD          = $(module_libadd)
196 tests_stdlib_la_SOURCES         = modules/stdlib.c
198 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
199 tests_time_la_LIBADD            = $(module_libadd)
200 tests_time_la_SOURCES           = modules/time.c
202 EXTRA_DIST     += \
203                   modules/modtest.m4 \
204                   modules/shadow.m4 \
205                   modules/time.m4 \
206                   modules/time2.m4 \
207                   modules/stdlib.m4
209 ## ----- ##
210 ## libm4 ##
211 ## ----- ##
213 lib_LTLIBRARIES = m4/libm4.la
215 nobase_include_HEADERS = \
216                   m4/m4module.h
217 nobase_pkginclude_HEADERS = \
218                   m4/hash.h \
219                   m4/system.h
220 m4_libm4_la_SOURCES     = \
221                   m4/builtin.c \
222                   m4/debug.c \
223                   m4/hash.c \
224                   m4/input.c \
225                   m4/m4.c \
226                   m4/m4private.h \
227                   m4/macro.c \
228                   m4/module.c \
229                   m4/output.c \
230                   m4/path.c \
231                   m4/resyntax.c \
232                   m4/symtab.c \
233                   m4/syntax.c \
234                   m4/utility.c
235 m4_libm4_la_LIBADD = gnu/libgnu.la \
236                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
237 m4_libm4_la_DEPENDENCIES = $(LIBLTDL) gnu/libgnu.la
239 # This file needs to be regenerated at configure time.
240 dist-hook:
241         rm -f $(distdir)/m4/system.h
242 EXTRA_DIST     += m4/system_.h
245 ## ------- ##
246 ## libltdl ##
247 ## ------- ##
249 ltdl/libltdlc.la:
250         cd ltdl && $(MAKE) $(MAKEFLAGS) libltdlc.la
252 ## -------------- ##
253 ## Documentation. ##
254 ## -------------- ##
256 info_TEXINFOS   = doc/m4.texinfo
257 doc_m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl.texi doc/gpl-3.0.texi
258 dist_man_MANS   = doc/m4.1
259 EXTRA_DIST     += $(config_aux_dir)/gendocs.sh doc/gendocs_template
260 MAINTAINERCLEANFILES += $(config_aux_dir)/gendocs.sh doc/gendocs_template \
261                   doc/fdl.texi
263 # Build the man page once in the srcdir, rather than in every VPATH build
264 # dir, to match how automake builds info pages.  This is safe for 'make
265 # distcheck' since it is distributed pre-built.
266 $(srcdir)/doc/m4.1: configure.ac src/main.c
267         @if test -f src/m4$(EXEEXT); then \
268           echo "Updating the \`man' page \`$@'"; \
269           $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run \
270             help2man --name="macro processor" --source=FSF \
271             --info-page=m4 --output=$@ src/m4$(EXEEXT); \
272         else \
273           echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
274           echo "         Retry once the program executable is ready."; \
275         fi
277 ## Disabled for now.  Clashes with earlier definition.
278 ## TAGS_FILES   = $(infos_TEXINFOS)
279 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
280 ## ETAGS_ARGS   = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
282 MAINTAINERCLEANFILES += $(dist_man_MANS)
285 ## --------- ##
286 ## Examples. ##
287 ## --------- ##
289 EXTRA_DIST     += \
290                   examples/WWW/Makefile \
291                   examples/WWW/_footer.htm \
292                   examples/WWW/_header.htm \
293                   examples/WWW/m4lib/bugs.m4 \
294                   examples/WWW/m4lib/changelog.m4 \
295                   examples/WWW/m4lib/download.m4 \
296                   examples/WWW/m4lib/features.m4 \
297                   examples/WWW/m4lib/feedback.m4 \
298                   examples/WWW/m4lib/html.m4 \
299                   examples/WWW/m4lib/index.m4 \
300                   examples/WWW/m4lib/layout.m4 \
301                   examples/WWW/m4lib/lists.m4 \
302                   examples/WWW/m4lib/menu.m4 \
303                   examples/WWW/m4lib/modules.m4 \
304                   examples/WWW/m4lib/news.m4 \
305                   examples/WWW/m4lib/readme.m4 \
306                   examples/WWW/m4lib/setup.m4 \
307                   examples/WWW/m4lib/test.m4 \
308                   examples/WWW/m4lib/thanks.m4 \
309                   examples/WWW/m4lib/thissite.m4 \
310                   examples/WWW/m4lib/tmpl.m4 \
311                   examples/WWW/m4lib/todo.m4 \
312                   examples/WWW/m4lib/uses.m4 \
313                   examples/WWW/m4lib/visions.m4 \
314                   examples/WWW/m4lib/whatis.m4
316 dist_pkgdata_DATA = \
317                   examples/capitalize.m4 \
318                   examples/comments.m4 \
319                   examples/ddivert.m4 \
320                   examples/debug.m4 \
321                   examples/esyscmd.m4 \
322                   examples/exp.m4 \
323                   examples/foreach.m4 \
324                   examples/foreach2.m4 \
325                   examples/foreachq.m4 \
326                   examples/foreachq2.m4 \
327                   examples/forloop.m4 \
328                   examples/forloop2.m4 \
329                   examples/fstab.m4 \
330                   examples/hanoi.m4 \
331                   examples/incl-test.m4 \
332                   examples/incl.m4 \
333                   examples/include.m4 \
334                   examples/indir.m4 \
335                   examples/misc.m4 \
336                   examples/multiquotes.m4 \
337                   examples/patsubst.m4 \
338                   examples/pushpop.m4 \
339                   examples/quote.m4 \
340                   examples/regexp.m4 \
341                   examples/reverse.m4 \
342                   examples/sysv-args.m4 \
343                   examples/trace.m4 \
344                   examples/translit.m4 \
345                   examples/undivert.incl \
346                   examples/undivert.m4 \
347                   examples/wrap.m4
349 ## ----------- ##
350 ## Test suite. ##
351 ## ----------- ##
353 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
354 # how `testsuite' appears in our dependencies.
355 TESTSUITE = $(srcdir)/tests/testsuite
356 TESTSUITE_AT    = \
357                   tests/builtins.at \
358                   tests/freeze.at \
359                   tests/generated.at \
360                   tests/macros.at \
361                   tests/modules.at \
362                   tests/options.at \
363                   tests/others.at \
364                   tests/testsuite.at
366 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
367                   tests/atlocal.in \
368                   tests/generate.awk \
369                   tests/package.m4
371 # Be sure to reexport important environment variables:
372 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
373         CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
374         LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
375         OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
376         abs_top_builddir="$(abs_top_builddir)" \
377         CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
378         F77="$(F77)" FFLAGS="$(FFLAGS)" \
379         GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
381 # Using variables so that this snippet is not too wide and can
382 # be used as is in Texinfo @example/@end example.
383 m4_texinfo  = $(srcdir)/doc/m4.texinfo
384 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
385 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
386         $(generate) $(m4_texinfo) >$@t
387         mv $@t $@
389 AUTOM4TE = autom4te
390 AUTOTEST = $(AUTOM4TE) --language=autotest
391 $(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
392         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
393         mv $@.tmp $@
395 $(srcdir)/tests/package.m4: configure.ac
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 # FIXME - After 2.60, autoconf might add an option to testsuite to specify
410 # which directory it should output testsuite.log.  Until then, we want it
411 # to drop in tests, so we have to do a cd inside the targets that invoke
412 # testsuite.  As a result, we need an absolute path since the relative
413 # $(srcdir) inside $(TESTSUITE) does not work after cd.
414 CD_TESTDIR      = cd ./tests
416 # Hook the test suite into the check rule
417 check-local: tests/atconfig tests/m4 $(TESTSUITE) $(check_LTLIBRARIES)
418         $(CD_TESTDIR); \
419         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
420           $(TESTSUITEFLAGS)
422 # Run the test suite on the *installed* tree.
423 installcheck-local: tests/atconfig $(TESTSUITE) $(check_LTLIBRARIES)
424         $(CD_TESTDIR); \
425         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
426           AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
428 # We need to remove any file droppings left behind by testsuite.
429 clean-local-tests:
430         $(CD_TESTDIR); \
431         test ! -f '$(abs_srcdir)/tests/testsuite' || \
432           $(SHELL) '$(abs_srcdir)/tests/testsuite' --clean
434 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test
436 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
437 MAINTAINERCLEANFILES += tests/generated.at '$(TESTSUITE)'
439 clean-local: clean-local-src clean-local-tests
441 ##                                                                      ##
442 ##                   --- RULES FOR THE MAINTAINER ---                   ##
443 ##           You shouldn't need to touch anything below here.           ##
444 ##              (mostly copied from automake/Makefile.am)               ##
445 ##                                                                      ##
447 CVS     = cvs # set it to `:' to avoid CVS operations at dist time
449 # Tag before making distribution.  Also, don't make a distribution if
450 # checks fail.  Also, make sure the NEWS file is up-to-date.
451 cvs-dist: distcheck # maintainer-check
452         @if sed '1,2d;3q' $(srcdir)/NEWS | grep -e "$(VERSION)" > dev/null; \
453           echo "NEWS not updated; not releasing" 1>&2; \
454           exit 1;
455         fi
456         cd $(srcdir) && \
457           $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
458         $(MAKE) dist
460 cvs-diff:
461         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
462         if test -z "$$OLDVERSION"; then \
463           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
464         else prevno="$$OLDVERSION"; fi; \
465         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
466         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
467             > $(PACKAGE)-$$prevno-$(VERSION).diff
469 .PHONY: web-manual
470 web-manual:
471         @cd $(srcdir)/doc; \
472           $(SHELL) "$(abs_srcdir)/$(config_aux_dir)/gendocs.sh" $(PACKAGE) \
473             "GNU $(PACKAGE)- GNU macro processor"
474         @echo " *** Upload the doc/manual directory to web-cvs."