configury: move autoconf macros to build-aux subdirectory.
[m4/ericb.git] / Makefile.am
blob0cc3e838c43bf28886ad00530bbba02272b5f45e
1 ## Makefile.am - template for generating Makefile via Automake
2 ##
3 ## Copyright (C) 2000-2001, 2003-2010, 2013 Free Software Foundation,
4 ## 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= $(config_aux_dir)/m4
26 SUBDIRS         = po gnu . doc tests/gnu
28 ACLOCAL_AMFLAGS = -I build-aux/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     = -I$(srcdir) -I.
43 AM_CFLAGS       = $(WARN_CFLAGS) $(WERROR_CFLAGS)
44 AM_LDFLAGS      = -export-dynamic -export-symbols-regex ".*"
45 EXTRA_DIST      =
46 BUILT_SOURCES   =
47 CLEANFILES      =
48 DISTCLEANFILES  =
49 MOSTLYCLEANFILES=
51 include_HEADERS =
52 noinst_LTLIBRARIES=
53 lib_LTLIBRARIES =
54 EXTRA_LTLIBRARIES=
56 # Additional configuration.  Version management comes from suggestions
57 # given in build-aux/git-version-gen.
58 AM_CPPFLAGS    += -Ignu -I$(srcdir)/gnu \
59                   -Im4 -I$(srcdir)/m4
60 EXTRA_DIST     += bootstrap cfg.mk maint.mk .version .prev-version \
61                   $(config_macro_dir)/gnulib-cache.m4 $(gitlog_to_changelog)
62 BUILT_SOURCES  += .version
63 .version:
64         echo $(VERSION) > $@-t && mv $@-t $@
65 dist-hook: dist-tarball-version
66 dist-tarball-version:
67         echo $(VERSION) > $(distdir)/.tarball-version
69 dist-hook: ChangeLog
70 changelog_start_date = 2011-01-01
71 $(changelog): FORCE
72         $(AM_V_GEN)if test -d '$(srcdir)/.git'; then    \
73           $(gitlog_to_changelog)                        \
74             --since=$(changelog_start_date) > '$@T';    \
75           rm -f '$@'; mv '$@T' '$@';                    \
76           cat '$(changelog_old)' >> '$@';               \
77         fi
79 MAINTAINERCLEANFILES = \
80                   ABOUT-NLS INSTALL Makefile.in aclocal.m4 \
81                   config-h.in configure stamp-h.in \
82                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
85 ## ------- ##
86 ## GNU M4. ##
87 ## ------- ##
89 bin_PROGRAMS    = src/m4
90 src_m4_SOURCES  = \
91                   src/xstrtoul.c \
92                   src/xstrtol-error.c \
93                   src/xstrtol.c \
94                   src/xstrtol.h \
95                   src/version-etc-fsf.c \
96                   src/version-etc.c \
97                   src/version-etc.h \
98                   src/main.c \
99                   src/m4.h \
100                   src/freeze.c
101 if GETOPT
102 src_m4_SOURCES += \
103                   src/getopt.c \
104                   src/getopt1.c
105 endif
106 if STACKOVF
107 src_m4_SOURCES += src/stackovf.c
108 endif
109 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
110 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
111 src_m4_LDADD    = m4/libm4.la $(LTLIBICONV) $(LTLIBTHREAD)
112 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
114 ##                                                                      ##
115 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
116 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
117 ##     modules are not imported by gnulib-tool, but added manually.     ##
118 ##     (from: gnulib-tool --extract-automake-snippet getopt-posix)      ##
119 ##                                                                      ##
120 if GETOPT
121 BUILT_SOURCES  += src/$(GETOPT_H)
122 endif
123 EXTRA_DIST     += src/getopt.c src/getopt1.c src/getopt.in.h src/getopt_int.h
125 ARG_NONNULL_H = $(srcdir)/$(config_aux_dir)/arg-nonnull.h
127 # We need the following in order to create an <getopt.h> when the
128 # system doesn't have one that works with the given compiler.
129 src/getopt.h: src/getopt.in.h $(ARG_NONNULL_H)
130         $(AM_V_GEN)rm -f $@-t $@ && \
131         { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
132           sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
133               -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
134               -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
135               -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
136               -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
137               < $(srcdir)/src/getopt.in.h; \
138         } > $@-t && \
139         mv -f $@-t $@
140 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
141 ##                                                                      ##
142 ##                     --- END OF PASTED GNULIB ---                     ##
143 ##                                                                      ##
145 ## -------- ##
146 ## Modules. ##
147 ## -------- ##
149 pkgmodincludedir= $(pkgincludedir)/modules
151 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
153 module_ldflags  = -module $(AM_LDFLAGS)
154 module_libadd   = m4/libm4.la
156 pkgmodinclude_HEADERS = modules/m4.h
158 pkglib_LTLIBRARIES = \
159                   modules/gnu.la \
160                   modules/m4.la \
161                   modules/traditional.la
163 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
164 modules_gnu_la_LDFLAGS          = $(module_ldflags)
165 modules_gnu_la_LIBADD           = $(module_libadd)
166 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
168 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
169 modules_m4_la_LDFLAGS           = $(module_ldflags)
170 modules_m4_la_LIBADD            = $(module_libadd)
171 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
173 modules_traditional_la_LDFLAGS  = $(module_ldflags)
174 modules_traditional_la_LIBADD   = $(module_libadd)
176 if USE_GMP
177 pkglib_LTLIBRARIES             += modules/mpeval.la
178 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
179 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
180 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
181 endif
183 module_check    = -rpath /dev/null
184 check_LTLIBRARIES = \
185                   tests/import.la \
186                   tests/modtest.la \
187                   tests/shadow.la \
188                   tests/stdlib.la \
189                   tests/time.la
191 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
192 tests_import_la_LIBADD          = $(module_libadd)
193 tests_import_la_SOURCES         = modules/import.c
195 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
196 tests_modtest_la_LIBADD         = $(module_libadd)
197 tests_modtest_la_SOURCES        = modules/modtest.c
199 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
200 tests_shadow_la_LIBADD          = $(module_libadd)
201 tests_shadow_la_SOURCES         = modules/shadow.c
203 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
204 tests_stdlib_la_LIBADD          = $(module_libadd)
205 tests_stdlib_la_SOURCES         = modules/stdlib.c
207 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
208 tests_time_la_LIBADD            = $(module_libadd)
209 tests_time_la_SOURCES           = modules/time.c
212 ## ----- ##
213 ## libm4 ##
214 ## ----- ##
216 lib_LTLIBRARIES += m4/libm4.la
218 nobase_include_HEADERS = \
219                   m4/m4module.h
220 nobase_pkginclude_HEADERS = \
221                   m4/hash.h \
222                   m4/system.h
223 m4_libm4_la_SOURCES     = \
224                   m4/builtin.c \
225                   m4/debug.c \
226                   m4/hash.c \
227                   m4/input.c \
228                   m4/m4.c \
229                   m4/m4private.h \
230                   m4/macro.c \
231                   m4/module.c \
232                   m4/output.c \
233                   m4/path.c \
234                   m4/resyntax.c \
235                   m4/symtab.c \
236                   m4/syntax.c \
237                   m4/utility.c
238 m4_libm4_la_LIBADD = gnu/libgnu.la \
239                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
240 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) gnu/libgnu.la
242 # This file needs to be regenerated at configure time.
243 dist-hook:
244         rm -f $(distdir)/m4/system.h
245 EXTRA_DIST     += m4/system_.h
248 ## --------- ##
249 ## Examples. ##
250 ## --------- ##
252 EXTRA_DIST     += \
253                   examples/WWW/Makefile \
254                   examples/WWW/_footer.htm \
255                   examples/WWW/_header.htm \
256                   examples/WWW/m4lib/bugs.m4 \
257                   examples/WWW/m4lib/changelog.m4 \
258                   examples/WWW/m4lib/download.m4 \
259                   examples/WWW/m4lib/features.m4 \
260                   examples/WWW/m4lib/feedback.m4 \
261                   examples/WWW/m4lib/html.m4 \
262                   examples/WWW/m4lib/index.m4 \
263                   examples/WWW/m4lib/layout.m4 \
264                   examples/WWW/m4lib/lists.m4 \
265                   examples/WWW/m4lib/menu.m4 \
266                   examples/WWW/m4lib/modules.m4 \
267                   examples/WWW/m4lib/news.m4 \
268                   examples/WWW/m4lib/readme.m4 \
269                   examples/WWW/m4lib/setup.m4 \
270                   examples/WWW/m4lib/test.m4 \
271                   examples/WWW/m4lib/thanks.m4 \
272                   examples/WWW/m4lib/thissite.m4 \
273                   examples/WWW/m4lib/tmpl.m4 \
274                   examples/WWW/m4lib/todo.m4 \
275                   examples/WWW/m4lib/uses.m4 \
276                   examples/WWW/m4lib/visions.m4 \
277                   examples/WWW/m4lib/whatis.m4
279 dist_pkgdata_DATA = \
280                   examples/capitalize.m4 \
281                   examples/capitalize2.m4 \
282                   examples/comments.m4 \
283                   examples/curry.m4 \
284                   examples/ddivert.m4 \
285                   examples/debug.m4 \
286                   examples/esyscmd.m4 \
287                   examples/exp.m4 \
288                   examples/foreach.m4 \
289                   examples/foreach2.m4 \
290                   examples/foreachq.m4 \
291                   examples/foreachq2.m4 \
292                   examples/foreachq3.m4 \
293                   examples/foreachq4.m4 \
294                   examples/forloop.m4 \
295                   examples/forloop2.m4 \
296                   examples/forloop3.m4 \
297                   examples/fstab.m4 \
298                   examples/hanoi.m4 \
299                   examples/incl-test.m4 \
300                   examples/incl.m4 \
301                   examples/include.m4 \
302                   examples/indir.m4 \
303                   examples/join.m4 \
304                   examples/loop.m4 \
305                   examples/misc.m4 \
306                   examples/multiquotes.m4 \
307                   examples/patsubst.m4 \
308                   examples/pushpop.m4 \
309                   examples/quote.m4 \
310                   examples/regexp.m4 \
311                   examples/reverse.m4 \
312                   examples/stack.m4 \
313                   examples/stack_sep.m4 \
314                   examples/sysv-args.m4 \
315                   examples/trace.m4 \
316                   examples/translit.m4 \
317                   examples/undivert.incl \
318                   examples/undivert.m4 \
319                   examples/wrap.m4 \
320                   examples/wrapfifo.m4 \
321                   examples/wraplifo.m4 \
322                   examples/wraplifo2.m4
324 EXTRA_DIST     += \
325                   examples/modtest.m4 \
326                   examples/shadow.m4 \
327                   examples/time.m4 \
328                   examples/time2.m4 \
329                   examples/stdlib.m4
331 ## ----------- ##
332 ## Test suite. ##
333 ## ----------- ##
335 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
336 # how `testsuite' appears in our dependencies.
337 TESTSUITE = $(srcdir)/tests/testsuite
338 TESTSUITE_AT    = \
339                   tests/builtins.at \
340                   tests/freeze.at \
341                   $(srcdir)/tests/generated.at \
342                   tests/macros.at \
343                   tests/modules.at \
344                   tests/options.at \
345                   tests/others.at \
346                   tests/testsuite.at
348 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
349                   tests/atlocal.in \
350                   tests/generate.awk \
351                   $(srcdir)/tests/package.m4
353 # Using variables so that this snippet is not too wide and can
354 # be used as is in Texinfo @example/@end example.
355 m4_texi     = $(srcdir)/doc/m4.texi
356 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
357 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texi)
358         $(generate) $(m4_texi) >$@t
359         mv $@t $@
361 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
362 AUTOTEST = $(AUTOM4TE) --language=autotest
363 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
364         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
365         mv $@.tmp $@
367 # The leading :; works around a bug in {}>f in some bash versions.
368 $(srcdir)/tests/package.m4: .version
369         :; \
370         { \
371           echo '# Signature of the current package.'; \
372           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])'; \
373           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])'; \
374           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])'; \
375           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])'; \
376           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
377         } > $(srcdir)/tests/package.m4
379 tests/atconfig: config.status
380         $(SHELL) ./config.status tests/atconfig
381 DISTCLEANFILES += tests/atconfig
383 # Hook the test suite into the check rule
384 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
385                 $(check_LTLIBRARIES)
386         $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
388 # Run the test suite on the *installed* tree, including any renames
389 # the user requested.
390 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
391                 $(check_LTLIBRARIES)
392         $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
393           AUTOTEST_PATH="$(bindir)" \
394           M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
396 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
397 # will handle that, as part of making a release.
398 DISTCHECK_CONFIGURE_FLAGS = \
399         --disable-assert \
400         --program-prefix=g \
401         --enable-cxx
403 # We need to remove any file droppings left behind by testsuite.
404 clean-local-tests:
405         test ! -f '$(srcdir)/tests/testsuite' || \
406           $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
408 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test \
409                 tests/null.m4 tests/null.out tests/null.err
411 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
412 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
414 clean-local: clean-local-tests
416 FORCE: