]> git.draconx.ca Git - slotifier.git/blobdiff - Makefile.am
Trivial manual fixes.
[slotifier.git] / Makefile.am
index 963a5fbadd482a5fce3cbc5f5aada62d421bf344..24e7919f92eedf5cec50b3b9383e7cdd8017a40b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2018 Nick Bowler
+# Copyright © 2018, 2021, 2023 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.
@@ -6,26 +6,97 @@
 
 ACLOCAL_AMFLAGS = -I m4 -I common/m4
 
-CLEANFILES =
+CLEANFILES = $(EXTRA_LIBRARIES)
 DISTCLEANFILES =
 MOSTLYCLEANFILES =
 MAINTAINERCLEANFILES =
-noinst_LTLIBRARIES =
-EXTRA_DIST =
+EXTRA_LIBRARIES =
+EXTRA_DIST = bootstrap common/scripts/fix-gnulib.pl m4/gnulib-cache.m4 \
+             INSTALL README.md
 
 AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \
-              -DLOCALEDIR=\"$(localedir)\"
+              -I$(DX_BASEDIR)/src -DLOCALEDIR=\"$(localedir)\"
 AM_CFLAGS = $(LIBGERBV_CFLAGS) $(CNEARTREE_CFLAGS)
 
 bin_PROGRAMS = slotifier
 
-slotifier_SOURCES = src/slotifier.c
-slotifier_LDADD = $(LIBGERBV_LIBS) $(CNEARTREE_LIBS) libgnu.la \
-                  $(LTLIBICONV) $(LTLIBINTL) $(HYPOT_LIBM)
+noinst_HEADERS = common/src/help.h common/src/xtra.h
+slotifier_SOURCES = src/options.h common/src/help.c
+EXTRA_slotifier_DEPENDENCIES = $(libslotifiermain_a_OBJECTS)
+slotifier_LDADD = $(EXTRA_slotifier_DEPENDENCIES) \
+                  $(LIBGERBV_LIBS) $(CNEARTREE_LIBS) libgnu.a \
+                  $(LTLIBINTL) $(HYPOT_LIBM)
 $(slotifier_OBJECTS): $(gnulib_headers)
 
+if USE_NLS
+slotifier_SOURCES += common/src/copysym.c common/src/copysym.h
+endif
+
+EXTRA_LIBRARIES += libslotifiermain.a
+libslotifiermain_a_SOURCES = src/slotifier.c
+$(libslotifiermain_a_OBJECTS): $(gnulib_headers) src/options.h
+
 dist_man_MANS = doc/slotifier.1
 
+# When running "make dist" in a VPATH build with a read-only srcdir, Automake
+# will produce a distribution with all files read-only.  Moreover, the files
+# are read-only in distdir when the dist hooks are run.  This hook will
+# manually fix up the permissions.  All dist hooks that modify files in distdir
+# should list unfuck-distdir as a prerequisite.
+dist-hook: unfuck-distdir
+unfuck-distdir:
+       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
+       $(GENERIC_V) : 'CHECK   ' NEWS; \
+         $(AWK) 'NR == 1 && $$NF != "$(PACKAGE_VERSION):" \
+           { print FILENAME ":" NR ":", $$0; exit 1}' \
+           $(distdir)/NEWS || { \
+             echo 'ERROR: *** First line of NEWS should match the package version'; \
+             echo '       *** $(PACKAGE_VERSION), but that does not appear to be the case.'; \
+             echo '       *** Remember to update NEWS before preparing a release.'; \
+             $(TEST_DISTRIBUTION_OR_ERROR); } >&2
+
+OPTFILES = src/options.opt
+.opt.h:
+       $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-options.awk $< >$@.tmp
+       $(AM_V_at) mv -f $@.tmp $@
+$(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk
+MAINTAINERCLEANFILES += $(OPTFILES:.opt=.h)
+EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES)
+
 # Supporting rules for gettext.
 include $(top_srcdir)/common/snippet/gettext.mk
 noinst_DATA = $(MOFILES)
@@ -37,7 +108,8 @@ XGETTEXT_OPTS = -D $(builddir) -D $(srcdir) --from-code=utf-8 \
                 --add-comments=TRANSLATORS: --foreign-user \
                 --msgid-bugs-address=$(PACKAGE_BUGREPORT) \
                 --package-version=$(PACKAGE_VERSION) \
-                --package-name=$(PACKAGE) --keyword=_
+                --package-name=$(PACKAGE) --keyword=_ \
+                --keyword=N_ --keyword=PN_:1c,2
 
 po/$(PACKAGE).pot: $(SOURCES)
        $(AM_V_at)  $(MKDIR_P) $(@D)