maint: move to gitlog-to-changelog.
[m4/ericb.git] / Makefile.am
blob1e10f00644f2dca6f2d81f87b3166dc4ac7aa82a
1 ## Makefile.am - template for generating Makefile via Automake
2 ##
3 ## Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
4 ## 2010 Free Software Foundation, Inc.
5 ##
6 ## This file is part of GNU M4.
7 ##
8 ## GNU M4 is free software: you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation, either version 3 of the License, or
11 ## (at your option) any later version.
13 ## GNU M4 is distributed in the hope that it will be useful,
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ## GNU General Public License for more details.
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 ## Written by Gary V. Vaughan <gary@gnu.org>
23 config_aux_dir  = build-aux
24 config_macro_dir= ltdl/m4
26 SUBDIRS         = po gnu . doc tests/gnu
28 ACLOCAL_AMFLAGS = -I ltdl/m4
29 AUTOMAKE_OPTIONS = nostdinc
31 gitlog_to_changelog     = $(srcdir)/$(config_aux_dir)/gitlog-to-changelog
32 git_log_fix             = $(srcdir)/$(config_aux_dir)/git-log-fix
33 changelog               = $(srcdir)/ChangeLog
34 changelog_old           = $(srcdir)/ChangeLog.old
36 # Prime the variables that will be augmented by libtool.
37 # FIXME - the -export-symbols-regex ".*" is a hack to work around the
38 # fact that on cygwin, the convenience library libltdl exports symbols,
39 # which effectively disables the auto-exporting of all other symbols.
40 # Revisit this if libtool on cygwin improves.
41 # See http://lists.gnu.org/archive/html/libtool-patches/2007-02/msg00062.html
42 AM_CPPFLAGS     =
43 AM_LDFLAGS      = -export-dynamic -export-symbols-regex ".*"
44 EXTRA_DIST      =
45 BUILT_SOURCES   =
46 CLEANFILES      =
47 DISTCLEANFILES  =
48 MOSTLYCLEANFILES=
50 include_HEADERS =
51 noinst_LTLIBRARIES=
52 lib_LTLIBRARIES =
53 EXTRA_LTLIBRARIES=
55 # Include Libtool's rules.
56 include ltdl/Makefile.inc
58 # Additional configuration.  Version management comes from suggestions
59 # given in build-aux/git-version-gen.
60 syntax_check_exceptions = \
61         .x-sc_cast_of_argument_to_free \
62         .x-sc_prohibit_tab_based_indentation \
63         .x-sc_require_config_h \
64         .x-sc_require_config_h_first \
65         .x-update-copyright
67 AM_CPPFLAGS    += -Ignu -I$(srcdir)/gnu \
68                   -Im4 -I$(srcdir)/m4
69 EXTRA_DIST     += bootstrap cfg.mk maint.mk .version .prev-version \
70                   $(config_macro_dir)/gnulib-cache.m4 \
71                   $(syntax_check_exceptions) $(gitlog_to_changelog)
72 BUILT_SOURCES  += .version
73 .version:
74         echo $(VERSION) > $@-t && mv $@-t $@
75 dist-hook: dist-tarball-version
76 dist-tarball-version:
77         echo $(VERSION) > $(distdir)/.tarball-version
79 dist-hook: ChangeLog
80 changelog_start_date = 2011-01-01
81 $(changelog): FORCE
82         $(AM_V_GEN)if test -d '$(srcdir)/.git'; then    \
83           $(gitlog_to_changelog)                        \
84             --since=$(changelog_start_date) > '$@T';    \
85           rm -f '$@'; mv '$@T' '$@';                    \
86           cat '$(changelog_old)' >> '$@';               \
87         fi
89 MAINTAINERCLEANFILES = \
90                   ABOUT-NLS INSTALL Makefile.in aclocal.m4 \
91                   config-h.in configure stamp-h.in \
92                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
95 ## ------- ##
96 ## GNU M4. ##
97 ## ------- ##
99 bin_PROGRAMS    = src/m4
100 src_m4_SOURCES  = \
101                   src/xstrtoul.c \
102                   src/xstrtol-error.c \
103                   src/xstrtol.c \
104                   src/xstrtol.h \
105                   src/version-etc-fsf.c \
106                   src/version-etc.c \
107                   src/version-etc.h \
108                   src/main.c \
109                   src/m4.h \
110                   src/freeze.c
111 if GETOPT
112 src_m4_SOURCES += \
113                   src/getopt.c \
114                   src/getopt1.c
115 endif
116 if STACKOVF
117 src_m4_SOURCES += src/stackovf.c
118 endif
119 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
120 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
121 src_m4_LDADD    = m4/libm4.la $(LTLIBICONV)
122 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
124 ##                                                                      ##
125 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
126 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
127 ##     modules are not imported by gnulib-tool, but added manually.     ##
128 ##     (from: gnulib-tool --extract-automake-snippet getopt-posix)      ##
129 ##                                                                      ##
130 if GETOPT
131 BUILT_SOURCES  += src/$(GETOPT_H)
132 endif
133 EXTRA_DIST     += src/getopt.c src/getopt1.c src/getopt.in.h src/getopt_int.h
135 ARG_NONNULL_H = $(srcdir)/$(config_aux_dir)/arg-nonnull.h
137 # We need the following in order to create an <getopt.h> when the
138 # system doesn't have one that works with the given compiler.
139 src/getopt.h: src/getopt.in.h $(ARG_NONNULL_H)
140         $(AM_V_GEN)rm -f $@-t $@ && \
141         { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
142           sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
143               -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
144               -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
145               -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
146               -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
147               < $(srcdir)/src/getopt.in.h; \
148         } > $@-t && \
149         mv -f $@-t $@
150 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
151 ##                                                                      ##
152 ##                     --- END OF PASTED GNULIB ---                     ##
153 ##                                                                      ##
155 ## -------- ##
156 ## Modules. ##
157 ## -------- ##
159 pkgmodincludedir= $(pkgincludedir)/modules
161 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
163 module_ldflags  = -module $(AM_LDFLAGS)
164 module_libadd   = m4/libm4.la
166 pkgmodinclude_HEADERS = modules/m4.h
168 pkglib_LTLIBRARIES = \
169                   modules/gnu.la \
170                   modules/load.la \
171                   modules/m4.la \
172                   modules/traditional.la
174 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
175 modules_gnu_la_LDFLAGS          = $(module_ldflags)
176 modules_gnu_la_LIBADD           = $(module_libadd)
177 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
179 modules_load_la_LDFLAGS         = $(module_ldflags)
180 modules_load_la_LIBADD          = $(module_libadd)
182 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
183 modules_m4_la_LDFLAGS           = $(module_ldflags)
184 modules_m4_la_LIBADD            = $(module_libadd)
185 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
187 modules_traditional_la_LDFLAGS  = $(module_ldflags)
188 modules_traditional_la_LIBADD   = $(module_libadd)
190 if USE_GMP
191 pkglib_LTLIBRARIES             += modules/mpeval.la
192 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
193 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
194 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
195 endif
197 ## Disabled for now.  It is too fragile to be useful.
198 ## pkglib_LTLIBRARIES         += modules/perl.la
199 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
200 ## modules_perl_la_LDFLAGS              = \
201 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
202 ## modules_perl_la_LIBADD               = $(module_libadd)
203 ## BUILT_SOURCES                        = perlxsi.c
204 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
206 ## perlxsi.c:
207 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
209 ## but we should still distribute it, because it is listed in POTFILES.in:
210 EXTRA_DIST += modules/perl.c
212 module_check    = -rpath /dev/null
213 check_LTLIBRARIES = \
214                   tests/import.la \
215                   tests/modtest.la \
216                   tests/shadow.la \
217                   tests/stdlib.la \
218                   tests/time.la
220 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
221 tests_import_la_LIBADD          = $(module_libadd)
222 tests_import_la_SOURCES         = modules/import.c
224 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
225 tests_modtest_la_LIBADD         = $(module_libadd)
226 tests_modtest_la_SOURCES        = modules/modtest.c
228 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
229 tests_shadow_la_LIBADD          = $(module_libadd)
230 tests_shadow_la_SOURCES         = modules/shadow.c
232 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
233 tests_stdlib_la_LIBADD          = $(module_libadd)
234 tests_stdlib_la_SOURCES         = modules/stdlib.c
236 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
237 tests_time_la_LIBADD            = $(module_libadd)
238 tests_time_la_SOURCES           = modules/time.c
240 EXTRA_DIST     += \
241                   modules/modtest.m4 \
242                   modules/shadow.m4 \
243                   modules/time.m4 \
244                   modules/time2.m4 \
245                   modules/stdlib.m4
247 ## ----- ##
248 ## libm4 ##
249 ## ----- ##
251 lib_LTLIBRARIES += m4/libm4.la
253 nobase_include_HEADERS = \
254                   m4/m4module.h
255 nobase_pkginclude_HEADERS = \
256                   m4/hash.h \
257                   m4/system.h
258 m4_libm4_la_SOURCES     = \
259                   m4/builtin.c \
260                   m4/debug.c \
261                   m4/hash.c \
262                   m4/input.c \
263                   m4/m4.c \
264                   m4/m4private.h \
265                   m4/macro.c \
266                   m4/module.c \
267                   m4/output.c \
268                   m4/path.c \
269                   m4/resyntax.c \
270                   m4/symtab.c \
271                   m4/syntax.c \
272                   m4/utility.c
273 m4_libm4_la_LIBADD = gnu/libgnu.la \
274                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
275 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) gnu/libgnu.la
277 # This file needs to be regenerated at configure time.
278 dist-hook:
279         rm -f $(distdir)/m4/system.h
280 EXTRA_DIST     += m4/system_.h
283 ## --------- ##
284 ## Examples. ##
285 ## --------- ##
287 EXTRA_DIST     += \
288                   examples/WWW/Makefile \
289                   examples/WWW/_footer.htm \
290                   examples/WWW/_header.htm \
291                   examples/WWW/m4lib/bugs.m4 \
292                   examples/WWW/m4lib/changelog.m4 \
293                   examples/WWW/m4lib/download.m4 \
294                   examples/WWW/m4lib/features.m4 \
295                   examples/WWW/m4lib/feedback.m4 \
296                   examples/WWW/m4lib/html.m4 \
297                   examples/WWW/m4lib/index.m4 \
298                   examples/WWW/m4lib/layout.m4 \
299                   examples/WWW/m4lib/lists.m4 \
300                   examples/WWW/m4lib/menu.m4 \
301                   examples/WWW/m4lib/modules.m4 \
302                   examples/WWW/m4lib/news.m4 \
303                   examples/WWW/m4lib/readme.m4 \
304                   examples/WWW/m4lib/setup.m4 \
305                   examples/WWW/m4lib/test.m4 \
306                   examples/WWW/m4lib/thanks.m4 \
307                   examples/WWW/m4lib/thissite.m4 \
308                   examples/WWW/m4lib/tmpl.m4 \
309                   examples/WWW/m4lib/todo.m4 \
310                   examples/WWW/m4lib/uses.m4 \
311                   examples/WWW/m4lib/visions.m4 \
312                   examples/WWW/m4lib/whatis.m4
314 dist_pkgdata_DATA = \
315                   examples/capitalize.m4 \
316                   examples/capitalize2.m4 \
317                   examples/comments.m4 \
318                   examples/curry.m4 \
319                   examples/ddivert.m4 \
320                   examples/debug.m4 \
321                   examples/esyscmd.m4 \
322                   examples/exp.m4 \
323                   examples/foreach.m4 \
324                   examples/foreach2.m4 \
325                   examples/foreachq.m4 \
326                   examples/foreachq2.m4 \
327                   examples/foreachq3.m4 \
328                   examples/foreachq4.m4 \
329                   examples/forloop.m4 \
330                   examples/forloop2.m4 \
331                   examples/forloop3.m4 \
332                   examples/fstab.m4 \
333                   examples/hanoi.m4 \
334                   examples/incl-test.m4 \
335                   examples/incl.m4 \
336                   examples/include.m4 \
337                   examples/indir.m4 \
338                   examples/join.m4 \
339                   examples/loop.m4 \
340                   examples/misc.m4 \
341                   examples/multiquotes.m4 \
342                   examples/patsubst.m4 \
343                   examples/pushpop.m4 \
344                   examples/quote.m4 \
345                   examples/regexp.m4 \
346                   examples/reverse.m4 \
347                   examples/stack.m4 \
348                   examples/stack_sep.m4 \
349                   examples/sysv-args.m4 \
350                   examples/trace.m4 \
351                   examples/translit.m4 \
352                   examples/undivert.incl \
353                   examples/undivert.m4 \
354                   examples/wrap.m4 \
355                   examples/wrapfifo.m4 \
356                   examples/wraplifo.m4 \
357                   examples/wraplifo2.m4
359 ## ----------- ##
360 ## Test suite. ##
361 ## ----------- ##
363 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
364 # how `testsuite' appears in our dependencies.
365 TESTSUITE = $(srcdir)/tests/testsuite
366 TESTSUITE_AT    = \
367                   tests/builtins.at \
368                   tests/freeze.at \
369                   $(srcdir)/tests/generated.at \
370                   tests/macros.at \
371                   tests/modules.at \
372                   tests/options.at \
373                   tests/others.at \
374                   tests/testsuite.at
376 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
377                   tests/atlocal.in \
378                   tests/generate.awk \
379                   $(srcdir)/tests/package.m4
381 # Using variables so that this snippet is not too wide and can
382 # be used as is in Texinfo @example/@end example.
383 m4_texi     = $(srcdir)/doc/m4.texi
384 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
385 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texi)
386         $(generate) $(m4_texi) >$@t
387         mv $@t $@
389 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
390 AUTOTEST = $(AUTOM4TE) --language=autotest
391 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
392         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
393         mv $@.tmp $@
395 # The leading :; works around a bug in {}>f in some bash versions.
396 $(srcdir)/tests/package.m4: .version
397         :; \
398         { \
399           echo '# Signature of the current package.'; \
400           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])'; \
401           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])'; \
402           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])'; \
403           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])'; \
404           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
405         } > $(srcdir)/tests/package.m4
407 tests/atconfig: config.status
408         $(SHELL) ./config.status tests/atconfig
409 DISTCLEANFILES += tests/atconfig
411 # Hook the test suite into the check rule
412 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
413                 $(check_LTLIBRARIES)
414         $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
416 # Run the test suite on the *installed* tree, including any renames
417 # the user requested.
418 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
419                 $(check_LTLIBRARIES)
420         $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
421           AUTOTEST_PATH="$(bindir)" \
422           M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
424 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
425 # will handle that, as part of making a release.
426 DISTCHECK_CONFIGURE_FLAGS = --disable-assert --program-prefix=g
428 # We need to remove any file droppings left behind by testsuite.
429 clean-local-tests:
430         test ! -f '$(srcdir)/tests/testsuite' || \
431           $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
433 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test \
434                 tests/null.m4 tests/null.out tests/null.err
436 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
437 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
439 clean-local: clean-local-tests