diff mbox series

[1/3] Makefile: use $(ALL_CFLAGS) in $(HCO) target

Message ID 0336d1345abfef563d9228e250316cc58a01f2b3.1569263631.git.liu.denton@gmail.com (mailing list archive)
State New, archived
Headers show
Series fixes related to `make hdr-check` | expand

Commit Message

Denton Liu Sept. 23, 2019, 6:34 p.m. UTC
On platforms that can run `make hdr-check` but require custom flags,
this target was failing because none of them were being passed to the
compiler. For example, on MacOS, the NO_OPENSSL flag was being set but
it was not being passed into compiler so the check was failing.

Pass $(ALL_CFLAGS) into the compiler for the $(HCO) target so that these
custom flags can be used.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Schindelin Sept. 26, 2019, 12:49 p.m. UTC | #1
Hi Denton,

On Mon, 23 Sep 2019, Denton Liu wrote:

> On platforms that can run `make hdr-check` but require custom flags,
> this target was failing because none of them were being passed to the
> compiler. For example, on MacOS, the NO_OPENSSL flag was being set but
> it was not being passed into compiler so the check was failing.
>
> Pass $(ALL_CFLAGS) into the compiler for the $(HCO) target so that these
> custom flags can be used.
>
> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index f879697ea3..d8df4e316b 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2773,7 +2773,7 @@ CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
>  HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
>
>  $(HCO): %.hco: %.h FORCE
> -	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
> +	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $(ALL_CFLAGS) $<

Isn't this essentially identical to what I sent in
https://public-inbox.org/git/pull.129.git.gitgitgadget@gmail.com/
?

Ciao,
Dscho

>
>  .PHONY: hdr-check $(HCO)
>  hdr-check: $(HCO)
> --
> 2.23.0.565.g1cc52d20df
>
>
Denton Liu Sept. 26, 2019, 5:38 p.m. UTC | #2
Hi Dscho,

On Thu, Sep 26, 2019 at 02:49:55PM +0200, Johannes Schindelin wrote:
> Hi Denton,
> 
> On Mon, 23 Sep 2019, Denton Liu wrote:
> 
> > On platforms that can run `make hdr-check` but require custom flags,
> > this target was failing because none of them were being passed to the
> > compiler. For example, on MacOS, the NO_OPENSSL flag was being set but
> > it was not being passed into compiler so the check was failing.
> >
> > Pass $(ALL_CFLAGS) into the compiler for the $(HCO) target so that these
> > custom flags can be used.
> >
> > Signed-off-by: Denton Liu <liu.denton@gmail.com>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index f879697ea3..d8df4e316b 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -2773,7 +2773,7 @@ CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
> >  HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
> >
> >  $(HCO): %.hco: %.h FORCE
> > -	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
> > +	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $(ALL_CFLAGS) $<
> 
> Isn't this essentially identical to what I sent in
> https://public-inbox.org/git/pull.129.git.gitgitgadget@gmail.com/
> ?

Whoops, didn't notice this. I heard there's some quote about great minds
or something ;).

Anyway, this patch is superceded by v2 4/4 which should emulate the
compilation process even better, as suggested by Peff. The only problem
with that patch is that it splashes temporary *.hcc files everywhere but
I think that if it's only a developer-run target, it should be fine.

Thanks,

Denton

> 
> Ciao,
> Dscho
> 
> >
> >  .PHONY: hdr-check $(HCO)
> >  hdr-check: $(HCO)
> > --
> > 2.23.0.565.g1cc52d20df
> >
> >
Johannes Schindelin Sept. 26, 2019, 7:47 p.m. UTC | #3
Hi,

On Thu, 26 Sep 2019, Denton Liu wrote:

> On Thu, Sep 26, 2019 at 02:49:55PM +0200, Johannes Schindelin wrote:
> >
> > On Mon, 23 Sep 2019, Denton Liu wrote:
> >
> > > On platforms that can run `make hdr-check` but require custom flags,
> > > this target was failing because none of them were being passed to the
> > > compiler. For example, on MacOS, the NO_OPENSSL flag was being set but
> > > it was not being passed into compiler so the check was failing.
> > >
> > > Pass $(ALL_CFLAGS) into the compiler for the $(HCO) target so that these
> > > custom flags can be used.
> > >
> > > Signed-off-by: Denton Liu <liu.denton@gmail.com>
> > > ---
> > >  Makefile | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/Makefile b/Makefile
> > > index f879697ea3..d8df4e316b 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -2773,7 +2773,7 @@ CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
> > >  HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
> > >
> > >  $(HCO): %.hco: %.h FORCE
> > > -	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
> > > +	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $(ALL_CFLAGS) $<
> >
> > Isn't this essentially identical to what I sent in
> > https://public-inbox.org/git/pull.129.git.gitgitgadget@gmail.com/
> > ?
>
> Whoops, didn't notice this. I heard there's some quote about great minds
> or something ;).

Hahaha! ;-)

> Anyway, this patch is superceded by v2 4/4 which should emulate the
> compilation process even better, as suggested by Peff. The only
> problem with that patch is that it splashes temporary *.hcc files
> everywhere but I think that if it's only a developer-run target, it
> should be fine.

I agree that Peff's improvement is nice.

The only problem is that my patch made it into `next` already, according
to https://github.com/gitgitgadget/git/pull/129 (look for the labels on
the right side, or for the comments on the bottom), and
https://github.com/gitster/git/commit/a3f332f4fb10 agrees (look for
names of the branches containing that commit, under the commit message).

So we should explicitly as for my patch to be backed out from `next` and
be stopped from advancing to `master`.

Junio, would you kindly do that? According to the PR, you gave this
branch the name `js/honor-cflags-in-hdr-check`.

Thanks,
Dscho
Junio C Hamano Sept. 28, 2019, 4:59 a.m. UTC | #4
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> The only problem is that my patch made it into `next` already, according
> to https://github.com/gitgitgadget/git/pull/129 (look for the labels on
> the right side, or for the comments on the bottom), and
> https://github.com/gitster/git/commit/a3f332f4fb10 agrees (look for
> names of the branches containing that commit, under the commit message).
>
> So we should explicitly as for my patch to be backed out from `next` and
> be stopped from advancing to `master`.
>
> Junio, would you kindly do that? According to the PR, you gave this
> branch the name `js/honor-cflags-in-hdr-check`.

OK, so the topic should be dropped and replaced by the Denton's
series.  Thanks, will do.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index f879697ea3..d8df4e316b 100644
--- a/Makefile
+++ b/Makefile
@@ -2773,7 +2773,7 @@  CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(patsubst ./%,%,$(LIB_H)))
 HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
 
 $(HCO): %.hco: %.h FORCE
-	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $<
+	$(QUIET_HDR)$(CC) -include git-compat-util.h -I. -o /dev/null -c -xc $(ALL_CFLAGS) $<
 
 .PHONY: hdr-check $(HCO)
 hdr-check: $(HCO)