Skip to contentSkip to conversation

master - ccmd: split into multiple files

PATCH David Teigland 1 participant 1 message Feb 13, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=15d9f2850e60a44cfc55d48ce108b4a82aecd9ae
Commit:        15d9f2850e60a44cfc55d48ce108b4a82aecd9ae
Parent:        013c080756dcc2faaecc80b489d85d7ab1384cbf
Author:        David Teigland <[email protected]>
AuthorDate:    Thu Jan 12 14:44:58 2017 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Feb 13 08:20:10 2017 -0600

ccmd: split into multiple files

---
 tools/Makefile.in       |   36 +-
 tools/ccmd-main.c       | 1130 +++++++++++++++++
 tools/ccmd-man.c        |  997 +++++++++++++++
 tools/ccmd-util.c       |  936 ++++++++++++++
 tools/ccmd.h            |  144 +++
 tools/create-commands.c | 3169 -----------------------------------------------
 6 files changed, 3238 insertions(+), 3174 deletions(-)
tools/Makefile.in +31 -5
index 887bc69..8f53851 100644
@@ -1,3 +1,4 @@
+
 #
 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
 # Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
@@ -140,6 +141,8 @@ all: device-mapper
 CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
 CFLAGS_lvmcmdline.o += $(VALGRIND_CFLAGS)
 
+INCLUDES += -I$(top_builddir)/tools
+
 lvm: $(OBJECTS) lvm.o $(top_builddir)/lib/liblvm-internal.a
 	$(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $(OBJECTS) lvm.o \
 		$(LVMLIBS) $(READLINE_LIBS) $(LIBS) -rdynamic
@@ -173,12 +176,35 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
 	$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
 		egrep -v '^ *(|#.*|config|devtypes|dumpconfig|formats|fullreport|help|lastlog|lvpoll|pvdata|segtypes|systemid|tags|version) *$$' > .commands
 
-ccmd: create-commands.c
-	$(CC) create-commands.c -o ccmd
+ccmd: $(srcdir)/ccmd-main.c $(srcdir)/ccmd-util.c $(srcdir)/ccmd-man.c
+	$(CC) $(srcdir)/ccmd-main.c $(srcdir)/ccmd-util.c $(srcdir)/ccmd-man.c -o ccmd
+
+.DELETE_ON_ERROR:
+
+command-lines.h: $(srcdir)/command-lines.in ccmd
+	$(top_builddir)/tools/ccmd --output struct $(srcdir)/command-lines.in > $@
+
+command-lines-count.h: $(srcdir)/command-lines.in ccmd
+	$(top_builddir)/tools/ccmd --output count $(srcdir)/command-lines.in > $@
+
+# move properly to configure
+WC = /usr/bin/wc
+GREP = /bin/grep
+SORT = /bin/sort
+CUT = /bin/cut
+SED = /bin/sed
+
+# FIXME Add licence text from template file
+command-lines-count-new.h: $(srcdir)/command-lines.in ccmd Makefile
+	set -o pipefail && \
+	(echo -n "#define COMMAND_COUNT " && \
+	$(GREP) '^ID:' $(srcdir)/command-lines.in | $(WC) -l && \
+	echo -e "enum {\n\tno_CMD," && \
+	$(GREP) '^ID:' $(srcdir)/command-lines.in | $(CUT) -d\  -f2 | $(SORT) -u | $(SED) 's/\(.*\)/\t&_CMD,/' && \
+	echo -e "\tCOMMAND_ID_COUNT,\n};" \
+	) > $@
 
-command-lines.h: ccmd
-	./ccmd --output struct command-lines.in > command-lines.h
-	./ccmd --output count command-lines.in > command-lines-count.h
+$(SOURCES:%.c=%.d): command-lines.h command-lines-count.h
 
 ifneq ("$(CFLOW_CMD)", "")
 CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
tools/ccmd-main.c new file +1130 -0

1,130 lines not on this page · raw message

tools/ccmd-man.c new file +997 -0

997 lines not on this page · raw message

tools/ccmd-util.c new file +936 -0

821 lines not on this page · raw message

tools/ccmd.h new file +144 -0

144 lines not on this page · raw message

tools/create-commands.c deleted +0 -3169

3,169 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.