1 ## This file is part of GNU M4.
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006 Free Software
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 \
34 AM_LDFLAGS = -no-undefined -export-dynamic
36 EXTRA_DIST = bootstrap \
37 $(config_aux_dir)/mkstamp \
38 $(config_macro_dir)/gnulib-cache.m4
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
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
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)
63 # Make sure config.status is regenerated when the version timestamp changes
64 CONFIG_STATUS_DEPENDENCIES = stamp-vcl
65 EXTRA_DIST += stamp-vcl
74 src/version-etc-fsf.c \
87 src_m4_SOURCES += src/stackovf.c
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.
98 -rm -rf src/.libs src/_libs
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) ##
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
116 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
118 ## --- END OF PASTED GNULIB --- ##
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 = \
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)
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)
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)
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 = \
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
217 lib_LTLIBRARIES = m4/libm4.la
219 nobase_include_HEADERS = \
221 nobase_pkginclude_HEADERS = \
224 m4_libm4_la_SOURCES = \
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.
245 rm -f $(distdir)/m4/system.h
246 EXTRA_DIST += m4/system_.h
254 cd ltdl && $(MAKE) $(MAKEFLAGS) libltdlc.la
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 \
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); \
277 echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
278 echo " Retry once the program executable is ready."; \
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)
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 \
325 examples/esyscmd.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 \
335 examples/incl-test.m4 \
337 examples/include.m4 \
340 examples/multiquotes.m4 \
341 examples/patsubst.m4 \
342 examples/pushpop.m4 \
345 examples/reverse.m4 \
346 examples/sysv-args.m4 \
348 examples/translit.m4 \
349 examples/undivert.incl \
350 examples/undivert.m4 \
357 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
358 # how `testsuite' appears in our dependencies.
359 TESTSUITE = $(srcdir)/tests/testsuite
370 EXTRA_DIST += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
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
394 AUTOTEST = $(AUTOM4TE) --language=autotest
395 $(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
396 $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
399 $(srcdir)/tests/package.m4: configure.ac
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)
423 $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
426 # Run the test suite on the *installed* tree.
427 installcheck-local: tests/atconfig $(TESTSUITE) $(check_LTLIBRARIES)
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.
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
446 ## --- RULES FOR THE MAINTAINER --- ##
447 ## You shouldn't need to touch anything below here. ##
448 ## (mostly copied from automake/Makefile.am) ##
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; \
461 $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
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
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."