* bootstrap (AUTORECONF): New variable to allow user overriding of
[m4/ericb.git] / Makefile.am
blob4a22aa16c376b5ad974a23ec464d1b054a7939a4
1 ## This file is part of GNU M4.
2 ##
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
4 ##
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; see the file COPYING.  If not, write to
17 ## the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 ## Boston, MA 02110-1301, USA.
20 ## Written by Gary V. Vaughan <gary@gnu.org>
22 config_aux_dir  = ltdl/config
23 config_macro_dir= ltdl/m4
25 SUBDIRS         = ltdl po gnu .
27 ACLOCAL_AMFLAGS = -I ltdl/m4
28 AM_CPPFLAGS     = -I. -I$(srcdir) \
29                   -Ignu -I$(srcdir)/gnu \
30                   -Im4 -I$(srcdir)/m4\
31                   $(INTLINCL)
32 AM_LDFLAGS      = -no-undefined -export-dynamic
34 EXTRA_DIST      = bootstrap $(config_aux_dir)/mkstamp
35 CLEANFILES      =
36 DISTCLEANFILES  =
37 MOSTLYCLEANFILES=
38 MAINTAINERCLEANFILES = \
39                   ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
40                   config-h.in configure stamp-h.in \
41                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
43 BUILT_SOURCES   =
45 # Using `cd' in backquotes may print the directory name, use this instead:
46 m4__cd          = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
48 # Make sure config.status is regenerated when the version timestamp changes
49 MKSTAMP = $(SHELL) $(srcdir)/$(config_aux_dir)/mkstamp
50 CONFIG_STATUS_DEPENDENCIES = stamp-vcl
51 stamp-vcl: vcl.tmp $(srcdir)/ChangeLog
52 vcl.tmp:
53         @dir=.; test -f $$dir/stamp-vcl || dir=$(srcdir); \
54         set `$(MKSTAMP) < $(srcdir)/ChangeLog`; \
55         echo "$$1" > vcl.tmp; \
56         cmp -s vcl.tmp $$dir/stamp-vcl \
57 ## If mkstamp does not match $(srcdir)/stamp-vcl, we still put the new one
58 ## in the current dir, incase $(srcdir) is not writable.  The dir selection
59 ## at the top of this rule takes care of prefering the right one on
60 ## subsequent runs.
61           || (echo "Updating stamp-vcl"; cp vcl.tmp ./stamp-vcl)
62         -@rm -f vcl.tmp
65 ## ------- ##
66 ## GNU M4. ##
67 ## ------- ##
69 bin_PROGRAMS    = src/m4
70 src_m4_SOURCES  = \
71                   src/getopt.c \
72                   src/getopt1.c \
73                   src/getopt.h \
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                   src/stackovf.c
81 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src $(LTDLINCL)
82 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
83 src_m4_LDADD    = m4/libm4.la
84 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES)
86 ##                                                                      ##
87 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
88 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
89 ##     modules are not imported by gnulib-tool, but added manually.     ##
90 ##  (from: gnulib-tool --extract-automake-snippet getopt version-etc)   ##
91 ##                                                                      ##
92 BUILT_SOURCES  += src/$(GETOPT_H)
93 EXTRA_DIST     += src/getopt_.h src/getopt_int.h
95 # We need the following in order to create an <getopt.h> when the
96 # system doesn't have one that works with the given compiler.
97 all-local: src/$(GETOPT_H)
98 src/getopt.h: src/getopt_.h
99         cp $(srcdir)/src/getopt_.h $@-t
100         mv $@-t $@
101 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
102 ##                                                                      ##
103 ##                     --- END OF PASTED GNULIB ---                     ##
104 ##                                                                      ##
106 ## -------- ##
107 ## Modules. ##
108 ## -------- ##
110 pkgmodincludedir= $(includedir)/$(PACKAGE)/modules
111 pkglibexecdir   = $(libexecdir)/$(PACKAGE)
113 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
115 module_ldflags  = -module
116 module_libadd   = m4/libm4.la
118 pkgmodinclude_HEADERS = modules/m4.h
120 pkglibexec_LTLIBRARIES = \
121                   modules/gnu.la \
122                   modules/load.la \
123                   modules/m4.la \
124                   modules/traditional.la
126 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
127 modules_gnu_la_LDFLAGS          = $(module_ldflags)
128 modules_gnu_la_LIBADD           = $(module_libadd)
129 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
131 modules_load_la_LDFLAGS         = $(module_ldflags)
132 modules_load_la_LIBADD          = $(module_libadd)
134 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
135 modules_m4_la_LDFLAGS           = $(module_ldflags)
136 modules_m4_la_LIBADD            = $(module_libadd)
137 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
139 modules_traditional_la_LDFLAGS  = $(module_ldflags)
140 modules_traditional_la_LIBADD   = $(module_libadd)
142 if USE_GMP
143 pkglibexec_LTLIBRARIES         += modules/mpeval.la
144 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
145 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
146 modules_mpeval_la_LIBADD        = $(module_libadd)
147 endif
149 ## Disabled for now.  It is too fragile to be useful.
150 ## pkglibexec_LTLIBRARIES         += modules/perl.la
151 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
152 ## modules_perl_la_LDFLAGS              = \
153 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
154 ## modules_perl_la_LIBADD               = $(module_libadd)
155 ## BUILT_SOURCES                        = perlxsi.c
156 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
158 ## perlxsi.c:
159 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
161 module_check    = -rpath /dev/null
162 check_LTLIBRARIES = \
163                   modules/import.la \
164                   modules/modtest.la \
165                   modules/shadow.la \
166                   modules/stdlib.la \
167                   modules/time.la
169 modules_import_la_LDFLAGS       = $(module_ldflags) $(module_check)
170 modules_import_la_LIBADD        = $(module_libadd)
172 modules_modtest_la_LDFLAGS      = $(module_ldflags) $(module_check)
173 modules_modtest_la_LIBADD       = $(module_libadd)
175 modules_shadow_la_LDFLAGS       = $(module_ldflags) $(module_check)
176 modules_shadow_la_LIBADD        = $(module_libadd)
178 modules_stdlib_la_LDFLAGS       = $(module_ldflags) $(module_check)
179 modules_stdlib_la_LIBADD        = $(module_libadd)
181 modules_time_la_LDFLAGS         = $(module_ldflags) $(module_check)
182 modules_time_la_LIBADD          = $(module_libadd)
184 EXTRA_DIST     += \
185                   modules/modtest.m4 \
186                   modules/shadow.m4 \
187                   modules/time.m4 \
188                   modules/time2.m4 \
189                   modules/stdlib.m4
191 ## ----- ##
192 ## libm4 ##
193 ## ----- ##
195 lib_LTLIBRARIES = m4/libm4.la
197 nobase_include_HEADERS = \
198                   m4/m4module.h
199 nobase_pkginclude_HEADERS = \
200                   m4/hash.h \
201                   m4/system.h
202 m4_libm4_la_SOURCES     = \
203                   m4/builtin.c \
204                   m4/debug.c \
205                   m4/hash.c \
206                   m4/input.c \
207                   m4/m4.c \
208                   m4/m4private.h \
209                   m4/macro.c \
210                   m4/module.c \
211                   m4/output.c \
212                   m4/path.c \
213                   m4/pathconf.h \
214                   m4/symtab.c \
215                   m4/syntax.c \
216                   m4/utility.c
217 m4_libm4_la_LIBADD = gnu/libgnu.la \
218                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
219 m4_libm4_la_DEPENDENCIES = $(LIBLTDL)
221 m4/pathconf.h:
222         echo "#define MODULE_PATH \"$(pkglibexecdir)\"" > m4/pathconf.h
224 MOSTLYCLEANFILES += m4/pathconf.h
225 BUILT_SOURCES    += m4/pathconf.h
227 # This file needs to be regenerated at configure time.
228 dist-hook:
229         rm -f $(distdir)/m4/system.h
230 EXTRA_DIST     += m4/system_.h
233 ## ------- ##
234 ## libltdl ##
235 ## ------- ##
237 ltdl/libltdlc.la:
238         cd ltdl && $(MAKE) $(MAKEFLAGS) libltdlc.la
240 ## -------------- ##
241 ## Documentation. ##
242 ## -------------- ##
244 info_TEXINFOS   = doc/m4.texinfo
245 dist_man_MANS   = $(srcdir)/doc/m4.1
247 $(srcdir)/doc/m4.1: doc/helptoman.pl src/m4
248         @if test -f src/m4; then \
249           echo "Updating the \`man' page \`$@'"; \
250           $(PERL) $(srcdir)/doc/helptoman.pl src/m4 > $@-tmp; \
251           cmp -s $@-tmp $(srcdir)/doc/$@ || cp $@-tmp $(srcdir)/doc/$@; \
252           rm -f $@-tmp; \
253         else \
254           echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
255           echo "         Retry once the program executable will be ready."; \
256         fi
258 ## Disabled for now.  Clashes with earlier definition.
259 ## TAGS_FILES   = $(infos_TEXINFOS)
260 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
261 ## ETAGS_ARGS   = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
263 EXTRA_DIST     += doc/helptoman.pl
265 MAINTAINERCLEANFILES += $(dist_man_MANS)
268 ## --------- ##
269 ## Examples. ##
270 ## --------- ##
272 EXTRA_DIST     += \
273                   examples/WWW/Makefile \
274                   examples/WWW/_footer.htm \
275                   examples/WWW/_header.htm \
276                   examples/WWW/man/Makefile \
277                   examples/WWW/m4lib/bugs.m4 \
278                   examples/WWW/m4lib/changelog.m4 \
279                   examples/WWW/m4lib/download.m4 \
280                   examples/WWW/m4lib/features.m4 \
281                   examples/WWW/m4lib/feedback.m4 \
282                   examples/WWW/m4lib/html.m4 \
283                   examples/WWW/m4lib/index.m4 \
284                   examples/WWW/m4lib/layout.m4 \
285                   examples/WWW/m4lib/lists.m4 \
286                   examples/WWW/m4lib/menu.m4 \
287                   examples/WWW/m4lib/modules.m4 \
288                   examples/WWW/m4lib/news.m4 \
289                   examples/WWW/m4lib/readme.m4 \
290                   examples/WWW/m4lib/setup.m4 \
291                   examples/WWW/m4lib/test.m4 \
292                   examples/WWW/m4lib/thanks.m4 \
293                   examples/WWW/m4lib/thissite.m4 \
294                   examples/WWW/m4lib/tmpl.m4 \
295                   examples/WWW/m4lib/todo.m4 \
296                   examples/WWW/m4lib/uses.m4 \
297                   examples/WWW/m4lib/visions.m4 \
298                   examples/WWW/m4lib/whatis.m4
300 dist_pkgdata_DATA = \
301                   examples/capitalize.m4 \
302                   examples/comments.m4 \
303                   examples/ddivert.m4 \
304                   examples/debug.m4 \
305                   examples/esyscmd.m4 \
306                   examples/exp.m4 \
307                   examples/foreach.m4 \
308                   examples/forloop.m4 \
309                   examples/fstab.m4 \
310                   examples/hanoi.m4 \
311                   examples/incl-test.m4 \
312                   examples/include.m4 \
313                   examples/indir.m4 \
314                   examples/misc.m4 \
315                   examples/multiquotes.m4 \
316                   examples/patsubst.m4 \
317                   examples/pushpop.m4 \
318                   examples/regexp.m4 \
319                   examples/reverse.m4 \
320                   examples/sysv-args.m4 \
321                   examples/trace.m4 \
322                   examples/translit.m4 \
323                   examples/undivert.incl \
324                   examples/undivert.m4 \
325                   examples/wrap.m4
327 ## ----------- ##
328 ## Test suite. ##
329 ## ----------- ##
331 TESTSUITE = tests/testsuite
332 TESTSUITE_AT    = \
333                   tests/builtins.at \
334                   tests/generated.at \
335                   tests/macros.at \
336                   tests/modules.at \
337                   tests/options.at \
338                   tests/others.at \
339                   tests/testsuite.at
341 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
342                   tests/atlocal.in \
343                   tests/generate.awk \
344                   tests/package.m4
346 # Be sure to reexport important environment variables:
347 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
348         CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
349         LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
350         OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
351         CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
352         F77="$(F77)" FFLAGS="$(FFLAGS)" \
353         GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
355 # Using variables so that this snippet is not too wide and can
356 # be used as is in Texinfo @example/@end example.
357 m4_texinfo  = $(srcdir)/doc/m4.texinfo
358 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
359 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
360         $(generate) $(m4_texinfo) >$@t
361         mv $@t $@
363 check-recursive: $(srcdir)/$(TESTSUITE)
365 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
366 # how `testsuite' appears in our dependencies.
367 AUTOM4TE = autom4te
368 AUTOTEST = $(AUTOM4TE) --language=autotest
369 $(srcdir)/$(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
370         cd $(srcdir)/tests; \
371         $(AUTOTEST) -I $(srcdir)/tests testsuite.at -o testsuite
373 $(srcdir)/tests/package.m4: configure.ac
374         {                                       \
375           echo '# Signature of the current package.'; \
376           echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
377           echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
378           echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
379           echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
380           echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
381         } > $(srcdir)/tests/package.m4
383 tests/atconfig: config.status
384         $(SHELL) ./config.status tests/atconfig
385 DISTCLEANFILES += tests/atconfig
387 CD_TESTDIR      = abs_srcdir=`$(m4__cd) $(srcdir) && pwd`; cd tests
389 # Hook the test suite into the check rule
390 check-local: tests/atconfig $(srcdir)/$(TESTSUITE)
391         $(CD_TESTDIR); \
392         $(TESTS_ENVIRONMENT) $(SHELL) $$abs_srcdir/$(TESTSUITE) $(TESTSUITE_FLAGS)
394 # Run the test suite on the *installed* tree.
395 installcheck-local:
396         $(CD_TESTDIR); \
397         $(TESTS_ENVIRONMENT) $(SHELL) $$abs_srcdir/$(TESTSUITE) $(TESTSUITE_FLAGS) AUTOTEST_PATH=$(exec_prefix)/bin
399 # We need to remove any file droppings left behind by testsuite.
400 clean-local:
401         -$(CD_TESTDIR); \
402         test -f $$abs_srcdir/$(TESTSUITE) && \
403             $(SHELL) $$abs_srcdir/$(TESTSUITE) --clean
405 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test
407 DISTCLEANFILES += atconfig atlocal m4
408 MAINTAINERCLEANFILES += generated.at $(TESTSUITE)
410 ##                                                                      ##
411 ##                   --- RULES FOR THE MAINTAINER ---                   ##
412 ##           You shouldn't need to touch anything below here.           ##
413 ##              (mostly copied from automake/Makefile.am)               ##
414 ##                                                                      ##
416 CVS     = cvs # set it to `:' to avoid CVS operations at dist time
418 # Tag before making distribution.  Also, don't make a distribution if
419 # checks fail.  Also, make sure the NEWS file is up-to-date.
420 cvs-dist: distcheck # maintainer-check
421         @if sed '1,2d;3q' $(srcdir)/NEWS | grep -e $(VERSION)" > dev/null; \
422           echo "NEWS not updated not releasing" 1>&2; \
423           exit 1;
424         fi
425         cd $(srcdir) && \
426           $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
427         $(MAKE) dist
429 cvs-diff:
430         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
431         if test -z "$$OLDVERSION"; then \
432           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
433         else prevno="$$OLDVERSION"; fi; \
434         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
435         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
436             > $(PACKAGE)-$$prevno-$(VERSION).diff