diff mbox

include: fix build without C++ compiler installed

Message ID 591577E60200007800159179@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich May 12, 2017, 6:52 a.m. UTC
The rule for headers++.chk wants to move headers++.chk.new to the
designated target, which means we have to create that file in the first
place.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
include: fix build without C++ compiler installed

The rule for headers++.chk wants to move headers++.chk.new to the
designated target, which means we have to create that file in the first
place.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -120,7 +120,10 @@ headers99.chk: $(PUBLIC_C99_HEADERS) Mak
 
 headers++.chk: $(PUBLIC_HEADERS) Makefile
 	rm -f $@.new
-	$(CXX) -v >/dev/null 2>&1 || exit 0;                                  \
+	if ! $(CXX) -v >/dev/null 2>&1; then                                  \
+	    touch $@.new;                                                     \
+	    exit 0;                                                           \
+	fi;                                                                   \
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
 	    | $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__        \

Comments

Wei Liu May 12, 2017, 4:20 p.m. UTC | #1
On Fri, May 12, 2017 at 12:52:54AM -0600, Jan Beulich wrote:
> The rule for headers++.chk wants to move headers++.chk.new to the
> designated target, which means we have to create that file in the first
> place.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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

If I were to fix it I would just skip the check altogether if CXX isn't
available. But this approach is fine, too.
Jan Beulich May 15, 2017, 7:02 a.m. UTC | #2
>>> On 12.05.17 at 18:20, <wei.liu2@citrix.com> wrote:
> On Fri, May 12, 2017 at 12:52:54AM -0600, Jan Beulich wrote:
>> The rule for headers++.chk wants to move headers++.chk.new to the
>> designated target, which means we have to create that file in the first
>> place.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Reviewed-by: Wei Liu <wei.liu2@citrix.com>

Thanks.

> If I were to fix it I would just skip the check altogether if CXX isn't
> available. But this approach is fine, too.

I may not be understanding what you mean: The test is being skipped;
the destination file is being touched so that on an incremental re-build
the rule wouldn't be re-run. What else are you imagining? Suppressing
the headers++.chk target altogether would likely be more code churn,
with an overall harder to read Makefile as a result. Yet if you have
something neat and lightweight in mind, I'm all ears (likely for post-4.9
then).

Jan
Julien Grall May 15, 2017, 1:56 p.m. UTC | #3
Hi Jan,

On 12/05/17 07:52, Jan Beulich wrote:
> The rule for headers++.chk wants to move headers++.chk.new to the
> designated target, which means we have to create that file in the first
> place.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Release-acked-by: Julien Grall <julien.grall@arm.com>

Cheers,

>
> --- a/xen/include/Makefile
> +++ b/xen/include/Makefile
> @@ -120,7 +120,10 @@ headers99.chk: $(PUBLIC_C99_HEADERS) Mak
>
>  headers++.chk: $(PUBLIC_HEADERS) Makefile
>  	rm -f $@.new
> -	$(CXX) -v >/dev/null 2>&1 || exit 0;                                  \
> +	if ! $(CXX) -v >/dev/null 2>&1; then                                  \
> +	    touch $@.new;                                                     \
> +	    exit 0;                                                           \
> +	fi;                                                                   \
>  	$(foreach i, $(filter %.h,$^),                                        \
>  	    echo "#include "\"$(i)\"                                          \
>  	    | $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__        \
>
>
>
Wei Liu May 15, 2017, 5:01 p.m. UTC | #4
On Mon, May 15, 2017 at 01:02:48AM -0600, Jan Beulich wrote:
> >>> On 12.05.17 at 18:20, <wei.liu2@citrix.com> wrote:
> > On Fri, May 12, 2017 at 12:52:54AM -0600, Jan Beulich wrote:
> >> The rule for headers++.chk wants to move headers++.chk.new to the
> >> designated target, which means we have to create that file in the first
> >> place.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > 
> > Reviewed-by: Wei Liu <wei.liu2@citrix.com>
> 
> Thanks.
> 
> > If I were to fix it I would just skip the check altogether if CXX isn't
> > available. But this approach is fine, too.
> 
> I may not be understanding what you mean: The test is being skipped;
> the destination file is being touched so that on an incremental re-build
> the rule wouldn't be re-run. What else are you imagining? Suppressing
> the headers++.chk target altogether would likely be more code churn,

Yes that's what I was thinking. But as you said it's going to be more
code churn.

Wei.
diff mbox

Patch

--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -120,7 +120,10 @@  headers99.chk: $(PUBLIC_C99_HEADERS) Mak
 
 headers++.chk: $(PUBLIC_HEADERS) Makefile
 	rm -f $@.new
-	$(CXX) -v >/dev/null 2>&1 || exit 0;                                  \
+	if ! $(CXX) -v >/dev/null 2>&1; then                                  \
+	    touch $@.new;                                                     \
+	    exit 0;                                                           \
+	fi;                                                                   \
 	$(foreach i, $(filter %.h,$^),                                        \
 	    echo "#include "\"$(i)\"                                          \
 	    | $(CXX) -x c++ -std=gnu++98 -Wall -Werror -D__XEN_TOOLS__        \