From patchwork Mon Oct 1 15:45:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 1531801 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9F235DFFAD for ; Mon, 1 Oct 2012 15:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752253Ab2JAPqG (ORCPT ); Mon, 1 Oct 2012 11:46:06 -0400 Received: from avon.wwwdotorg.org ([70.85.31.133]:48543 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752591Ab2JAPqE (ORCPT ); Mon, 1 Oct 2012 11:46:04 -0400 Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 51CFD6317; Mon, 1 Oct 2012 09:47:11 -0600 (MDT) Received: from localhost.localdomain (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 49937E40EE; Mon, 1 Oct 2012 09:46:01 -0600 (MDT) From: Stephen Warren To: Michal Marek Cc: linux-kbuild@vger.kernel.org, David Gibson , Jon Loeliger , Grant Likely , Rob Herring , Scott Wood , Mark Brown , Jean-Christophe PLAGNIOL-VILLARD , devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Stephen Warren Subject: [PATCH V3 2/2] kbuild: introduce cmd_dtc_cpp Date: Mon, 1 Oct 2012 09:45:51 -0600 Message-Id: <1349106351-17714-3-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1349106351-17714-1-git-send-email-swarren@wwwdotorg.org> References: <1349106351-17714-1-git-send-email-swarren@wwwdotorg.org> X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From: Stephen Warren cmd_dtc_cpp runs the C pre-processor on the input .dts file before passing it to dtc for final compilation. This allows used of #define within the .dts file. Introduce a new rule for %.dtsp -> %.dtb, which uses cmd_dtc_cpp. A new file extension is introduced for this purpose, since use of the pre- processor must be optional; any property or node name that starts with "#" must be escaped to prevent the pre-processor attempting to interpret it as a directive. For this reason, skeleton.dtsi-cpp is introduced for *.dts-cpp to include. Signed-off-by: Stephen Warren --- v3: Pass "-x c" not "-xc" to cpp. v2: Place make %.dtb: %.dtsp rule into Makefile.lib. --- arch/arm/boot/dts/skeleton.dtsip | 13 +++++++++++++ scripts/Makefile.lib | 6 ++++++ 2 files changed, 19 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/skeleton.dtsip diff --git a/arch/arm/boot/dts/skeleton.dtsip b/arch/arm/boot/dts/skeleton.dtsip new file mode 100644 index 0000000..8bf6729 --- /dev/null +++ b/arch/arm/boot/dts/skeleton.dtsip @@ -0,0 +1,13 @@ +/* + * Skeleton device tree; the bare minimum needed to boot; just include and + * add a compatible value. The bootloader will typically populate the memory + * node. + */ + +/ { + \#address-cells = <1>; + \#size-cells = <1>; + chosen { }; + aliases { }; + memory { device_type = "memory"; reg = <0 0>; }; +}; diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 425578e..1980078 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -269,6 +269,12 @@ cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile $(obj)/%.dtb: $(src)/dts/%.dts FORCE $(call if_changed_dep,dtc) +quiet_cmd_dtc_cpp = DTC+CPP $@ +cmd_dtc_cpp = $(CC) -E -Wp,-MD,$(depfile) -x c $< | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) - + +$(obj)/%.dtb: $(src)/dts/%.dtsp FORCE + $(call if_changed_dep,dtc_cpp) + # Bzip2 # ---------------------------------------------------------------------------