Automake insists that any file present in a Makefile.am 'include' must
be present, but it has no idea about the GNU make extension
'sinclude'. Use this to our advantage: as long as Makefile.inc has
nothing other than variable modifications (done in the previous
patch), and our rules properly generate it when needed (thanks to
generator_built), then running 'make' will still build all the right
man pages, and 'make dist' will still distribute all the right
generated .pod files for the sake of someone building the tarball
without OCaml, all without having to keep a generated file in git.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
docs/Makefile.am | 5 ++-
docs/Makefile.inc | 98 ---------------------------------------------
generator/generator | 7 ++--
.gitignore | 1 +
4 files changed, 9 insertions(+), 102 deletions(-)
delete mode 100644 docs/Makefile.inc
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 30d4603..30a972d 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -19,7 +19,10 @@ include $(top_srcdir)/subdir-rules.mk
api_built=
-include $(srcdir)/Makefile.inc
+# Our use of sinclude to bypass Automake is intentional; this file won't
+# exist in a fresh git checkout until after the generator has run, but
+# should already be present in any released tarball.
+sinclude $(srcdir)/Makefile.inc
generator_built = \
Makefile.inc \
diff --git a/docs/Makefile.inc b/docs/Makefile.inc
deleted file mode 100644
index fb64b62..0000000
--- a/docs/Makefile.inc
+++ /dev/null
@@ -1,98 +0,0 @@
-# NBD client library in userspace
-# WARNING: THIS FILE IS GENERATED FROM
-# generator/generator
-# ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
-#
-# Copyright (C) 2013-2019 Red Hat Inc.
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-api_built += \
- nbd_set_debug \
- nbd_get_debug \
- nbd_set_debug_callback \
- nbd_clear_debug_callback \
- nbd_set_handle_name \
- nbd_get_handle_name \
- nbd_set_export_name \
- nbd_get_export_name \
- nbd_set_tls \
- nbd_get_tls \
- nbd_set_tls_certificates \
- nbd_set_tls_verify_peer \
- nbd_get_tls_verify_peer \
- nbd_set_tls_username \
- nbd_get_tls_username \
- nbd_set_tls_psk_file \
- nbd_add_meta_context \
- nbd_connect_uri \
- nbd_connect_unix \
- nbd_connect_tcp \
- nbd_connect_command \
- nbd_is_read_only \
- nbd_can_flush \
- nbd_can_fua \
- nbd_is_rotational \
- nbd_can_trim \
- nbd_can_zero \
- nbd_can_df \
- nbd_can_multi_conn \
- nbd_can_cache \
- nbd_can_meta_context \
- nbd_get_size \
- nbd_pread \
- nbd_pread_structured \
- nbd_pwrite \
- nbd_shutdown \
- nbd_flush \
- nbd_trim \
- nbd_cache \
- nbd_zero \
- nbd_block_status \
- nbd_poll \
- nbd_aio_connect \
- nbd_aio_connect_uri \
- nbd_aio_connect_unix \
- nbd_aio_connect_tcp \
- nbd_aio_connect_command \
- nbd_aio_pread \
- nbd_aio_pread_structured \
- nbd_aio_pwrite \
- nbd_aio_disconnect \
- nbd_aio_flush \
- nbd_aio_trim \
- nbd_aio_cache \
- nbd_aio_zero \
- nbd_aio_block_status \
- nbd_aio_get_fd \
- nbd_aio_get_direction \
- nbd_aio_notify_read \
- nbd_aio_notify_write \
- nbd_aio_is_created \
- nbd_aio_is_connecting \
- nbd_aio_is_ready \
- nbd_aio_is_processing \
- nbd_aio_is_dead \
- nbd_aio_is_closed \
- nbd_aio_command_completed \
- nbd_aio_peek_command_completed \
- nbd_aio_in_flight \
- nbd_connection_state \
- nbd_get_package_name \
- nbd_get_version \
- nbd_kill_command \
- nbd_supports_tls \
- nbd_supports_uri \
- $(NULL)
diff --git a/generator/generator b/generator/generator
index 257303f..9fe98f5 100755
--- a/generator/generator
+++ b/generator/generator
@@ -3733,9 +3733,10 @@ let generate_lib_api_c () =
pr "\n";
List.iter print_wrapper handle_calls
-(* We generate a fragment of Makefile.am containing rules for
- * building the manual pages. Note this file is committed to
- * git because otherwise you can't clone and run autoreconf.
+(* We generate a fragment of Makefile.am containing the list
+ * of generated functions, used in rules for building the manual
+ * pages. We exploit GNU make's sinclude to use this file without
+ * upsetting automake.
*)
let generate_docs_Makefile_inc () =
generate_header HashStyle;
diff --git a/.gitignore b/.gitignore
index 4109865..ccbbc14 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,6 +39,7 @@ Makefile.in
/depcomp
/docs/*.3
/docs/*.pod
+/docs/Makefile.inc
!/docs/libnbd.pod
!/docs/nbd_close.3
!/docs/nbd_create.pod
--
2.20.1