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