1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

make: move cmds.h

generate the header in the include dir so it
can be easily used from both lib and tools dirs.
This commit is contained in:
David Teigland 2022-09-27 09:06:06 -05:00
parent fd05b79aad
commit c1ab9fb37f
5 changed files with 26 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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
};

View File

@ -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

View File

@ -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
};