On 12/6/18 3:50 PM, Richard W.M. Jones wrote:
This generates small functions which map from various integer NBD protocol flags to the string equivalent.
eg: name_of_nbd_cmd (NBD_CMD_READ) ---> "NBD_CMD_READ"
This commit uses some hairy sed scripting to ensure that we don't add any more dependencies to nbdkit. ---
+++ b/src/Makefile.am @@ -49,6 +49,7 @@ nbdkit_SOURCES = \ options.h \ plugins.c \ protocol.h \ + protostrings.c \ sockets.c \ threadlocal.c \ utils.c \ @@ -77,11 +78,23 @@ nbdkit_LDFLAGS = \ $(PTHREAD_LIBS) \ $(DL_LDFLAGS)
+# protostrings.c is generated from the protocol.h header file where it +# is used to map NBD protocol flags to strings. + +BUILT_SOURCES = protostrings.c +EXTRA_DIST = protostrings.c +CLEANFILES += protostrings.c +protostrings.c: protocol.h protostrings.sed Makefile + rm -f $@ $@-t + $(SED) -n -f protostrings.sed < $< > $@-t
'make distcheck' caught a couple issues with this (we want protostrings.sed in the tarball, and sed can't find the script in VPATH builds). Now fixed. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org