-# Copyright © 2011-2013,2019 Nick Bowler
+# Copyright © 2011-2013, 2019-2021 Nick Bowler
#
# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
# This is free software: you are free to do what the fuck you want to.
# There is NO WARRANTY, to the extent permitted by law.
-AUTOMAKE_OPTIONS = parallel-tests color-tests
ACLOCAL_AMFLAGS = -I m4 -I common/m4
# For Gnulib
MOSTLYCLEANFILES =
-noinst_LTLIBRARIES =
+EXTRA_LTLIBRARIES =
AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src \
-I$(top_builddir)/lib -I$(top_srcdir)/lib \
DISTCLEANFILES =
CLEANFILES = src/validtypes.h src/errtab.h src/namespecs.h src/ordspecs.h \
- test/typegen.h
+ test/typegen.h $(EXTRA_LTLIBRARIES)
-EXTRA_DIST = m4/gnulib-cache.m4 src/types.lst src/validtypes.sed \
- src/specs.lst src/namespecs.sed src/ordspecs.sed \
- src/errors.lst src/strtab.sed test/typegen.sh \
- src/parse.y src/parse.stamp src/scan.l src/scan.stamp \
- COPYING.WTFPL2
+EXTRA_DIST = bootstrap common/scripts/fix-gnulib.pl m4/gnulib-cache.m4 \
+ src/types.lst src/validtypes.sed src/specs.lst src/namespecs.sed \
+ src/ordspecs.sed src/errors.lst src/strtab.sed test/typegen.sh \
+ src/parse.y src/parse.stamp src/scan.l src/scan.stamp \
+ COPYING.WTFPL2 README.md INSTALL
dist_man_MANS = doc/man/cdecl99.1 doc/man/libcdecl.3
bin_PROGRAMS = cdecl99
cdecl99_SOURCES = src/cdecl99.c
-cdecl99_LDADD = libcdecl.la libgnu.la $(LTLIBINTL) $(LTLIBREADLINE)
+cdecl99_LDADD = libcdecl.la libgnu.la \
+ $(LTLIBICONV) $(LTLIBINTL) $(LTLIBREADLINE)
$(cdecl99_OBJECTS): $(gnulib_headers)
check_PROGRAMS = test/crossparse
test_randomdecl_LDADD = libcdecl.la libtest.la libgnu.la
$(test_randomdecl_OBJECTS): $(gnulib_headers)
-TESTS_ENVIRONMENT = SHELL='$(SHELL)' LIBTOOL='$(LIBTOOL)' EXEEXT='$(EXEEXT)'
-TEST_EXTENSIONS = .sh
-SH_LOG_COMPILER = $(SHELL)
-
-TESTS = tests/libcdecl-static-symbols.sh tests/randomdecl-sanity.sh \
- tests/crossparse-c-random.sh tests/cdecl99-c-invalid.sh
-
-dist_check_SCRIPTS = tests/randomdecl-sanity.sed $(TESTS)
-
src/parse.lo: src/scan.h
src/scan.lo: src/parse.h
src/parse-decl.lo: src/scan.h src/parse.h
find '$(distdir)' -type f -exec chmod u+w {} +
.PHONY: unfuck-distdir
+GITLOG_FLAGS = --format='%s%n%n%b%n'
+
+dist-hook: generate-changelog
+generate-changelog: unfuck-distdir
+ -: "$${GIT_DIR=$(top_srcdir)/.git}"; \
+ export GIT_DIR; test -d "$$GIT_DIR" || exit 0; \
+ $(top_srcdir)/gitlog-to-changelog $(GITLOG_FLAGS) \
+ >'$(distdir)/ChangeLog.gen' && \
+ mv -f '$(distdir)/ChangeLog.gen' '$(distdir)/ChangeLog'
+ rm -f '$(distdir)/ChangeLog.gen'
+.PHONY: generate-changelog
+
+GENERIC_V = $(GENERIC_V_@AM_V@)
+GENERIC_V_ = $(GENERIC_V_@AM_DEFAULT_V@)
+GENERIC_V_0 = @printf '%2.0s%$(DX_ALIGN_V)s %s\n'
+
+TEST_DISTRIBUTION = false
+TEST_DISTRIBUTION_OR_ERROR = if $(TEST_DISTRIBUTION); \
+ then echo 'Proceeding anyway...'; \
+ else echo 'Run $(MAKE) TEST_DISTRIBUTION=true to ignore this failure.'; \
+ false; \
+ fi
+
+distcheck-hook:
+ $(GENERIC_V) : 'CHECK ' ChangeLog; \
+ $(AWK) '/^Stub/ { print FILENAME ":" NR ":", $$0; exit 1 }' \
+ $(distdir)/ChangeLog || { \
+ echo 'ERROR: *** Packaged ChangeLog was not properly generated from git log.'; \
+ echo ' *** The source version was used instead, but this appears to'; \
+ echo ' *** be the stub from a git checkout. The "git" and "perl"'; \
+ echo ' *** programs are required for ChangeLog generation to work.'; \
+ $(TEST_DISTRIBUTION_OR_ERROR); } >&2
+
# Supporting rules for bison/flex.
BISON_V = $(BISON_V_@AM_V@)
FLEX_V_ = $(FLEX_V_@AM_DEFAULT_V@)
FLEX_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'FLEX ' $<;
-.y.c: ;
-.l.c: ;
+DEV_TOOL_ERROR = { \
+ echo "ERROR: *** $$tool is missing on your system."; \
+ echo " *** Because of this, I cannot compile $$toolsrc, but"; \
+ echo " *** (perhaps because you modified it) the sources appear out"; \
+ echo " *** of date. If $$tool is installed but was not detected by"; \
+ echo " *** configure, consired setting $$toolvar and re-running configure."; \
+ echo " *** See config.log for more details."; } >&2; false
+.y.c: ;
.y.stamp:
+if !HAVE_BISON
+ $(BISON_V)tool=bison toolvar=BISON toolsrc=$<; $(DEV_TOOL_ERROR)
+endif
$(AM_V_at) touch $@.tmp
- $(BISON_V) $(BISON) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
+ $(BISON_V) $(BISON) $(BISON_COMPAT) -o $*.c --defines=$*.h.tmp $(BISONFLAGS) $<
$(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
rm -f $*.h.tmp; \
else \
fi
$(AM_V_at) mv -f $@.tmp $@
+.l.c: ;
.l.stamp:
+if !HAVE_FLEX
+ $(FLEX_V)tool=flex toolvar=FLEX toolsrc=$<; $(DEV_TOOL_ERROR)
+endif
$(AM_V_at) touch $@.tmp
$(FLEX_V) $(FLEX) -o $*.c --header-file=$*.h.tmp $(FLEXFLAGS) $<
$(AM_V_at) if cmp $*.h.tmp $*.h >/dev/null 2>&1; then \
$(MAKE) $(AM_MAKEFLAGS) $<; \
fi
+atlocal: config.status
+ $(AM_V_GEN) :; { \
+ printf ': "$${%s=%s}"\n' \
+ EXEEXT '$(EXEEXT)' \
+ check_PROGRAMS '$(check_PROGRAMS)' \
+ ; } >$@.tmp
+ $(AM_V_at) mv -f $@.tmp $@
+check_DATA = atlocal
+CLEANFILES += atlocal
+
include $(top_srcdir)/lib/gnulib.mk
include $(top_srcdir)/common/snippet/glconfig.mk
+include $(top_srcdir)/common/snippet/autotest.mk