configury: don't install modules to pkglibexecdir.
[m4/ericb.git] / Makefile.am
blobad48ada165647b861295687a944acf8b5e4bfe14
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 # Prime the variables that will be augmented by libtool.
32 # FIXME - the -export-symbols-regex ".*" is a hack to work around the
33 # fact that on cygwin, the convenience library libltdl exports symbols,
34 # which effectively disables the auto-exporting of all other symbols.
35 # Revisit this if libtool on cygwin improves.
36 # See http://lists.gnu.org/archive/html/libtool-patches/2007-02/msg00062.html
37 AM_CPPFLAGS     =
38 AM_LDFLAGS      = -export-dynamic -export-symbols-regex ".*"
39 EXTRA_DIST      =
40 BUILT_SOURCES   =
41 CLEANFILES      =
42 DISTCLEANFILES  =
43 MOSTLYCLEANFILES=
45 include_HEADERS =
46 noinst_LTLIBRARIES=
47 lib_LTLIBRARIES =
48 EXTRA_LTLIBRARIES=
50 # Include Libtool's rules.
51 include ltdl/Makefile.inc
53 # Additional configuration.  Version management comes from suggestions
54 # given in build-aux/git-version-gen.
55 syntax_check_exceptions = \
56         .x-sc_cast_of_argument_to_free \
57         .x-sc_prohibit_tab_based_indentation \
58         .x-sc_require_config_h \
59         .x-sc_require_config_h_first \
60         .x-update-copyright
62 AM_CPPFLAGS    += -Ignu -I$(srcdir)/gnu \
63                   -Im4 -I$(srcdir)/m4
64 EXTRA_DIST     += bootstrap cfg.mk maint.mk .version .prev-version \
65                   $(config_macro_dir)/gnulib-cache.m4 \
66                   $(syntax_check_exceptions)
67 BUILT_SOURCES  += .version
68 .version:
69         echo $(VERSION) > $@-t && mv $@-t $@
70 dist-hook: dist-tarball-version
71 dist-tarball-version:
72         echo $(VERSION) > $(distdir)/.tarball-version
73 MAINTAINERCLEANFILES = \
74                   ABOUT-NLS INSTALL Makefile.in aclocal.m4 \
75                   config-h.in configure stamp-h.in \
76                   po/cat-id-tbl.c po/m4.pot po/stamp-cat-id
79 ## ------- ##
80 ## GNU M4. ##
81 ## ------- ##
83 bin_PROGRAMS    = src/m4
84 src_m4_SOURCES  = \
85                   src/xstrtoul.c \
86                   src/xstrtol-error.c \
87                   src/xstrtol.c \
88                   src/xstrtol.h \
89                   src/version-etc-fsf.c \
90                   src/version-etc.c \
91                   src/version-etc.h \
92                   src/main.c \
93                   src/m4.h \
94                   src/freeze.c
95 if GETOPT
96 src_m4_SOURCES += \
97                   src/getopt.c \
98                   src/getopt1.c
99 endif
100 if STACKOVF
101 src_m4_SOURCES += src/stackovf.c
102 endif
103 src_m4_CPPFLAGS = $(AM_CPPFLAGS) -Isrc -I$(srcdir)/src
104 src_m4_LDFLAGS  = $(AM_LDFLAGS) $(DLPREOPEN)
105 src_m4_LDADD    = m4/libm4.la $(LTLIBICONV)
106 src_m4_DEPENDENCIES = $(PREOPEN_DEPENDENCIES) m4/libm4.la
108 ##                                                                      ##
109 ##                 --- PASTED MANUALLY FROM GNULIB ---                  ##
110 ##     To avoid adding unnecessary objects to libm4.la these gnulib     ##
111 ##     modules are not imported by gnulib-tool, but added manually.     ##
112 ##     (from: gnulib-tool --extract-automake-snippet getopt-posix)      ##
113 ##                                                                      ##
114 if GETOPT
115 BUILT_SOURCES  += src/$(GETOPT_H)
116 endif
117 EXTRA_DIST     += src/getopt.c src/getopt1.c src/getopt.in.h src/getopt_int.h
119 ARG_NONNULL_H = $(srcdir)/$(config_aux_dir)/arg-nonnull.h
121 # We need the following in order to create an <getopt.h> when the
122 # system doesn't have one that works with the given compiler.
123 src/getopt.h: src/getopt.in.h $(ARG_NONNULL_H)
124         $(AM_V_GEN)rm -f $@-t $@ && \
125         { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
126           sed -e 's|@''HAVE_GETOPT_H''@|$(HAVE_GETOPT_H)|g' \
127               -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
128               -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
129               -e 's|@''NEXT_GETOPT_H''@|$(NEXT_GETOPT_H)|g' \
130               -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
131               < $(srcdir)/src/getopt.in.h; \
132         } > $@-t && \
133         mv -f $@-t $@
134 MOSTLYCLEANFILES += src/getopt.h src/getopt.h-t
135 ##                                                                      ##
136 ##                     --- END OF PASTED GNULIB ---                     ##
137 ##                                                                      ##
139 ## -------- ##
140 ## Modules. ##
141 ## -------- ##
143 pkgmodincludedir= $(pkgincludedir)/modules
145 ETAGS_ARGS      = --regex='/M4BUILTIN_HANDLER[ \t]*)\([^)]*\)/\1/'
147 module_ldflags  = -module $(AM_LDFLAGS)
148 module_libadd   = m4/libm4.la
150 pkgmodinclude_HEADERS = modules/m4.h
152 pkglib_LTLIBRARIES = \
153                   modules/gnu.la \
154                   modules/load.la \
155                   modules/m4.la \
156                   modules/traditional.la
158 EXTRA_modules_gnu_la_SOURCES    = modules/format.c
159 modules_gnu_la_LDFLAGS          = $(module_ldflags)
160 modules_gnu_la_LIBADD           = $(module_libadd)
161 EXTRA_DIST                     += $(EXTRA_modules_gnu_la_SOURCES)
163 modules_load_la_LDFLAGS         = $(module_ldflags)
164 modules_load_la_LIBADD          = $(module_libadd)
166 EXTRA_modules_m4_la_SOURCES     = modules/evalparse.c
167 modules_m4_la_LDFLAGS           = $(module_ldflags)
168 modules_m4_la_LIBADD            = $(module_libadd)
169 EXTRA_DIST                     += $(EXTRA_modules_m4_la_SOURCES)
171 modules_traditional_la_LDFLAGS  = $(module_ldflags)
172 modules_traditional_la_LIBADD   = $(module_libadd)
174 if USE_GMP
175 pkglib_LTLIBRARIES             += modules/mpeval.la
176 EXTRA_modules_mpeval_la_SOURCES = modules/evalparse.c
177 modules_mpeval_la_LDFLAGS       = $(module_ldflags)
178 modules_mpeval_la_LIBADD        = $(module_libadd) $(LIBADD_GMP)
179 endif
181 ## Disabled for now.  It is too fragile to be useful.
182 ## pkglib_LTLIBRARIES         += modules/perl.la
183 ## modules_perl_la_CPPFLAGS     = `$(PERL) -MExtUtils::Embed -e ccopts`
184 ## modules_perl_la_LDFLAGS              = \
185 ##                $(module_ldflags) `$(PERL) -MExtUtils::Embed -e ldopts`
186 ## modules_perl_la_LIBADD               = $(module_libadd)
187 ## BUILT_SOURCES                        = perlxsi.c
188 ## DISTCLEANFILES                      += $(BUILT_SOURCES)
190 ## perlxsi.c:
191 ##      $(PERL) -MExtUtils::Embed -e xsinit -- -o perlxsi.c
193 ## but we should still distribute it, because it is listed in POTFILES.in:
194 EXTRA_DIST += modules/perl.c
196 module_check    = -rpath /dev/null
197 check_LTLIBRARIES = \
198                   tests/import.la \
199                   tests/modtest.la \
200                   tests/shadow.la \
201                   tests/stdlib.la \
202                   tests/time.la
204 tests_import_la_LDFLAGS         = $(module_ldflags) $(module_check)
205 tests_import_la_LIBADD          = $(module_libadd)
206 tests_import_la_SOURCES         = modules/import.c
208 tests_modtest_la_LDFLAGS        = $(module_ldflags) $(module_check)
209 tests_modtest_la_LIBADD         = $(module_libadd)
210 tests_modtest_la_SOURCES        = modules/modtest.c
212 tests_shadow_la_LDFLAGS         = $(module_ldflags) $(module_check)
213 tests_shadow_la_LIBADD          = $(module_libadd)
214 tests_shadow_la_SOURCES         = modules/shadow.c
216 tests_stdlib_la_LDFLAGS         = $(module_ldflags) $(module_check)
217 tests_stdlib_la_LIBADD          = $(module_libadd)
218 tests_stdlib_la_SOURCES         = modules/stdlib.c
220 tests_time_la_LDFLAGS           = $(module_ldflags) $(module_check)
221 tests_time_la_LIBADD            = $(module_libadd)
222 tests_time_la_SOURCES           = modules/time.c
224 EXTRA_DIST     += \
225                   modules/modtest.m4 \
226                   modules/shadow.m4 \
227                   modules/time.m4 \
228                   modules/time2.m4 \
229                   modules/stdlib.m4
231 ## ----- ##
232 ## libm4 ##
233 ## ----- ##
235 lib_LTLIBRARIES += m4/libm4.la
237 nobase_include_HEADERS = \
238                   m4/m4module.h
239 nobase_pkginclude_HEADERS = \
240                   m4/hash.h \
241                   m4/system.h
242 m4_libm4_la_SOURCES     = \
243                   m4/builtin.c \
244                   m4/debug.c \
245                   m4/hash.c \
246                   m4/input.c \
247                   m4/m4.c \
248                   m4/m4private.h \
249                   m4/macro.c \
250                   m4/module.c \
251                   m4/output.c \
252                   m4/path.c \
253                   m4/resyntax.c \
254                   m4/symtab.c \
255                   m4/syntax.c \
256                   m4/utility.c
257 m4_libm4_la_LIBADD = gnu/libgnu.la \
258                   $(LIBLTDL) $(LTLIBINTL) $(LIBADD_DL)
259 m4_libm4_la_DEPENDENCIES = $(LTDLDEPS) gnu/libgnu.la
261 # This file needs to be regenerated at configure time.
262 dist-hook:
263         rm -f $(distdir)/m4/system.h
264 EXTRA_DIST     += m4/system_.h
267 ## --------- ##
268 ## Examples. ##
269 ## --------- ##
271 EXTRA_DIST     += \
272                   examples/WWW/Makefile \
273                   examples/WWW/_footer.htm \
274                   examples/WWW/_header.htm \
275                   examples/WWW/m4lib/bugs.m4 \
276                   examples/WWW/m4lib/changelog.m4 \
277                   examples/WWW/m4lib/download.m4 \
278                   examples/WWW/m4lib/features.m4 \
279                   examples/WWW/m4lib/feedback.m4 \
280                   examples/WWW/m4lib/html.m4 \
281                   examples/WWW/m4lib/index.m4 \
282                   examples/WWW/m4lib/layout.m4 \
283                   examples/WWW/m4lib/lists.m4 \
284                   examples/WWW/m4lib/menu.m4 \
285                   examples/WWW/m4lib/modules.m4 \
286                   examples/WWW/m4lib/news.m4 \
287                   examples/WWW/m4lib/readme.m4 \
288                   examples/WWW/m4lib/setup.m4 \
289                   examples/WWW/m4lib/test.m4 \
290                   examples/WWW/m4lib/thanks.m4 \
291                   examples/WWW/m4lib/thissite.m4 \
292                   examples/WWW/m4lib/tmpl.m4 \
293                   examples/WWW/m4lib/todo.m4 \
294                   examples/WWW/m4lib/uses.m4 \
295                   examples/WWW/m4lib/visions.m4 \
296                   examples/WWW/m4lib/whatis.m4
298 dist_pkgdata_DATA = \
299                   examples/capitalize.m4 \
300                   examples/capitalize2.m4 \
301                   examples/comments.m4 \
302                   examples/curry.m4 \
303                   examples/ddivert.m4 \
304                   examples/debug.m4 \
305                   examples/esyscmd.m4 \
306                   examples/exp.m4 \
307                   examples/foreach.m4 \
308                   examples/foreach2.m4 \
309                   examples/foreachq.m4 \
310                   examples/foreachq2.m4 \
311                   examples/foreachq3.m4 \
312                   examples/foreachq4.m4 \
313                   examples/forloop.m4 \
314                   examples/forloop2.m4 \
315                   examples/forloop3.m4 \
316                   examples/fstab.m4 \
317                   examples/hanoi.m4 \
318                   examples/incl-test.m4 \
319                   examples/incl.m4 \
320                   examples/include.m4 \
321                   examples/indir.m4 \
322                   examples/join.m4 \
323                   examples/loop.m4 \
324                   examples/misc.m4 \
325                   examples/multiquotes.m4 \
326                   examples/patsubst.m4 \
327                   examples/pushpop.m4 \
328                   examples/quote.m4 \
329                   examples/regexp.m4 \
330                   examples/reverse.m4 \
331                   examples/stack.m4 \
332                   examples/stack_sep.m4 \
333                   examples/sysv-args.m4 \
334                   examples/trace.m4 \
335                   examples/translit.m4 \
336                   examples/undivert.incl \
337                   examples/undivert.m4 \
338                   examples/wrap.m4 \
339                   examples/wrapfifo.m4 \
340                   examples/wraplifo.m4 \
341                   examples/wraplifo2.m4
343 ## ----------- ##
344 ## Test suite. ##
345 ## ----------- ##
347 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
348 # how `testsuite' appears in our dependencies.
349 TESTSUITE = $(srcdir)/tests/testsuite
350 TESTSUITE_AT    = \
351                   tests/builtins.at \
352                   tests/freeze.at \
353                   $(srcdir)/tests/generated.at \
354                   tests/macros.at \
355                   tests/modules.at \
356                   tests/options.at \
357                   tests/others.at \
358                   tests/testsuite.at
360 EXTRA_DIST     += $(TESTSUITE) $(TESTSUITE_AT) $(OTHER_FILES) \
361                   tests/atlocal.in \
362                   tests/generate.awk \
363                   $(srcdir)/tests/package.m4
365 # Using variables so that this snippet is not too wide and can
366 # be used as is in Texinfo @example/@end example.
367 m4_texinfo  = $(srcdir)/doc/m4.texinfo
368 generate    = $(AWK) -f $(srcdir)/tests/generate.awk
369 $(srcdir)/tests/generated.at: tests/generate.awk $(m4_texinfo)
370         $(generate) $(m4_texinfo) >$@t
371         mv $@t $@
373 AUTOM4TE = $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run autom4te
374 AUTOTEST = $(AUTOM4TE) --language=autotest
375 $(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT)
376         $(AUTOTEST) -I '$(srcdir)/tests' -o $@.tmp $@.at
377         mv $@.tmp $@
379 # The leading :; works around a bug in {}>f in some bash versions.
380 $(srcdir)/tests/package.m4: .version
381         :; \
382         { \
383           echo '# Signature of the current package.'; \
384           echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])'; \
385           echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])'; \
386           echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])'; \
387           echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])'; \
388           echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
389         } > $(srcdir)/tests/package.m4
391 tests/atconfig: config.status
392         $(SHELL) ./config.status tests/atconfig
393 DISTCLEANFILES += tests/atconfig
395 # Hook the test suite into the check rule
396 check-local: tests/atconfig tests/atlocal tests/m4 $(TESTSUITE) \
397                 $(check_LTLIBRARIES)
398         $(SHELL) '$(srcdir)/tests/testsuite' -C tests $(TESTSUITEFLAGS)
400 # Run the test suite on the *installed* tree, including any renames
401 # the user requested.
402 installcheck-local: tests/atconfig tests/atlocal $(TESTSUITE) \
403                 $(check_LTLIBRARIES)
404         $(SHELL) '$(srcdir)/tests/testsuite' -C tests \
405           AUTOTEST_PATH="$(bindir)" \
406           M4="`echo m4 | sed '$(program_transform_name)'`" $(TESTSUITEFLAGS)
408 # Enough users install GNU M4 as gm4 that we make sure 'make installcheck'
409 # will handle that, as part of making a release.
410 DISTCHECK_CONFIGURE_FLAGS = --disable-assert --program-prefix=g
412 # We need to remove any file droppings left behind by testsuite.
413 clean-local-tests:
414         test ! -f '$(srcdir)/tests/testsuite' || \
415           $(SHELL) '$(srcdir)/tests/testsuite' -C tests --clean
417 OTHER_FILES     = tests/iso8859.m4 tests/stackovf.test \
418                 tests/null.m4 tests/null.out tests/null.err
420 DISTCLEANFILES += tests/atconfig tests/atlocal tests/m4
421 MAINTAINERCLEANFILES += $(srcdir)/tests/generated.at '$(TESTSUITE)'
423 clean-local: clean-local-tests