From: Olaf Hering Subject: [PATCH 03/13] Config.mk: add new macro buildmakevars2header Date: Mon, 28 Jul 2014 11:05:06 +0200 Message-ID: <1406538316-29087-4-git-send-email-olaf@aepfle.de> References: <1406538316-29087-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1406538316-29087-1-git-send-email-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Olaf Hering , Keir Fraser , Ian Campbell , Stefano Stabellini , Tim Deegan , Ian Jackson , Jan Beulich , Samuel Thibault List-Id: xen-devel@lists.xenproject.org This macro is similar to buildmakevars2file, it just creates a C header file instead of shell style syntax. Upcoming changes will use this macro in libxl and libxc. Note: if target ($(1)) is marked as .PHONY everything that depends on target will be constantly rebuild. The reason for that seems to be that make will internally drop target. As a result target is non-existant, which triggers a rebuild. With the intermediate target.tmp this will not happen because target changes only if target.tmp really changes. Signed-off-by: Olaf Hering --- Config.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Config.mk b/Config.mk index 28e9930..92c0567 100644 --- a/Config.mk +++ b/Config.mk @@ -181,6 +181,17 @@ define buildmakevars2file-closure $(call move-if-changed,$(1).tmp,$(1)) endef +buildmakevars2header = $(eval $(call buildmakevars2header-closure,$(1))) +define buildmakevars2header-closure + $(1).tmp: + rm -f $(1).newtmp; \ + $(foreach var, $(BUILD_MAKE_VARS), \ + echo "#define $(var) \"$($(var))\"" >>$(1).newtmp;) \ + $(call move-if-changed,$(1).newtmp,$(1).tmp) + $(1): $(1).tmp + $(call move-if-changed,$(1).tmp,$(1)) +endef + ifeq ($(debug_symbols),y) CFLAGS += -g endif