Re: [PATCH 1/1] Makefile: use `git ls-files` to list header files, if possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peff,

On Fri, 1 Mar 2019, Jeff King wrote:

> On Fri, Mar 01, 2019 at 04:54:15PM -0500, Jeff King wrote:
> 
> > The one thing we do lose, though, is make's parallelization. It would
> > probably be possible to actually shove this into a sub-make which
> > defined the hdr-check rules, but I don't know how complicated that would
> > become.
> 
> This seems to work, though it's kind of horrid.
> 
> It costs at least one extra process to run "make hdr-check", and
> probably more for things like $(GIT_VERSION) that the Makefile include
> likely triggers. But when you're not running hdr-check (which is the
> norm), it's zero-cost.

If we want to go that route (and I am not saying we should), we could
easily just add another target (say, `check-headers`) that requires a list
of headers to check to be passed in via a Makefile variable that is
defined via the command-line.

Ciao,
Dscho

> 
> -Peff
> 
> diff --git a/Makefile b/Makefile
> index c5240942f2..ab6ecf450e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2735,16 +2735,8 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE
>  .PHONY: sparse $(SP_OBJ)
>  sparse: $(SP_OBJ)
>  
> -GEN_HDRS := command-list.h unicode-width.h
> -EXCEPT_HDRS := $(GEN_HDRS) compat% xdiff%
> -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 $<
> -
> -.PHONY: hdr-check $(HCO)
> -hdr-check: $(HCO)
> +hdr-check:
> +	$(MAKE) -f hdr-check.mak hdr-check
>  
>  .PHONY: style
>  style:
> diff --git a/hdr-check.mak b/hdr-check.mak
> new file mode 100644
> index 0000000000..b8924afa90
> --- /dev/null
> +++ b/hdr-check.mak
> @@ -0,0 +1,12 @@
> +include Makefile
> +
> +GEN_HDRS := command-list.h unicode-width.h
> +EXCEPT_HDRS := $(GEN_HDRS) compat% xdiff%
> +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 $<
> +
> +.PHONY: hdr-check $(HCO)
> +hdr-check: $(HCO)
> 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux