Reflect upstream license .texi changes.
[m4.git] / Makefile.am
blobb1d98d5e4259884bde3051028b51c8162401045f
1 ## This file is part of GNU M4.
2 ##
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 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 3 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 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                   local/doc/gpl-3.0.texi.diff
45 CLEANFILES      =
46 DISTCLEANFILES  =
47 MOSTLYCLEANFILES=
48 MAINTAINERCLEANFILES = \
49                   ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
50                   config-h.in configure stamp-h.in \
51                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
53 BUILT_SOURCES   =
55 MKSTAMP = $(SHELL) $(srcdir)/$(config_aux_dir)/mkstamp
57 # Make sure config.status is regenerated when the version timestamp changes
58 CONFIG_STATUS_DEPENDENCIES = ChangeLog
61 ## ------- ##
62 ## GNU M4. ##
63 ## ------- ##
65 bin_PROGRAMS    = src/m4
66 src_m4_SOURCES  = \
67                   src/version-etc-fsf.c \
68                   src/version-etc.c \
69                   src/version-etc.h \
70                   src/main.c \
71                   src/m4.h \
72                   src/freeze.c
73 if GETOPT
74 src_m4_SOURCES += \
75                   src/getopt.c \
76                   src/getopt1.c \
77                   src/getopt.h
78 endif
79 if STACKOVF
80 src_m4_SOURCES += src/stackovf.c
81 endif
82 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
83 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
84 src_m4_LDADD    = m4/libm4.la
85 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
87 ## Since we do not build a libtool library in src, Automake fails to infer
88 ## that there may be a libs directory there.  FIXME - revisit this if
89 ## automake 1.10 fixes the bug.
90 clean-local-src:
91         -rm -rf src/.libs src/_libs
94 ##                                                                      ##
95 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
96 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
97 ##     modules are not imported by gnulib-tool, but added manually.     ##
98 ##  (from: gnulib-tool --extract-automake-snippet getopt version-etc)   ##
99 ##                                                                      ##
100 BUILT_SOURCES  += src/$(GETOPT_H)
101 EXTRA_DIST     += src/getopt_.h src/getopt_int.h
103 # We need the following in order to create an <getopt.h> when the
104 # system doesn't have one that works with the given compiler.
105 all-local: src/$(GETOPT_H)
106 src/getopt.h: src/getopt_.h
107         cp $(srcdir)/src/getopt_.h $@-t
108         mv $@-t $@
109 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
110 ##                                                                      ##
111 ##                     --- END OF PASTED GNULIB ---                     ##
112 ##                                                                      ##
114 ## -------- ##
115 ## Modules. ##
116 ## -------- ##
118 pkgmodincludedir= $(pkgincludedir)/modules
120 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
122 module_ldflags  = -module $(AM_LDFLAGS)
123 module_libadd   = m4/libm4.la
125 pkgmodinclude_HEADERS = modules/m4.h
127 pkglibexec_LTLIBRARIES = \
128                   modules/gnu.la \
129                   modules/load.la \
130                   modules/m4.la \
131                   modules/traditional.la
133 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
134 modules_gnu_la_LDFLAGS          = $(module_ldflags)
135 modules_gnu_la_LIBADD           = $(module_libadd)
136 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
138 modules_load_la_LDFLAGS         = $(module_ldflags)
139 modules_load_la_LIBADD          = $(module_libadd)
141 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
142 modules_m4_la_LDFLAGS           = $(module_ldflags)
143 modules_m4_la_LIBADD            = $(module_libadd)
144 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
146 modules_traditional_la_LDFLAGS  = $(module_ldflags)
147 modules_traditional_la_LIBADD   = $(module_libadd)
149 if USE_GMP
150 pkglibexec_LTLIBRARIES         += modules/mpeval.la
151 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
152 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
153 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
154 endif
156 ## Disabled for now.  It is too fragile to be useful.
157 ## pkglibexec_LTLIBRARIES         += modules/perl.la
158 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
159 ## modules_perl_la_LDFLAGS              = \
160 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
161 ## modules_perl_la_LIBADD               = $(module_libadd)
162 ## BUILT_SOURCES                        = perlxsi.c
163 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
165 ## perlxsi.c:
166 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
168 ## but we should still distribute it, because it is listed in POTFILES.in:
169 EXTRA_DIST += modules/perl.c
171 module_check    = -rpath /dev/null
172 check_LTLIBRARIES = \
173                   tests/import.la \
174                   tests/modtest.la \
175                   tests/shadow.la \
176                   tests/stdlib.la \
177                   tests/time.la
179 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
180 tests_import_la_LIBADD          = $(module_libadd)
181 tests_import_la_SOURCES         = modules/import.c
183 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
184 tests_modtest_la_LIBADD         = $(module_libadd)
185 tests_modtest_la_SOURCES        = modules/modtest.c
187 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
188 tests_shadow_la_LIBADD          = $(module_libadd)
189 tests_shadow_la_SOURCES         = modules/shadow.c
191 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
192 tests_stdlib_la_LIBADD          = $(module_libadd)
193 tests_stdlib_la_SOURCES         = modules/stdlib.c
195 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
196 tests_time_la_LIBADD            = $(module_libadd)
197 tests_time_la_SOURCES           = modules/time.c
199 EXTRA_DIST     += \
200                   modules/modtest.m4 \
201                   modules/shadow.m4 \
202                   modules/time.m4 \
203                   modules/time2.m4 \
204                   modules/stdlib.m4
206 ## ----- ##
207 ## libm4 ##
208 ## ----- ##
210 lib_LTLIBRARIES = m4/libm4.la
212 nobase_include_HEADERS = \
213                   m4/m4module.h
214 nobase_pkginclude_HEADERS = \
215                   m4/hash.h \
216                   m4/system.h
217 m4_libm4_la_SOURCES     = \
218                   m4/builtin.c \
219                   m4/debug.c \
220                   m4/hash.c \
221                   m4/input.c \
222                   m4/m4.c \
223                   m4/m4private.h \
224                   m4/macro.c \
225                   m4/module.c \
226                   m4/output.c \
227                   m4/path.c \
228                   m4/resyntax.c \
229                   m4/symtab.c \
230                   m4/syntax.c \
231                   m4/utility.c
232 m4_libm4_la_LIBADD = gnu/libgnu.la \
233                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
234 m4_libm4_la_DEPENDENCIES = $(LIBLTDL) gnu/libgnu.la
236 # This file needs to be regenerated at configure time.
237 dist-hook:
238         rm -f $(distdir)/m4/system.h
239 EXTRA_DIST     += m4/system_.h
242 ## ------- ##
243 ## libltdl ##
244 ## ------- ##
246 ltdl/libltdlc.la:
247         cd ltdl && $(MAKE) $(MAKEFLAGS) libltdlc.la
249 ## -------------- ##
250 ## Documentation. ##
251 ## -------------- ##
253 info_TEXINFOS   = doc/m4.texinfo
254 doc_m4_TEXINFOS = doc/regexprops-generic.texi doc/fdl.texi doc/gpl-3.0.texi
255 dist_man_MANS   = doc/m4.1
256 EXTRA_DIST     += $(config_aux_dir)/gendocs.sh doc/gendocs_template
257 MAINTAINERCLEANFILES += $(config_aux_dir)/gendocs.sh doc/gendocs_template \
258                   doc/fdl.texi
260 # Build the man page once in the srcdir, rather than in every VPATH build
261 # dir, to match how automake builds info pages.  This is safe for 'make
262 # distcheck' since it is distributed pre-built.
263 $(srcdir)/doc/m4.1: configure.ac src/main.c
264         @if test -f src/m4$(EXEEXT); then \
265           echo "Updating the \`man' page \`$@'"; \
266           $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run \
267             help2man --name="macro processor" --source=FSF \
268             --info-page=m4 --output=$@ src/m4$(EXEEXT); \
269         else \
270           echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
271           echo "         Retry once the program executable is ready."; \
272         fi
274 ## Disabled for now.  Clashes with earlier definition.
275 ## TAGS_FILES   = $(infos_TEXINFOS)
276 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
277 ## ETAGS_ARGS   = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
279 MAINTAINERCLEANFILES += $(dist_man_MANS)
282 ## --------- ##
283 ## Examples. ##
284 ## --------- ##
286 EXTRA_DIST     += \
287                   examples/WWW/Makefile \
288                   examples/WWW/_footer.htm \
289                   examples/WWW/_header.htm \
290                   examples/WWW/m4lib/bugs.m4 \
291                   examples/WWW/m4lib/changelog.m4 \
292                   examples/WWW/m4lib/download.m4 \
293                   examples/WWW/m4lib/features.m4 \
294                   examples/WWW/m4lib/feedback.m4 \
295                   examples/WWW/m4lib/html.m4 \
296                   examples/WWW/m4lib/index.m4 \
297                   examples/WWW/m4lib/layout.m4 \
298                   examples/WWW/m4lib/lists.m4 \
299                   examples/WWW/m4lib/menu.m4 \
300                   examples/WWW/m4lib/modules.m4 \
301                   examples/WWW/m4lib/news.m4 \
302                   examples/WWW/m4lib/readme.m4 \
303                   examples/WWW/m4lib/setup.m4 \
304                   examples/WWW/m4lib/test.m4 \
305                   examples/WWW/m4lib/thanks.m4 \
306                   examples/WWW/m4lib/thissite.m4 \
307                   examples/WWW/m4lib/tmpl.m4 \
308                   examples/WWW/m4lib/todo.m4 \
309                   examples/WWW/m4lib/uses.m4 \
310                   examples/WWW/m4lib/visions.m4 \
311                   examples/WWW/m4lib/whatis.m4
313 dist_pkgdata_DATA = \
314                   examples/capitalize.m4 \
315                   examples/comments.m4 \
316                   examples/ddivert.m4 \
317                   examples/debug.m4 \
318                   examples/esyscmd.m4 \
319                   examples/exp.m4 \
320                   examples/foreach.m4 \
321                   examples/foreach2.m4 \
322                   examples/foreachq.m4 \
323                   examples/foreachq2.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/misc.m4 \
333                   examples/multiquotes.m4 \
334                   examples/patsubst.m4 \
335                   examples/pushpop.m4 \
336                   examples/quote.m4 \
337                   examples/regexp.m4 \
338                   examples/reverse.m4 \
339                   examples/sysv-args.m4 \
340                   examples/trace.m4 \
341                   examples/translit.m4 \
342                   examples/undivert.incl \
343                   examples/undivert.m4 \
344                   examples/wrap.m4
346 ## ----------- ##
347 ## Test suite. ##
348 ## ----------- ##
350 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
351 # how `testsuite' appears in our dependencies.
352 TESTSUITE = $(srcdir)/tests/testsuite
353 TESTSUITE_AT    = \
354                   tests/builtins.at \
355                   tests/freeze.at \
356                   tests/generated.at \
357                   tests/macros.at \
358                   tests/modules.at \
359                   tests/options.at \
360                   tests/others.at \
361                   tests/testsuite.at
363 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
364                   tests/atlocal.in \
365                   tests/generate.awk \
366                   tests/package.m4
368 # Be sure to reexport important environment variables:
369 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
370         CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
371         LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
372         OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
373         abs_top_builddir="$(abs_top_builddir)" \
374         CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
375         F77="$(F77)" FFLAGS="$(FFLAGS)" \
376         GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
378 # Using variables so that this snippet is not too wide and can
379 # be used as is in Texinfo @example/@end example.
380 m4_texinfo  = $(srcdir)/doc/m4.texinfo
381 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
382 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
383         $(generate) $(m4_texinfo) >$@t
384         mv $@t $@
386 AUTOM4TE = autom4te
387 AUTOTEST = $(AUTOM4TE) --language=autotest
388 $(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
389         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
390         mv $@.tmp $@
392 $(srcdir)/tests/package.m4: configure.ac
393         {                                       \
394           echo '# Signature of the current package.'; \
395           echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
396           echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
397           echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
398           echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
399           echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
400         } > $(srcdir)/tests/package.m4
402 tests/atconfig: config.status
403         $(SHELL) ./config.status tests/atconfig
404 DISTCLEANFILES += tests/atconfig
406 # FIXME - After 2.60, autoconf might add an option to testsuite to specify
407 # which directory it should output testsuite.log.  Until then, we want it
408 # to drop in tests, so we have to do a cd inside the targets that invoke
409 # testsuite.  As a result, we need an absolute path since the relative
410 # $(srcdir) inside $(TESTSUITE) does not work after cd.
411 CD_TESTDIR      = cd ./tests
413 # Hook the test suite into the check rule
414 check-local: tests/atconfig tests/m4 $(TESTSUITE) $(check_LTLIBRARIES)
415         $(CD_TESTDIR); \
416         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
417           $(TESTSUITEFLAGS)
419 # Run the test suite on the *installed* tree.
420 installcheck-local: tests/atconfig $(TESTSUITE) $(check_LTLIBRARIES)
421         $(CD_TESTDIR); \
422         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
423           AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
425 # We need to remove any file droppings left behind by testsuite.
426 clean-local-tests:
427         $(CD_TESTDIR); \
428         test ! -f '$(abs_srcdir)/tests/testsuite' || \
429           $(SHELL) '$(abs_srcdir)/tests/testsuite' --clean
431 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test
433 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
434 MAINTAINERCLEANFILES += tests/generated.at '$(TESTSUITE)'
436 clean-local: clean-local-src clean-local-tests
438 ##                                                                      ##
439 ##                   --- RULES FOR THE MAINTAINER ---                   ##
440 ##           You shouldn't need to touch anything below here.           ##
441 ##              (mostly copied from automake/Makefile.am)               ##
442 ##                                                                      ##
444 CVS     = cvs # set it to `:' to avoid CVS operations at dist time
446 # Tag before making distribution.  Also, don't make a distribution if
447 # checks fail.  Also, make sure the NEWS file is up-to-date.
448 cvs-dist: distcheck # maintainer-check
449         @if sed '1,2d;3q' $(srcdir)/NEWS | grep -e "$(VERSION)" > dev/null; \
450           echo "NEWS not updated; not releasing" 1>&2; \
451           exit 1;
452         fi
453         cd $(srcdir) && \
454           $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
455         $(MAKE) dist
457 cvs-diff:
458         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
459         if test -z "$$OLDVERSION"; then \
460           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
461         else prevno="$$OLDVERSION"; fi; \
462         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
463         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
464             > $(PACKAGE)-$$prevno-$(VERSION).diff
466 .PHONY: web-manual
467 web-manual:
468         @cd $(srcdir)/doc; \
469           $(SHELL) "$(abs_srcdir)/$(config_aux_dir)/gendocs.sh" $(PACKAGE) \
470             "GNU $(PACKAGE)- GNU macro processor"
471         @echo " *** Upload the doc/manual directory to web-cvs."