From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Subject: Re: [PATCH V6 2/2] kbuild: run the pre-processor on *.dts files Date: Wed, 14 Nov 2012 13:18:24 -0700 Message-ID: <50A3FC90.7030105@wwwdotorg.org> References: <1352753907-3316-1-git-send-email-swarren@wwwdotorg.org> <1352753907-3316-2-git-send-email-swarren@wwwdotorg.org> <20121114192548.59F093E0B7C@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20121114192548.59F093E0B7C@localhost> Sender: linux-arch-owner@vger.kernel.org To: Grant Likely Cc: Michal Marek , David Gibson , Jon Loeliger , Rob Herring , Scott Wood , Mark Brown , Jean-Christophe PLAGNIOL-VILLARD , Sam Ravnborg , linux-kernel@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, linux-arch@vger.kernel.org, Stephen Warren List-Id: devicetree@vger.kernel.org On 11/14/2012 12:25 PM, Grant Likely wrote: > On Mon, 12 Nov 2012 13:58:27 -0700, Stephen Warren wrote: >> From: Stephen Warren >> >> Modify cmd_dtc to run the C pre-processor on the input .dts file before >> passing it to dtc for final compilation. This allows the use of #define >> and #include within the .dts file. > Ugh, I'm definitely nervous about turning this on because of the long > term implications so I'm going to punt on actually making a decision > about it for the momemnt. However, I do have a question... Hmmm. So how do we get to a decision on this then? >> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib >> index 425578e..33432f4 100644 >> --- a/scripts/Makefile.lib >> +++ b/scripts/Makefile.lib >> @@ -269,6 +269,15 @@ 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) >> >> +dtc-tmp = $(subst $(comma),_,$(dot-target).dts) >> + >> +quiet_cmd_dtc_cpp = DTC+CPP $@ >> +cmd_dtc_cpp = $(CPP) $(cpp_flags) -D__DTS__ -x assembler-with-cpp -o $(dtc-tmp) $< ; \ >> + $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp) >> + >> +$(obj)/%.dtb: $(src)/dts/%.dtsp FORCE >> + $(call if_changed_dep,dtc_cpp) > > Why this instead of a "%.dts: %.dtsp" rule? Then the exact same dtc rule > gets used in both cases. > > The .dtb rule is probably already rather oddball in that it puts the > output one directory below the input. That probably should be cleaned > up. I was a little nervous about potentially having some *.dts be primary source files, and others be derived from *.dtsp (assuming that we convert platforms to this new feature as desired, rather than en-mass). It seems like it'd just cause confusion; people might just end up accidentally editing a *.dts that was generated without realizing it.