From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Teigland Date: Tue, 27 Sep 2022 14:07:50 +0000 (GMT) Subject: main - make: move cmds.h Message-ID: <20220927140750.B7F7F3858C50@sourceware.org> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c1ab9fb37faee56cee278ccd94cb958d30d61b94 Commit: c1ab9fb37faee56cee278ccd94cb958d30d61b94 Parent: fd05b79aad6ccf89f85bd85f5a4b32e1275ce785 Author: David Teigland AuthorDate: Tue Sep 27 09:06:06 2022 -0500 Committer: David Teigland CommitterDate: Tue Sep 27 09:06:06 2022 -0500 make: move cmds.h generate the header in the include dir so it can be easily used from both lib and tools dirs. --- Makefile.in | 2 +- include/Makefile.in | 18 +++++++++++++++++- lib/commands/cmd_enum.h | 4 ++-- tools/Makefile.in | 18 ++++-------------- tools/command.c | 4 ++-- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Makefile.in b/Makefile.in index 3b7e0ecaa..1d5aff482 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,7 +47,7 @@ include $(top_srcdir)/base/Makefile include $(top_srcdir)/device_mapper/Makefile include $(top_srcdir)/test/unit/Makefile -lib: libdaemon $(BASE_TARGET) $(DEVICE_MAPPER_TARGET) +lib: include libdaemon $(BASE_TARGET) $(DEVICE_MAPPER_TARGET) daemons: lib libdaemon tools scripts: lib tools: lib libdaemon diff --git a/include/Makefile.in b/include/Makefile.in index d6c30d15b..88a06a934 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -18,6 +18,21 @@ top_builddir = @top_builddir@ include $(top_builddir)/make.tmpl +cmds.h: + @echo " [GEN] $@" + $(Q) set -o pipefail && \ + ( cat $(top_srcdir)/tools/license.inc && \ + echo "/* Do not edit. This file is generated by the Makefile. */" && \ + echo "cmd(CMD_NONE, none)" && \ + $(GREP) '^ID:' $(top_srcdir)/tools/command-lines.in | LC_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \ + echo "cmd(CMD_COUNT, count)" \ + ) > $@ + +all: cmds.h + +clean: + rm -f cmds.h + DISTCLEAN_TARGETS += configure.h lvm-version.h CLEAN_TARGETS += \ .symlinks \ @@ -99,4 +114,5 @@ CLEAN_TARGETS += \ util.h \ uuid.h \ vg.h \ - xlate.h + xlate.h \ + cmds.h diff --git a/lib/commands/cmd_enum.h b/lib/commands/cmd_enum.h index 939af81c3..9e9902224 100644 --- a/lib/commands/cmd_enum.h +++ b/lib/commands/cmd_enum.h @@ -2,7 +2,7 @@ #define _CMD_ENUM_H /* - * tools/cmds.h is generated by the Makefile. For each command definition + * include/cmds.h is generated by the Makefile. For each command definition * in command-lines.in, cmds.h contains: * cmd(foo_CMD, foo) * @@ -12,7 +12,7 @@ enum { #define cmd(a, b) a , -#include "../tools/cmds.h" +#include "../../include/cmds.h" #undef cmd }; diff --git a/tools/Makefile.in b/tools/Makefile.in index 25fe3b6b3..49d9b89c7 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -98,7 +98,7 @@ CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \ liblvm2cmd-static.a lvm.static \ $(LDDEPS) .exported_symbols_generated \ - cmds.h command-lines-input.h command-count.h man-generator.c + command-lines-input.h command-count.h man-generator.c ifeq ("@CMDLIB@", "yes") TARGETS += liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) @@ -175,16 +175,6 @@ command-count.h: $(srcdir)/command-lines.in Makefile $(GREP) '^ID:' $< | $(WC) -l \ ) > $@ -cmds.h: $(srcdir)/command-lines.in Makefile - @echo " [GEN] $@" - $(Q) set -o pipefail && \ - ( cat $(srcdir)/license.inc && \ - echo "/* Do not edit. This file is generated by the Makefile. */" && \ - echo "cmd(CMD_NONE, none)" && \ - $(GREP) '^ID:' $(srcdir)/command-lines.in | LC_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \ - echo "cmd(CMD_COUNT, count)" \ - ) > $@ - command-lines-input.h: $(srcdir)/command-lines.in Makefile @echo " [GEN] $@" $(Q) set -o pipefail && \ @@ -195,9 +185,9 @@ command-lines-input.h: $(srcdir)/command-lines.in Makefile echo "\\n\\n\";" \ ) > $@ -$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h cmds.h -$(SOURCES:%.c=%.o) $(SOURCES2:%.c=%.o): command-lines-input.h command-count.h cmds.h -lvm.cflow lvm.xref lvm.tree lvm.xref: command-lines-input.h command-count.h cmds.h +$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h +$(SOURCES:%.c=%.o) $(SOURCES2:%.c=%.o): command-lines-input.h command-count.h +lvm.cflow lvm.xref lvm.tree lvm.xref: command-lines-input.h command-count.h .PHONY: install_cmdlib_dynamic install_cmdlib_static install_cmdlib_include \ install_tools_dynamic install_tools_static diff --git a/tools/command.c b/tools/command.c index 5da511530..7a7415201 100644 --- a/tools/command.c +++ b/tools/command.c @@ -149,7 +149,7 @@ static inline int dumptype_arg(struct cmd_context *cmd __attribute__((unused)), enum { #define cmd(a, b) a , -#include "cmds.h" +#include "../include/cmds.h" #undef cmd }; @@ -238,7 +238,7 @@ struct lv_type lv_types[LVT_COUNT + 1] = { struct cmd_name cmd_names[CMD_COUNT + 1] = { #define cmd(a, b) { # a, a, # b }, -#include "cmds.h" +#include "../include/cmds.h" #undef cmd };