From: Olaf Hering <olaf@aepfle.de>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 8/9] tools/libxc: provide variable paths to libxc
Date: Wed, 23 Apr 2014 16:27:35 +0200 [thread overview]
Message-ID: <20140423142735.GA22736@aepfle.de> (raw)
In-Reply-To: <1398251709.18537.40.camel@kazak.uk.xensource.com>
On Wed, Apr 23, Ian Campbell wrote:
> libxl has the exact same thing. Can we make it a common
> genpath-include-target or something please.
I came up with the untested change below.
> I'm not sure why this isn't handled vi autoconf and tools/config.h.in.
Should these variables (in BUILD_MAKE_VARS) be set via configure?
Olaf
Config.mk | 19 +++++++++++++++----
tools/libxc/Makefile | 8 ++++++++
tools/libxc/xc_private.h | 1 +
tools/libxl/Makefile | 7 +------
4 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/Config.mk b/Config.mk
index 6a93533..0e07fd6 100644
--- a/Config.mk
+++ b/Config.mk
@@ -166,19 +166,30 @@ define move-if-changed
if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
endef
+BUILD_MAKE_VARS := SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \
+ XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
+ XEN_RUN_DIR XEN_PAGING_DIR
+
buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
define buildmakevars2file-closure
.PHONY: genpath
genpath:
rm -f $(1).tmp; \
- $(foreach var, \
- SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \
- XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
- XEN_RUN_DIR XEN_PAGING_DIR, \
+ $(foreach var, $(BUILD_MAKE_VARS) \
echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \
$(call move-if-changed,$(1).tmp,$(1))
endef
+buildmakevars2header = $(eval $(call buildmakevars2header-closure,$(1)))
+define buildmakevars2header-closure
+ .PHONY: genpath
+ genpath:
+ rm -f $(1).tmp; \
+ $(foreach var, $(BUILD_MAKE_VARS) \
+ echo "#define $(var) \"$($(var))\"" >>$(1).tmp;)\
+ $(call move-if-changed,$(1).tmp,$(1))
+endef
+
ifeq ($(debug_symbols),y)
CFLAGS += -g
endif
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index a74b19e..cbba502 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -118,6 +118,13 @@ ifneq ($(stubdom),y)
LIB += xenctrl_osdep_ENOSYS.so
endif
+genpath-target = $(call buildmakevars2header,_paths.h)
+$(eval $(genpath-target))
+
+xc_private.h: _paths.h
+
+$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) $(OSDEP_LIB_OBJS): xc_private.h
+
.PHONY: all
all: build
@@ -150,6 +157,7 @@ TAGS:
.PHONY: clean
clean:
rm -rf *.rpm $(LIB) *~ $(DEPS) \
+ _paths.h \
$(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \
$(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) \
$(OSDEP_LIB_OBJS) $(OSDEP_PIC_OBJS)
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index 670a82d..786dc61 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <sys/ioctl.h>
+#include "_paths.h"
#include "xenctrl.h"
#include "xenctrlosdep.h"
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 4cfa275..6c8a14b 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -141,7 +141,7 @@ $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \
@rm -f $*.[ch]
$(FLEX) --header-file=$*.h --outfile=$*.c $<
-genpath-target = $(call buildmakevars2file,_paths.h.tmp)
+genpath-target = $(call buildmakevars2header,_paths.h)
$(eval $(genpath-target))
libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
@@ -154,11 +154,6 @@ _%.api-for-check: %.h $(AUTOINCS)
>$@.new
mv -f $@.new $@
-_paths.h: genpath
- sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@.tmp >$@.2.tmp
- rm -f $@.tmp
- $(call move-if-changed,$@.2.tmp,$@)
-
_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
$(PERL) $^ --prefix=libxl >$@.new
$(call move-if-changed,$@.new,$@)
next prev parent reply other threads:[~2014-04-23 14:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 14:13 [PATCH 0/9] tools changes to honor --prefix= Olaf Hering
2014-04-17 14:13 ` [PATCH 1/9] tools/python: add APPEND_LDFLAGS to CFLAGS Olaf Hering
2014-04-17 14:13 ` [PATCH 2/9] tools/libfsimage: append APPEND_LDFLAGS to link command Olaf Hering
2014-04-17 14:13 ` [PATCH 3/9] tools/debugger: " Olaf Hering
2014-04-17 14:13 ` [PATCH 4/9] tools/blktap2: " Olaf Hering
2014-04-17 14:13 ` [PATCH 5/9] tools: add APPEND_LDFLAGS to xentop " Olaf Hering
2014-04-17 14:13 ` [PATCH 6/9] tools/pygrub: add APPEND_LDFLAGS to CFLAGS Olaf Hering
2014-04-23 11:07 ` Ian Campbell
2014-04-17 14:13 ` [PATCH 7/9] tools/libxl: remove XEN_RUN_DIR from install target Olaf Hering
2014-04-23 11:15 ` Ian Campbell
2014-04-17 14:13 ` [PATCH 8/9] tools/libxc: provide variable paths to libxc Olaf Hering
2014-04-23 11:15 ` Ian Campbell
2014-04-23 14:27 ` Olaf Hering [this message]
2014-04-28 15:04 ` Ian Campbell
2014-04-28 15:14 ` Olaf Hering
2014-04-17 14:13 ` [PATCH 9/9] tools/libxc: use XEN_RUN_DIR for SUSPEND_LOCK_FILE Olaf Hering
2014-04-23 11:15 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140423142735.GA22736@aepfle.de \
--to=olaf@aepfle.de \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.