* Makefile.am (dist_pkgdata_DATA): Distribute recently-added
[m4.git] / Makefile.am
blob49fe0ba38a22ece0cb45b7c5ee7553aa9f17c68c
1 ## This file is part of GNU M4.
2 ##
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006 Free Software
4 ## Foundation, Inc.
5 ##
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; see the file COPYING.  If not, write to
18 ## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 ## Boston, MA 02110-1301, USA.
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 .
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 AM_LDFLAGS      = -no-undefined -export-dynamic
36 EXTRA_DIST      = bootstrap \
37                   $(config_aux_dir)/mkstamp \
38                   $(config_macro_dir)/gnulib-cache.m4
39 CLEANFILES      =
40 DISTCLEANFILES  =
41 MOSTLYCLEANFILES=
42 MAINTAINERCLEANFILES = \
43                   ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
44                   config-h.in configure stamp-h.in \
45                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
47 BUILT_SOURCES   =
49 ## We know that $(srcdir)/ChangeLog has been edited if stamp-vcl
50 ## needs updating, so we assume we have write access to $(srcdir).
51 ## If we try to maintain ./stamp-vcl to avoid writing to a possibly
52 ## read-only $(srcdir), then when the two stamp-vcls differ, distcheck
53 ## will try to update the one in the read-only source tree it makes.
54 MKSTAMP = $(SHELL) $(srcdir)/$(config_aux_dir)/mkstamp
55 $(srcdir)/stamp-vcl: vcl-tmp ChangeLog
56 vcl-tmp:
57         @set dummy `$(MKSTAMP) < $(srcdir)/ChangeLog`; shift; \
58         echo "$$1" > vcl.tmp; \
59         diff vcl.tmp $(srcdir)/stamp-vcl >/dev/null 2>&1 \
60           || (echo "Updating stamp-vcl"; cp vcl.tmp $(srcdir)/stamp-vcl)
61         -@rm -f vcl.tmp
63 # Make sure config.status is regenerated when the version timestamp changes
64 CONFIG_STATUS_DEPENDENCIES = stamp-vcl
65 EXTRA_DIST += stamp-vcl
68 ## ------- ##
69 ## GNU M4. ##
70 ## ------- ##
72 bin_PROGRAMS    = src/m4
73 src_m4_SOURCES  = \
74                   src/version-etc-fsf.c \
75                   src/version-etc.c \
76                   src/version-etc.h \
77                   src/main.c \
78                   src/m4.h \
79                   src/freeze.c
80 if GETOPT
81 src_m4_SOURCES += \
82                   src/getopt.c \
83                   src/getopt1.c \
84                   src/getopt.h
85 endif
86 if STACKOVF
87 src_m4_SOURCES += src/stackovf.c
88 endif
89 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
90 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
91 src_m4_LDADD    = m4/libm4.la
92 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
94 ## Since we do not build a libtool library in src, Automake fails to infer
95 ## that there may be a libs directory there.  FIXME - revisit this if
96 ## automake 1.10 fixes the bug.
97 clean-local-src:
98         -rm -rf src/.libs src/_libs
101 ##                                                                      ##
102 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
103 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
104 ##     modules are not imported by gnulib-tool, but added manually.     ##
105 ##  (from: gnulib-tool --extract-automake-snippet getopt version-etc)   ##
106 ##                                                                      ##
107 BUILT_SOURCES  += src/$(GETOPT_H)
108 EXTRA_DIST     += src/getopt_.h src/getopt_int.h
110 # We need the following in order to create an <getopt.h> when the
111 # system doesn't have one that works with the given compiler.
112 all-local: src/$(GETOPT_H)
113 src/getopt.h: src/getopt_.h
114         cp $(srcdir)/src/getopt_.h $@-t
115         mv $@-t $@
116 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
117 ##                                                                      ##
118 ##                     --- END OF PASTED GNULIB ---                     ##
119 ##                                                                      ##
121 ## -------- ##
122 ## Modules. ##
123 ## -------- ##
125 pkgmodincludedir= $(pkgincludedir)/modules
127 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
129 module_ldflags  = -module $(AM_LDFLAGS)
130 module_libadd   = m4/libm4.la
132 pkgmodinclude_HEADERS = modules/m4.h
134 pkglibexec_LTLIBRARIES = \
135                   modules/gnu.la \
136                   modules/load.la \
137                   modules/m4.la \
138                   modules/traditional.la
140 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
141 modules_gnu_la_LDFLAGS          = $(module_ldflags)
142 modules_gnu_la_LIBADD           = $(module_libadd)
143 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
145 modules_load_la_LDFLAGS         = $(module_ldflags)
146 modules_load_la_LIBADD          = $(module_libadd)
148 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
149 modules_m4_la_LDFLAGS           = $(module_ldflags)
150 modules_m4_la_LIBADD            = $(module_libadd)
151 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
153 modules_traditional_la_LDFLAGS  = $(module_ldflags)
154 modules_traditional_la_LIBADD   = $(module_libadd)
156 if USE_GMP
157 pkglibexec_LTLIBRARIES         += modules/mpeval.la
158 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
159 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
160 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
161 endif
163 ## Disabled for now.  It is too fragile to be useful.
164 ## pkglibexec_LTLIBRARIES         += modules/perl.la
165 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
166 ## modules_perl_la_LDFLAGS              = \
167 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
168 ## modules_perl_la_LIBADD               = $(module_libadd)
169 ## BUILT_SOURCES                        = perlxsi.c
170 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
172 ## perlxsi.c:
173 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
175 ## but we should still distribute it, because it is listed in POTFILES.in:
176 EXTRA_DIST += modules/perl.c
178 module_check    = -rpath /dev/null
179 check_LTLIBRARIES = \
180                   tests/import.la \
181                   tests/modtest.la \
182                   tests/shadow.la \
183                   tests/stdlib.la \
184                   tests/time.la
186 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
187 tests_import_la_LIBADD          = $(module_libadd)
188 tests_import_la_SOURCES         = modules/import.c
190 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
191 tests_modtest_la_LIBADD         = $(module_libadd)
192 tests_modtest_la_SOURCES        = modules/modtest.c
194 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
195 tests_shadow_la_LIBADD          = $(module_libadd)
196 tests_shadow_la_SOURCES         = modules/shadow.c
198 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
199 tests_stdlib_la_LIBADD          = $(module_libadd)
200 tests_stdlib_la_SOURCES         = modules/stdlib.c
202 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
203 tests_time_la_LIBADD            = $(module_libadd)
204 tests_time_la_SOURCES           = modules/time.c
206 EXTRA_DIST     += \
207                   modules/modtest.m4 \
208                   modules/shadow.m4 \
209                   modules/time.m4 \
210                   modules/time2.m4 \
211                   modules/stdlib.m4
213 ## ----- ##
214 ## libm4 ##
215 ## ----- ##
217 lib_LTLIBRARIES = m4/libm4.la
219 nobase_include_HEADERS = \
220                   m4/m4module.h
221 nobase_pkginclude_HEADERS = \
222                   m4/hash.h \
223                   m4/system.h
224 m4_libm4_la_SOURCES     = \
225                   m4/builtin.c \
226                   m4/debug.c \
227                   m4/hash.c \
228                   m4/input.c \
229                   m4/m4.c \
230                   m4/m4private.h \
231                   m4/macro.c \
232                   m4/module.c \
233                   m4/output.c \
234                   m4/path.c \
235                   m4/resyntax.c \
236                   m4/symtab.c \
237                   m4/syntax.c \
238                   m4/utility.c
239 m4_libm4_la_LIBADD = gnu/libgnu.la \
240                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
241 m4_libm4_la_DEPENDENCIES = $(LIBLTDL) gnu/libgnu.la
243 # This file needs to be regenerated at configure time.
244 dist-hook:
245         rm -f $(distdir)/m4/system.h
246 EXTRA_DIST     += m4/system_.h
249 ## ------- ##
250 ## libltdl ##
251 ## ------- ##
253 ltdl/libltdlc.la:
254         cd ltdl && $(MAKE) $(MAKEFLAGS) libltdlc.la
256 ## -------------- ##
257 ## Documentation. ##
258 ## -------------- ##
260 info_TEXINFOS   = doc/m4.texinfo
261 doc_m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl.texi
262 dist_man_MANS   = doc/m4.1
263 EXTRA_DIST     += $(config_aux_dir)/gendocs.sh doc/gendocs_template
264 MAINTAINERCLEANFILES += $(config_aux_dir)/gendocs.sh doc/gendocs_template \
265                   doc/fdl.texi
267 # Build the man page once in the srcdir, rather than in every VPATH build
268 # dir, to match how automake builds info pages.  This is safe for 'make
269 # distcheck' since it is distributed pre-built.
270 $(srcdir)/doc/m4.1: configure.ac src/main.c
271         @if test -f src/m4$(EXEEXT); then \
272           echo "Updating the \`man' page \`$@'"; \
273           $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run \
274             help2man --name="macro processor" --source=FSF \
275             --info-page=m4 --output=$@ src/m4$(EXEEXT); \
276         else \
277           echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
278           echo "         Retry once the program executable is ready."; \
279         fi
281 ## Disabled for now.  Clashes with earlier definition.
282 ## TAGS_FILES   = $(infos_TEXINFOS)
283 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
284 ## ETAGS_ARGS   = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
286 MAINTAINERCLEANFILES += $(dist_man_MANS)
289 ## --------- ##
290 ## Examples. ##
291 ## --------- ##
293 EXTRA_DIST     += \
294                   examples/WWW/Makefile \
295                   examples/WWW/_footer.htm \
296                   examples/WWW/_header.htm \
297                   examples/WWW/m4lib/bugs.m4 \
298                   examples/WWW/m4lib/changelog.m4 \
299                   examples/WWW/m4lib/download.m4 \
300                   examples/WWW/m4lib/features.m4 \
301                   examples/WWW/m4lib/feedback.m4 \
302                   examples/WWW/m4lib/html.m4 \
303                   examples/WWW/m4lib/index.m4 \
304                   examples/WWW/m4lib/layout.m4 \
305                   examples/WWW/m4lib/lists.m4 \
306                   examples/WWW/m4lib/menu.m4 \
307                   examples/WWW/m4lib/modules.m4 \
308                   examples/WWW/m4lib/news.m4 \
309                   examples/WWW/m4lib/readme.m4 \
310                   examples/WWW/m4lib/setup.m4 \
311                   examples/WWW/m4lib/test.m4 \
312                   examples/WWW/m4lib/thanks.m4 \
313                   examples/WWW/m4lib/thissite.m4 \
314                   examples/WWW/m4lib/tmpl.m4 \
315                   examples/WWW/m4lib/todo.m4 \
316                   examples/WWW/m4lib/uses.m4 \
317                   examples/WWW/m4lib/visions.m4 \
318                   examples/WWW/m4lib/whatis.m4
320 dist_pkgdata_DATA = \
321                   examples/capitalize.m4 \
322                   examples/comments.m4 \
323                   examples/ddivert.m4 \
324                   examples/debug.m4 \
325                   examples/esyscmd.m4 \
326                   examples/exp.m4 \
327                   examples/foreach.m4 \
328                   examples/foreach2.m4 \
329                   examples/foreachq.m4 \
330                   examples/foreachq2.m4 \
331                   examples/forloop.m4 \
332                   examples/forloop2.m4 \
333                   examples/fstab.m4 \
334                   examples/hanoi.m4 \
335                   examples/incl-test.m4 \
336                   examples/incl.m4 \
337                   examples/include.m4 \
338                   examples/indir.m4 \
339                   examples/misc.m4 \
340                   examples/multiquotes.m4 \
341                   examples/patsubst.m4 \
342                   examples/pushpop.m4 \
343                   examples/quote.m4 \
344                   examples/regexp.m4 \
345                   examples/reverse.m4 \
346                   examples/sysv-args.m4 \
347                   examples/trace.m4 \
348                   examples/translit.m4 \
349                   examples/undivert.incl \
350                   examples/undivert.m4 \
351                   examples/wrap.m4
353 ## ----------- ##
354 ## Test suite. ##
355 ## ----------- ##
357 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
358 # how `testsuite' appears in our dependencies.
359 TESTSUITE = $(srcdir)/tests/testsuite
360 TESTSUITE_AT    = \
361                   tests/builtins.at \
362                   tests/freeze.at \
363                   tests/generated.at \
364                   tests/macros.at \
365                   tests/modules.at \
366                   tests/options.at \
367                   tests/others.at \
368                   tests/testsuite.at
370 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
371                   tests/atlocal.in \
372                   tests/generate.awk \
373                   tests/package.m4
375 # Be sure to reexport important environment variables:
376 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
377         CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
378         LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
379         OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
380         abs_top_builddir="$(abs_top_builddir)" \
381         CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
382         F77="$(F77)" FFLAGS="$(FFLAGS)" \
383         GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
385 # Using variables so that this snippet is not too wide and can
386 # be used as is in Texinfo @example/@end example.
387 m4_texinfo  = $(srcdir)/doc/m4.texinfo
388 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
389 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
390         $(generate) $(m4_texinfo) >$@t
391         mv $@t $@
393 AUTOM4TE = autom4te
394 AUTOTEST = $(AUTOM4TE) --language=autotest
395 $(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
396         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
397         mv $@.tmp $@
399 $(srcdir)/tests/package.m4: configure.ac
400         {                                       \
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 # FIXME - After 2.60, autoconf might add an option to testsuite to specify
414 # which directory it should output testsuite.log.  Until then, we want it
415 # to drop in tests, so we have to do a cd inside the targets that invoke
416 # testsuite.  As a result, we need an absolute path since the relative
417 # $(srcdir) inside $(TESTSUITE) does not work after cd.
418 CD_TESTDIR      = cd ./tests
420 # Hook the test suite into the check rule
421 check-local: tests/atconfig tests/m4 $(TESTSUITE) $(check_LTLIBRARIES)
422         $(CD_TESTDIR); \
423         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
424           $(TESTSUITEFLAGS)
426 # Run the test suite on the *installed* tree.
427 installcheck-local: tests/atconfig $(TESTSUITE) $(check_LTLIBRARIES)
428         $(CD_TESTDIR); \
429         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
430           AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
432 # We need to remove any file droppings left behind by testsuite.
433 clean-local-tests:
434         $(CD_TESTDIR); \
435         test ! -f '$(abs_srcdir)/tests/testsuite' || \
436           $(SHELL) '$(abs_srcdir)/tests/testsuite' --clean
438 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test
440 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
441 MAINTAINERCLEANFILES += tests/generated.at '$(TESTSUITE)'
443 clean-local: clean-local-src clean-local-tests
445 ##                                                                      ##
446 ##                   --- RULES FOR THE MAINTAINER ---                   ##
447 ##           You shouldn't need to touch anything below here.           ##
448 ##              (mostly copied from automake/Makefile.am)               ##
449 ##                                                                      ##
451 CVS     = cvs # set it to `:' to avoid CVS operations at dist time
453 # Tag before making distribution.  Also, don't make a distribution if
454 # checks fail.  Also, make sure the NEWS file is up-to-date.
455 cvs-dist: distcheck # maintainer-check
456         @if sed '1,2d;3q' $(srcdir)/NEWS | grep -e "$(VERSION)" > dev/null; \
457           echo "NEWS not updated; not releasing" 1>&2; \
458           exit 1;
459         fi
460         cd $(srcdir) && \
461           $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
462         $(MAKE) dist
464 cvs-diff:
465         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
466         if test -z "$$OLDVERSION"; then \
467           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
468         else prevno="$$OLDVERSION"; fi; \
469         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
470         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
471             > $(PACKAGE)-$$prevno-$(VERSION).diff
473 .PHONY: web-manual
474 web-manual:
475         @cd $(srcdir)/doc; \
476           $(SHELL) "$(abs_srcdir)/$(config_aux_dir)/gendocs.sh" $(PACKAGE) \
477             "GNU $(PACKAGE)- GNU macro processor"
478         @echo " *** Upload the doc/manual directory to web-cvs."