update .cvsignore
[m4/ericb.git] / Makefile.am
blob15ed9a3e1fa6d38b2886d4e6e0808233af3664d4
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 AM_CPPFLAGS     = -I. -I$(srcdir) \
30                   -Ignu -I$(srcdir)/gnu \
31                   -Im4 -I$(srcdir)/m4\
32                   $(INTLINCL) $(LTDLINCL)
33 AM_LDFLAGS      = -no-undefined -export-dynamic
35 EXTRA_DIST      = bootstrap \
36                   $(config_aux_dir)/mkstamp \
37                   $(config_macro_dir)/gnulib-cache.m4
38 CLEANFILES      =
39 DISTCLEANFILES  =
40 MOSTLYCLEANFILES=
41 MAINTAINERCLEANFILES = \
42                   ABOUT-NLS COPYING INSTALL Makefile.in aclocal.m4 \
43                   config-h.in configure stamp-h.in \
44                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
46 BUILT_SOURCES   =
48 ## We know that $(srcdir)/ChangeLog has been edited if stamp-vcl
49 ## needs updating, so we assume we have write access to $(srcdir).
50 ## If we try to maintain ./stamp-vcl to avoid writing to a possibly
51 ## read-only $(srcdir), then when the two stamp-vcls differ, distcheck
52 ## will try to update the one in the read-only source tree it makes.
53 MKSTAMP = $(SHELL) $(srcdir)/$(config_aux_dir)/mkstamp
54 $(srcdir)/stamp-vcl: vcl-tmp ChangeLog
55 vcl-tmp:
56         @set dummy `$(MKSTAMP) < $(srcdir)/ChangeLog`; shift; \
57         echo "$$1" > vcl.tmp; \
58         diff vcl.tmp $(srcdir)/stamp-vcl >/dev/null 2>&1 \
59           || (echo "Updating stamp-vcl"; cp vcl.tmp $(srcdir)/stamp-vcl)
60         -@rm -f vcl.tmp
62 # Make sure config.status is regenerated when the version timestamp changes
63 CONFIG_STATUS_DEPENDENCIES = stamp-vcl
64 EXTRA_DIST += stamp-vcl
67 ## ------- ##
68 ## GNU M4. ##
69 ## ------- ##
71 bin_PROGRAMS    = src/m4
72 src_m4_SOURCES  = \
73                   src/version-etc-fsf.c \
74                   src/version-etc.c \
75                   src/version-etc.h \
76                   src/main.c \
77                   src/m4.h \
78                   src/freeze.c
79 if GETOPT
80 src_m4_SOURCES += \
81                   src/getopt.c \
82                   src/getopt1.c \
83                   src/getopt.h
84 endif
85 if STACKOVF
86 src_m4_SOURCES += src/stackovf.c
87 endif
88 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src $(LTDLINCL)
89 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
90 src_m4_LDADD    = m4/libm4.la
91 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
93 ## Since we do not build a libtool library in src, Automake fails to infer
94 ## that there may be a libs directory there.  FIXME - revisit this if
95 ## automake 1.10 fixes the bug.
96 clean-local-src:
97         -rm -rf src/.libs src/_libs
100 ##                                                                      ##
101 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
102 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
103 ##     modules are not imported by gnulib-tool, but added manually.     ##
104 ##  (from: gnulib-tool --extract-automake-snippet getopt version-etc)   ##
105 ##                                                                      ##
106 BUILT_SOURCES  += src/$(GETOPT_H)
107 EXTRA_DIST     += src/getopt_.h src/getopt_int.h
109 # We need the following in order to create an <getopt.h> when the
110 # system doesn't have one that works with the given compiler.
111 all-local: src/$(GETOPT_H)
112 src/getopt.h: src/getopt_.h
113         cp $(srcdir)/src/getopt_.h $@-t
114         mv $@-t $@
115 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
116 ##                                                                      ##
117 ##                     --- END OF PASTED GNULIB ---                     ##
118 ##                                                                      ##
120 ## -------- ##
121 ## Modules. ##
122 ## -------- ##
124 pkgmodincludedir= $(includedir)/$(PACKAGE)/modules
125 pkglibexecdir   = $(libexecdir)/$(PACKAGE)
127 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
129 module_ldflags  = -module
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                   modules/import.la \
181                   modules/modtest.la \
182                   modules/shadow.la \
183                   modules/stdlib.la \
184                   modules/time.la
186 modules_import_la_LDFLAGS       = $(module_ldflags) $(module_check)
187 modules_import_la_LIBADD        = $(module_libadd)
189 modules_modtest_la_LDFLAGS      = $(module_ldflags) $(module_check)
190 modules_modtest_la_LIBADD       = $(module_libadd)
192 modules_shadow_la_LDFLAGS       = $(module_ldflags) $(module_check)
193 modules_shadow_la_LIBADD        = $(module_libadd)
195 modules_stdlib_la_LDFLAGS       = $(module_ldflags) $(module_check)
196 modules_stdlib_la_LIBADD        = $(module_libadd)
198 modules_time_la_LDFLAGS         = $(module_ldflags) $(module_check)
199 modules_time_la_LIBADD          = $(module_libadd)
201 EXTRA_DIST     += \
202                   modules/modtest.m4 \
203                   modules/shadow.m4 \
204                   modules/time.m4 \
205                   modules/time2.m4 \
206                   modules/stdlib.m4
208 ## ----- ##
209 ## libm4 ##
210 ## ----- ##
212 lib_LTLIBRARIES = m4/libm4.la
214 nobase_include_HEADERS = \
215                   m4/m4module.h
216 nobase_pkginclude_HEADERS = \
217                   m4/hash.h \
218                   m4/system.h
219 m4_libm4_la_SOURCES     = \
220                   m4/builtin.c \
221                   m4/debug.c \
222                   m4/hash.c \
223                   m4/input.c \
224                   m4/m4.c \
225                   m4/m4private.h \
226                   m4/macro.c \
227                   m4/module.c \
228                   m4/output.c \
229                   m4/path.c \
230                   m4/pathconf.h \
231                   m4/symtab.c \
232                   m4/syntax.c \
233                   m4/utility.c
234 m4_libm4_la_LIBADD = gnu/libgnu.la \
235                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
236 m4_libm4_la_DEPENDENCIES = $(LIBLTDL)
238 m4/pathconf.h:
239         echo "#define MODULE_PATH \"$(pkglibexecdir)\"" > m4/pathconf.h
241 MOSTLYCLEANFILES += m4/pathconf.h
242 BUILT_SOURCES    += m4/pathconf.h
244 # This file needs to be regenerated at configure time.
245 dist-hook:
246         rm -f $(distdir)/m4/system.h
247 EXTRA_DIST     += m4/system_.h
250 ## ------- ##
251 ## libltdl ##
252 ## ------- ##
254 ltdl/libltdlc.la:
255         cd ltdl && $(MAKE) $(MAKEFLAGS) libltdlc.la
257 ## -------------- ##
258 ## Documentation. ##
259 ## -------------- ##
261 info_TEXINFOS   = doc/m4.texinfo
262 dist_man_MANS   = doc/m4.1
264 # Build the man page once in the srcdir, rather than in every VPATH build
265 # dir, to match how automake builds info pages.  This is safe for 'make
266 # distcheck' since it is distributed pre-built.
267 $(srcdir)/doc/m4.1: configure.ac src/main.c
268         @if test -f src/m4$(EXEEXT); then \
269           echo "Updating the \`man' page \`$@'"; \
270           $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run \
271             help2man -o $@-tmp src/m4$(EXEEXT); \
272           cmp -s $@-tmp $@ || cp $@-tmp $@; \
273           rm -f $@-tmp; \
274         else \
275           echo "WARNING: The \`man' page \`$@' cannot be updated yet."; \
276           echo "         Retry once the program executable is ready."; \
277         fi
279 ## Disabled for now.  Clashes with earlier definition.
280 ## TAGS_FILES   = $(infos_TEXINFOS)
281 ## TAGS_DEPENDENCIES = $(TAGS_FILES)
282 ## ETAGS_ARGS   = --language=none --regex='/@node \([^,]*\)/\1/' $(TAGS_FILES)
284 MAINTAINERCLEANFILES += $(dist_man_MANS)
287 ## --------- ##
288 ## Examples. ##
289 ## --------- ##
291 EXTRA_DIST     += \
292                   examples/WWW/Makefile \
293                   examples/WWW/_footer.htm \
294                   examples/WWW/_header.htm \
295                   examples/WWW/man/Makefile \
296                   examples/WWW/m4lib/bugs.m4 \
297                   examples/WWW/m4lib/changelog.m4 \
298                   examples/WWW/m4lib/download.m4 \
299                   examples/WWW/m4lib/features.m4 \
300                   examples/WWW/m4lib/feedback.m4 \
301                   examples/WWW/m4lib/html.m4 \
302                   examples/WWW/m4lib/index.m4 \
303                   examples/WWW/m4lib/layout.m4 \
304                   examples/WWW/m4lib/lists.m4 \
305                   examples/WWW/m4lib/menu.m4 \
306                   examples/WWW/m4lib/modules.m4 \
307                   examples/WWW/m4lib/news.m4 \
308                   examples/WWW/m4lib/readme.m4 \
309                   examples/WWW/m4lib/setup.m4 \
310                   examples/WWW/m4lib/test.m4 \
311                   examples/WWW/m4lib/thanks.m4 \
312                   examples/WWW/m4lib/thissite.m4 \
313                   examples/WWW/m4lib/tmpl.m4 \
314                   examples/WWW/m4lib/todo.m4 \
315                   examples/WWW/m4lib/uses.m4 \
316                   examples/WWW/m4lib/visions.m4 \
317                   examples/WWW/m4lib/whatis.m4
319 dist_pkgdata_DATA = \
320                   examples/capitalize.m4 \
321                   examples/comments.m4 \
322                   examples/ddivert.m4 \
323                   examples/debug.m4 \
324                   examples/esyscmd.m4 \
325                   examples/exp.m4 \
326                   examples/foreach.m4 \
327                   examples/forloop.m4 \
328                   examples/fstab.m4 \
329                   examples/hanoi.m4 \
330                   examples/incl-test.m4 \
331                   examples/include.m4 \
332                   examples/indir.m4 \
333                   examples/misc.m4 \
334                   examples/multiquotes.m4 \
335                   examples/patsubst.m4 \
336                   examples/pushpop.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/generated.at \
356                   tests/macros.at \
357                   tests/modules.at \
358                   tests/options.at \
359                   tests/others.at \
360                   tests/testsuite.at
362 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
363                   tests/atlocal.in \
364                   tests/generate.awk \
365                   tests/package.m4
367 # Be sure to reexport important environment variables:
368 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
369         CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
370         LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
371         OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
372         CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
373         F77="$(F77)" FFLAGS="$(FFLAGS)" \
374         GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
376 # Using variables so that this snippet is not too wide and can
377 # be used as is in Texinfo @example/@end example.
378 m4_texinfo  = $(srcdir)/doc/m4.texinfo
379 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
380 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
381         $(generate) $(m4_texinfo) >$@t
382         mv $@t $@
384 AUTOM4TE = autom4te
385 AUTOTEST = $(AUTOM4TE) --language=autotest
386 $(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
387         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
388         mv $@.tmp $@
390 $(srcdir)/tests/package.m4: configure.ac
391         {                                       \
392           echo '# Signature of the current package.'; \
393           echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
394           echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
395           echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
396           echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
397           echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
398         } > $(srcdir)/tests/package.m4
400 tests/atconfig: config.status
401         $(SHELL) ./config.status tests/atconfig
402 DISTCLEANFILES += tests/atconfig
404 # FIXME - After 2.60, autoconf might add an option to testsuite to specify
405 # which directory it should output testsuite.log.  Until then, we want it
406 # to drop in tests, so we have to do a cd inside the targets that invoke
407 # testsuite.  As a result, we need an absolute path since the relative
408 # $(srcdir) inside $(TESTSUITE) does not work after cd.
409 CD_TESTDIR      = cd ./tests
411 # Hook the test suite into the check rule
412 check-local: tests/atconfig $(TESTSUITE)
413         $(CD_TESTDIR); \
414         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
415           $(TESTSUITEFLAGS)
417 # Run the test suite on the *installed* tree.
418 installcheck-local: tests/atconfig $(TESTSUITE)
419         $(CD_TESTDIR); \
420         $(SHELL) '$(abs_srcdir)/tests/testsuite' $(TESTS_ENVIRONMENT) \
421           AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
423 # We need to remove any file droppings left behind by testsuite.
424 clean-local-tests:
425         $(CD_TESTDIR); \
426         test ! -f '$(abs_srcdir)/tests/testsuite' || \
427           $(SHELL) '$(abs_srcdir)/tests/testsuite' --clean
429 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test
431 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
432 MAINTAINERCLEANFILES += tests/generated.at '$(TESTSUITE)'
434 clean-local: clean-local-src clean-local-tests
436 ##                                                                      ##
437 ##                   --- RULES FOR THE MAINTAINER ---                   ##
438 ##           You shouldn't need to touch anything below here.           ##
439 ##              (mostly copied from automake/Makefile.am)               ##
440 ##                                                                      ##
442 CVS     = cvs # set it to `:' to avoid CVS operations at dist time
444 # Tag before making distribution.  Also, don't make a distribution if
445 # checks fail.  Also, make sure the NEWS file is up-to-date.
446 cvs-dist: distcheck # maintainer-check
447         @if sed '1,2d;3q' $(srcdir)/NEWS | grep -e "$(VERSION)" > dev/null; \
448           echo "NEWS not updated; not releasing" 1>&2; \
449           exit 1;
450         fi
451         cd $(srcdir) && \
452           $(CVS) -q tag `echo "Release-$(VERSION)" | sed 's/\./-/g'`
453         $(MAKE) dist
455 cvs-diff:
456         thisver=`echo "Release-$(VERSION)" | sed 's/\./-/g'`; \
457         if test -z "$$OLDVERSION"; then \
458           prevno=`echo "$(VERSION)" - 0.01 | bc | sed 's/^\./0./'`; \
459         else prevno="$$OLDVERSION"; fi; \
460         prevver=Release-`echo $$prevno | sed 's/\./-/g'`; \
461         cvs -f rdiff -c -r $$prevver -r $$thisver $(PACKAGE) \
462             > $(PACKAGE)-$$prevno-$(VERSION).diff