All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/misc: Cleanup makefile
@ 2015-01-08 13:34 Andrew Cooper
  2015-01-09 14:53 ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2015-01-08 13:34 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Wei Liu

The existing makefile was awkward with needing to express conditional
inclusion for both the build and install rules, and contained both split and
unsplit long lines.

The INSTALL_* rules now contain the conditional inclusion information, while
the TARGET_* rules generate the build list from the complete install list,
less the minority of scripts which simply need copying into place.  Comments
are introduces to aid clarity.

In addition, collect the CFLAGS expressions, remove the unreferenced and empty
HDRS list, and restrict the libxc internals build fix to the offending
binaries.

No functional change as a result of this patch, but it is rather more simple
to add or remove utilities.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/misc/Makefile |   77 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 46 insertions(+), 31 deletions(-)

diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 7a2bfd2..a255c22 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -1,42 +1,53 @@
 XEN_ROOT=$(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
-
+CFLAGS += -Werror -I$(XEN_ROOT)/tools
 CFLAGS += $(CFLAGS_libxenctrl)
 CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(CFLAGS_libxenstore)
-# xen-hptool.c and xen-mfndump.c incorrectly use libxc internals
-CFLAGS += -I$(XEN_ROOT)/tools/libxc
-
-HDRS     = $(wildcard *.h)
 
-TARGETS-y := xenperf xenpm xen-tmem-list-parse gtraceview gtracestat xenlockprof xenwatchdogd xencov
-TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump
-TARGETS-$(CONFIG_MIGRATE) += xen-hptool
-TARGETS := $(TARGETS-y)
+# Everything to be installed in regular bin/
+INSTALL_BIN-$(CONFIG_X86)      += xen-detect
+INSTALL_BIN                    += xencons
+INSTALL_BIN                    += xencov_split
+INSTALL_BIN += $(INSTALL_BIN-y)
 
-INSTALL_BIN-y := xencons xencov_split
-INSTALL_BIN-$(CONFIG_X86) += xen-detect
-INSTALL_BIN := $(INSTALL_BIN-y)
-
-INSTALL_SBIN-y := xen-bugtool xenperf xenpm xen-tmem-list-parse gtraceview \
-	gtracestat xenlockprof xenwatchdogd xen-ringwatch xencov
-INSTALL_SBIN-$(CONFIG_X86) += xen-hvmctx xen-hvmcrash xen-lowmemd xen-mfndump
+# Everything to be installed in regular sbin/
+INSTALL_SBIN                   += gtracestat
+INSTALL_SBIN                   += gtraceview
+INSTALL_SBIN                   += xen-bugtool
 INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
-INSTALL_SBIN := $(INSTALL_SBIN-y)
-
-INSTALL_PRIVBIN-y := xenpvnetboot
-INSTALL_PRIVBIN := $(INSTALL_PRIVBIN-y)
-
-# Include configure output (config.h) to headers search path
-CFLAGS += -I$(XEN_ROOT)/tools
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(TARGETS)
+INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmcrash
+INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmctx
+INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd
+INSTALL_SBIN-$(CONFIG_X86)     += xen-mfndump
+INSTALL_SBIN                   += xen-ringwatch
+INSTALL_SBIN                   += xen-tmem-list-parse
+INSTALL_SBIN                   += xencov
+INSTALL_SBIN                   += xenlockprof
+INSTALL_SBIN                   += xenperf
+INSTALL_SBIN                   += xenpm
+INSTALL_SBIN                   += xenwatchdogd
+INSTALL_SBIN += $(INSTALL_SBIN-y)
+
+# Everything to be installed in a private bin/
+INSTALL_PRIVBIN                += xenpvnetboot
+
+# Everything to be installed
+TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
+
+# Everything which only needs copying to install
+TARGETS_COPY += xen-bugtool
+TARGETS_COPY += xen-ringwatch
+TARGETS_COPY += xencons
+TARGETS_COPY += xencov_split
+TARGETS_COPY += xenpvnetboot
+
+# Everything which needs to be built
+TARGETS_BUILD := $(filter-out $(TARGETS_COPY),$(TARGETS_ALL))
+
+.PHONY: all build
+all build: $(TARGETS_BUILD)
 
 .PHONY: install
 install: build
@@ -49,7 +60,7 @@ install: build
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS)
+	$(RM) *.o $(TARGETS_BUILD) *~ $(DEPS)
 
 xen-hvmctx: xen-hvmctx.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
@@ -69,9 +80,13 @@ gtracestat: gtracestat.o
 xenlockprof: xenlockprof.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+# xen-hptool incorrectly uses libxc internals
+xen-hptool.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc
 xen-hptool: xen-hptool.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
+# xen-mfndump incorrectly uses libxc internals
+xen-mfndump.o: CFLAGS += -I$(XEN_ROOT)/tools/libxc
 xen-mfndump: xen-mfndump.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/misc: Cleanup makefile
  2015-01-08 13:34 [PATCH] tools/misc: Cleanup makefile Andrew Cooper
@ 2015-01-09 14:53 ` Wei Liu
  2015-01-12 16:43   ` Ian Campbell
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2015-01-09 14:53 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: Wei Liu, Ian Jackson, Ian Campbell, Xen-devel

On Thu, Jan 08, 2015 at 01:34:22PM +0000, Andrew Cooper wrote:
> The existing makefile was awkward with needing to express conditional
> inclusion for both the build and install rules, and contained both split and
> unsplit long lines.
> 
> The INSTALL_* rules now contain the conditional inclusion information, while
> the TARGET_* rules generate the build list from the complete install list,
> less the minority of scripts which simply need copying into place.  Comments
> are introduces to aid clarity.
> 
> In addition, collect the CFLAGS expressions, remove the unreferenced and empty
> HDRS list, and restrict the libxc internals build fix to the offending
> binaries.
> 
> No functional change as a result of this patch, but it is rather more simple
> to add or remove utilities.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> CC: Ian Campbell <Ian.Campbell@citrix.com>
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>

This looks correct to me.

Acked-by: Wei Liu <wei.liu2@citrix.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tools/misc: Cleanup makefile
  2015-01-09 14:53 ` Wei Liu
@ 2015-01-12 16:43   ` Ian Campbell
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Campbell @ 2015-01-12 16:43 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, Ian Jackson, Xen-devel

On Fri, 2015-01-09 at 14:53 +0000, Wei Liu wrote:
> On Thu, Jan 08, 2015 at 01:34:22PM +0000, Andrew Cooper wrote:
> > The existing makefile was awkward with needing to express conditional
> > inclusion for both the build and install rules, and contained both split and
> > unsplit long lines.
> > 
> > The INSTALL_* rules now contain the conditional inclusion information, while
> > the TARGET_* rules generate the build list from the complete install list,
> > less the minority of scripts which simply need copying into place.  Comments
> > are introduces to aid clarity.
> > 
> > In addition, collect the CFLAGS expressions, remove the unreferenced and empty
> > HDRS list, and restrict the libxc internals build fix to the offending
> > binaries.
> > 
> > No functional change as a result of this patch, but it is rather more simple
> > to add or remove utilities.
> > 
> > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > CC: Ian Campbell <Ian.Campbell@citrix.com>
> > CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> > CC: Wei Liu <wei.liu2@citrix.com>
> 
> This looks correct to me.
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-12 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 13:34 [PATCH] tools/misc: Cleanup makefile Andrew Cooper
2015-01-09 14:53 ` Wei Liu
2015-01-12 16:43   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.